summaryrefslogtreecommitdiff
path: root/ext/glfw/CMake
diff options
context:
space:
mode:
authorLorenzo Torres <lorenzotorres@outlook.it>2025-03-12 19:56:19 +0100
committerLorenzo Torres <lorenzotorres@outlook.it>2025-03-12 19:56:19 +0100
commit4f45899a3c28440724ffcaa3a604ad48f18a25c8 (patch)
treececd79da4e3e3cb17ffd86ec1a58d6e77a44cb83 /ext/glfw/CMake
parentfc39b277155044366f1647b238a415fab4028d83 (diff)
base code
Diffstat (limited to 'ext/glfw/CMake')
-rw-r--r--ext/glfw/CMake/GenerateMappings.cmake50
-rw-r--r--ext/glfw/CMake/Info.plist.in38
-rw-r--r--ext/glfw/CMake/cmake_uninstall.cmake.in29
-rw-r--r--ext/glfw/CMake/glfw3.pc.in13
-rw-r--r--ext/glfw/CMake/glfw3Config.cmake.in3
-rw-r--r--ext/glfw/CMake/i686-w64-mingw32-clang.cmake13
-rw-r--r--ext/glfw/CMake/i686-w64-mingw32.cmake13
-rw-r--r--ext/glfw/CMake/modules/FindEpollShim.cmake17
-rw-r--r--ext/glfw/CMake/x86_64-w64-mingw32-clang.cmake13
-rw-r--r--ext/glfw/CMake/x86_64-w64-mingw32.cmake13
10 files changed, 202 insertions, 0 deletions
diff --git a/ext/glfw/CMake/GenerateMappings.cmake b/ext/glfw/CMake/GenerateMappings.cmake
new file mode 100644
index 0000000..9a95df6
--- /dev/null
+++ b/ext/glfw/CMake/GenerateMappings.cmake
@@ -0,0 +1,50 @@
+# Usage:
+# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
+
+cmake_policy(VERSION 3.16)
+
+set(source_url "https://raw.githubusercontent.com/gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt")
+set(source_path "${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt")
+set(template_path "${CMAKE_ARGV3}")
+set(target_path "${CMAKE_ARGV4}")
+
+if (NOT EXISTS "${template_path}")
+ message(FATAL_ERROR "Failed to find template file ${template_path}")
+endif()
+
+file(DOWNLOAD "${source_url}" "${source_path}"
+ STATUS download_status
+ TLS_VERIFY on)
+
+list(GET download_status 0 status_code)
+list(GET download_status 1 status_message)
+
+if (status_code)
+ message(FATAL_ERROR "Failed to download ${source_url}: ${status_message}")
+endif()
+
+file(STRINGS "${source_path}" lines)
+list(FILTER lines INCLUDE REGEX "^[0-9a-fA-F]")
+
+foreach(line IN LISTS lines)
+ if (line MATCHES "platform:Windows")
+ if (GLFW_WIN32_MAPPINGS)
+ string(APPEND GLFW_WIN32_MAPPINGS "\n")
+ endif()
+ string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",")
+ elseif (line MATCHES "platform:Mac OS X")
+ if (GLFW_COCOA_MAPPINGS)
+ string(APPEND GLFW_COCOA_MAPPINGS "\n")
+ endif()
+ string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",")
+ elseif (line MATCHES "platform:Linux")
+ if (GLFW_LINUX_MAPPINGS)
+ string(APPEND GLFW_LINUX_MAPPINGS "\n")
+ endif()
+ string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",")
+ endif()
+endforeach()
+
+configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX)
+file(REMOVE "${source_path}")
+
diff --git a/ext/glfw/CMake/Info.plist.in b/ext/glfw/CMake/Info.plist.in
new file mode 100644
index 0000000..684ad79
--- /dev/null
+++ b/ext/glfw/CMake/Info.plist.in
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+ <key>CFBundleGetInfoString</key>
+ <string>${MACOSX_BUNDLE_INFO_STRING}</string>
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleLongVersionString</key>
+ <string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+ <key>LSRequiresCarbon</key>
+ <true/>
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+ <key>NSHighResolutionCapable</key>
+ <true/>
+</dict>
+</plist>
diff --git a/ext/glfw/CMake/cmake_uninstall.cmake.in b/ext/glfw/CMake/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..5ecc476
--- /dev/null
+++ b/ext/glfw/CMake/cmake_uninstall.cmake.in
@@ -0,0 +1,29 @@
+
+if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"")
+endif()
+
+file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+
+foreach (file ${files})
+ message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+ if (EXISTS "$ENV{DESTDIR}${file}")
+ exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval)
+ if (NOT "${rm_retval}" STREQUAL 0)
+ MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+ endif()
+ elseif (IS_SYMLINK "$ENV{DESTDIR}${file}")
+ EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval)
+ if (NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"")
+ endif()
+ else()
+ message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+ endif()
+endforeach()
+
diff --git a/ext/glfw/CMake/glfw3.pc.in b/ext/glfw/CMake/glfw3.pc.in
new file mode 100644
index 0000000..36ee218
--- /dev/null
+++ b/ext/glfw/CMake/glfw3.pc.in
@@ -0,0 +1,13 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+
+Name: GLFW
+Description: A multi-platform library for OpenGL, window and input
+Version: @GLFW_VERSION@
+URL: https://www.glfw.org/
+Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@
+Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@
+Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@
+Cflags: -I${includedir}
diff --git a/ext/glfw/CMake/glfw3Config.cmake.in b/ext/glfw/CMake/glfw3Config.cmake.in
new file mode 100644
index 0000000..4a13a88
--- /dev/null
+++ b/ext/glfw/CMake/glfw3Config.cmake.in
@@ -0,0 +1,3 @@
+include(CMakeFindDependencyMacro)
+find_dependency(Threads)
+include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake")
diff --git a/ext/glfw/CMake/i686-w64-mingw32-clang.cmake b/ext/glfw/CMake/i686-w64-mingw32-clang.cmake
new file mode 100644
index 0000000..8726b23
--- /dev/null
+++ b/ext/glfw/CMake/i686-w64-mingw32-clang.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross-compiling with 32-bit MinGW-w64 Clang
+SET(CMAKE_SYSTEM_NAME Windows) # Target system name
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "i686-w64-mingw32-clang")
+SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-clang++")
+SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
+SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
+
+# Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/ext/glfw/CMake/i686-w64-mingw32.cmake b/ext/glfw/CMake/i686-w64-mingw32.cmake
new file mode 100644
index 0000000..2ca4dcd
--- /dev/null
+++ b/ext/glfw/CMake/i686-w64-mingw32.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross-compiling with 32-bit MinGW-w64 GCC
+SET(CMAKE_SYSTEM_NAME Windows) # Target system name
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc")
+SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++")
+SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
+SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
+
+# Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/ext/glfw/CMake/modules/FindEpollShim.cmake b/ext/glfw/CMake/modules/FindEpollShim.cmake
new file mode 100644
index 0000000..f34d070
--- /dev/null
+++ b/ext/glfw/CMake/modules/FindEpollShim.cmake
@@ -0,0 +1,17 @@
+# Find EpollShim
+# Once done, this will define
+#
+# EPOLLSHIM_FOUND - System has EpollShim
+# EPOLLSHIM_INCLUDE_DIRS - The EpollShim include directories
+# EPOLLSHIM_LIBRARIES - The libraries needed to use EpollShim
+
+find_path(EPOLLSHIM_INCLUDE_DIRS NAMES sys/epoll.h sys/timerfd.h HINTS /usr/local/include/libepoll-shim)
+find_library(EPOLLSHIM_LIBRARIES NAMES epoll-shim libepoll-shim HINTS /usr/local/lib)
+
+if (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
+ set(EPOLLSHIM_FOUND TRUE)
+endif (EPOLLSHIM_INCLUDE_DIRS AND EPOLLSHIM_LIBRARIES)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(EpollShim DEFAULT_MSG EPOLLSHIM_LIBRARIES EPOLLSHIM_INCLUDE_DIRS)
+mark_as_advanced(EPOLLSHIM_INCLUDE_DIRS EPOLLSHIM_LIBRARIES)
diff --git a/ext/glfw/CMake/x86_64-w64-mingw32-clang.cmake b/ext/glfw/CMake/x86_64-w64-mingw32-clang.cmake
new file mode 100644
index 0000000..60f7914
--- /dev/null
+++ b/ext/glfw/CMake/x86_64-w64-mingw32-clang.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross-compiling with 64-bit MinGW-w64 Clang
+SET(CMAKE_SYSTEM_NAME Windows) # Target system name
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-clang")
+SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-clang++")
+SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
+SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
+
+# Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff --git a/ext/glfw/CMake/x86_64-w64-mingw32.cmake b/ext/glfw/CMake/x86_64-w64-mingw32.cmake
new file mode 100644
index 0000000..063e845
--- /dev/null
+++ b/ext/glfw/CMake/x86_64-w64-mingw32.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross-compiling with 64-bit MinGW-w64 GCC
+SET(CMAKE_SYSTEM_NAME Windows) # Target system name
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc")
+SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++")
+SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
+SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
+
+# Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)