summaryrefslogtreecommitdiffhomepage
path: root/src/external/glfw/CMake
diff options
context:
space:
mode:
authorAhmad Fatoum <[email protected]>2018-05-10 22:40:41 +0200
committerAhmad Fatoum <[email protected]>2018-05-10 23:07:26 +0200
commit0df501be91a09af6b4b06bf44df86d8d06cdcada (patch)
tree9f9d0a7222b562952d0551bc17b6ca753b5f12ec /src/external/glfw/CMake
parentf11fe801809f5697c96010e0f08e26dc87c85b1b (diff)
downloadraylib-0df501be91a09af6b4b06bf44df86d8d06cdcada.tar.gz
raylib-0df501be91a09af6b4b06bf44df86d8d06cdcada.zip
Add GLFW source tree to src/external
We need the CMake stuff for wayland configuration. Otherwise, we would have to replicate that ourselves. This is the full 7ef34eb06de54dd9186d3d21a401b2ef819b59e7 tree except for tests/ examples/ and docs/
Diffstat (limited to 'src/external/glfw/CMake')
-rw-r--r--src/external/glfw/CMake/GenerateMappings.cmake33
-rw-r--r--src/external/glfw/CMake/MacOSXBundleInfo.plist.in38
-rw-r--r--src/external/glfw/CMake/amd64-mingw32msvc.cmake13
-rw-r--r--src/external/glfw/CMake/i586-mingw32msvc.cmake13
-rw-r--r--src/external/glfw/CMake/i686-pc-mingw32.cmake13
-rw-r--r--src/external/glfw/CMake/i686-w64-mingw32.cmake13
-rw-r--r--src/external/glfw/CMake/modules/FindEpollShim.cmake17
-rw-r--r--src/external/glfw/CMake/modules/FindMir.cmake34
-rw-r--r--src/external/glfw/CMake/modules/FindOSMesa.cmake18
-rw-r--r--src/external/glfw/CMake/modules/FindVulkan.cmake46
-rw-r--r--src/external/glfw/CMake/modules/FindWaylandProtocols.cmake26
-rw-r--r--src/external/glfw/CMake/modules/FindXKBCommon.cmake34
-rw-r--r--src/external/glfw/CMake/x86_64-w64-mingw32.cmake13
13 files changed, 311 insertions, 0 deletions
diff --git a/src/external/glfw/CMake/GenerateMappings.cmake b/src/external/glfw/CMake/GenerateMappings.cmake
new file mode 100644
index 00000000..7a88e3d4
--- /dev/null
+++ b/src/external/glfw/CMake/GenerateMappings.cmake
@@ -0,0 +1,33 @@
+# Usage:
+# cmake -P GenerateMappings.cmake <path/to/mappings.h.in> <path/to/mappings.h>
+
+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)
+foreach(line ${lines})
+ if ("${line}" MATCHES "^[0-9a-fA-F].*$")
+ set(GLFW_GAMEPAD_MAPPINGS "${GLFW_GAMEPAD_MAPPINGS}\"${line}\",\n")
+ endif()
+endforeach()
+
+configure_file("${template_path}" "${target_path}" @ONLY NEWLINE_STYLE UNIX)
+file(REMOVE "${source_path}")
+
diff --git a/src/external/glfw/CMake/MacOSXBundleInfo.plist.in b/src/external/glfw/CMake/MacOSXBundleInfo.plist.in
new file mode 100644
index 00000000..684ad790
--- /dev/null
+++ b/src/external/glfw/CMake/MacOSXBundleInfo.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/src/external/glfw/CMake/amd64-mingw32msvc.cmake b/src/external/glfw/CMake/amd64-mingw32msvc.cmake
new file mode 100644
index 00000000..c264ff0d
--- /dev/null
+++ b/src/external/glfw/CMake/amd64-mingw32msvc.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross compiling from Linux to Win64
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "amd64-mingw32msvc-gcc")
+SET(CMAKE_CXX_COMPILER "amd64-mingw32msvc-g++")
+SET(CMAKE_RC_COMPILER "amd64-mingw32msvc-windres")
+SET(CMAKE_RANLIB "amd64-mingw32msvc-ranlib")
+
+# Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/usr/amd64-mingw32msvc")
+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/src/external/glfw/CMake/i586-mingw32msvc.cmake b/src/external/glfw/CMake/i586-mingw32msvc.cmake
new file mode 100644
index 00000000..c871e5be
--- /dev/null
+++ b/src/external/glfw/CMake/i586-mingw32msvc.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross compiling from Linux to Win32
+SET(CMAKE_SYSTEM_NAME Windows)
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "i586-mingw32msvc-gcc")
+SET(CMAKE_CXX_COMPILER "i586-mingw32msvc-g++")
+SET(CMAKE_RC_COMPILER "i586-mingw32msvc-windres")
+SET(CMAKE_RANLIB "i586-mingw32msvc-ranlib")
+
+# Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/usr/i586-mingw32msvc")
+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/src/external/glfw/CMake/i686-pc-mingw32.cmake b/src/external/glfw/CMake/i686-pc-mingw32.cmake
new file mode 100644
index 00000000..b657d944
--- /dev/null
+++ b/src/external/glfw/CMake/i686-pc-mingw32.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross compiling from Linux to Win32
+SET(CMAKE_SYSTEM_NAME Windows) # Target system name
+SET(CMAKE_SYSTEM_VERSION 1)
+SET(CMAKE_C_COMPILER "i686-pc-mingw32-gcc")
+SET(CMAKE_CXX_COMPILER "i686-pc-mingw32-g++")
+SET(CMAKE_RC_COMPILER "i686-pc-mingw32-windres")
+SET(CMAKE_RANLIB "i686-pc-mingw32-ranlib")
+
+#Configure the behaviour of the find commands
+SET(CMAKE_FIND_ROOT_PATH "/opt/mingw/usr/i686-pc-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/src/external/glfw/CMake/i686-w64-mingw32.cmake b/src/external/glfw/CMake/i686-w64-mingw32.cmake
new file mode 100644
index 00000000..bbd9f895
--- /dev/null
+++ b/src/external/glfw/CMake/i686-w64-mingw32.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross compiling from Linux to Win32
+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/src/external/glfw/CMake/modules/FindEpollShim.cmake b/src/external/glfw/CMake/modules/FindEpollShim.cmake
new file mode 100644
index 00000000..2facb419
--- /dev/null
+++ b/src/external/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/src/external/glfw/CMake/modules/FindMir.cmake b/src/external/glfw/CMake/modules/FindMir.cmake
new file mode 100644
index 00000000..2104df8a
--- /dev/null
+++ b/src/external/glfw/CMake/modules/FindMir.cmake
@@ -0,0 +1,34 @@
+# FindMir
+# -------
+# Finds the Mir library
+#
+# This will will define the following variables::
+#
+# MIR_FOUND - the system has Mir
+# MIR_INCLUDE_DIRS - the Mir include directory
+# MIR_LIBRARIES - the Mir libraries
+# MIR_DEFINITIONS - the Mir definitions
+
+
+find_package (PkgConfig)
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules (PC_MIR mirclient>=0.26.2 QUIET)
+
+ find_path(MIR_INCLUDE_DIR NAMES mir_toolkit/mir_client_library.h
+ PATHS ${PC_MIR_INCLUDE_DIRS})
+
+ find_library(MIR_LIBRARY NAMES mirclient
+ PATHS ${PC_MIR_LIBRARIES} ${PC_MIR_LIBRARY_DIRS})
+
+ include (FindPackageHandleStandardArgs)
+ find_package_handle_standard_args (MIR
+ REQUIRED_VARS MIR_LIBRARY MIR_INCLUDE_DIR)
+
+ if (MIR_FOUND)
+ set(MIR_LIBRARIES ${MIR_LIBRARY})
+ set(MIR_INCLUDE_DIRS ${PC_MIR_INCLUDE_DIRS})
+ set(MIR_DEFINITIONS -DHAVE_MIR=1)
+ endif()
+
+ mark_as_advanced (MIR_LIBRARY MIR_INCLUDE_DIR)
+endif()
diff --git a/src/external/glfw/CMake/modules/FindOSMesa.cmake b/src/external/glfw/CMake/modules/FindOSMesa.cmake
new file mode 100644
index 00000000..3194bd91
--- /dev/null
+++ b/src/external/glfw/CMake/modules/FindOSMesa.cmake
@@ -0,0 +1,18 @@
+# Try to find OSMesa on a Unix system
+#
+# This will define:
+#
+# OSMESA_LIBRARIES - Link these to use OSMesa
+# OSMESA_INCLUDE_DIR - Include directory for OSMesa
+#
+# Copyright (c) 2014 Brandon Schaefer <[email protected]>
+
+if (NOT WIN32)
+
+ find_package (PkgConfig)
+ pkg_check_modules (PKG_OSMESA QUIET osmesa)
+
+ set (OSMESA_INCLUDE_DIR ${PKG_OSMESA_INCLUDE_DIRS})
+ set (OSMESA_LIBRARIES ${PKG_OSMESA_LIBRARIES})
+
+endif ()
diff --git a/src/external/glfw/CMake/modules/FindVulkan.cmake b/src/external/glfw/CMake/modules/FindVulkan.cmake
new file mode 100644
index 00000000..103554bb
--- /dev/null
+++ b/src/external/glfw/CMake/modules/FindVulkan.cmake
@@ -0,0 +1,46 @@
+# Find Vulkan
+#
+# VULKAN_INCLUDE_DIR
+# VULKAN_LIBRARY
+# VULKAN_FOUND
+
+if (WIN32)
+ find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
+ "$ENV{VULKAN_SDK}/Include"
+ "$ENV{VK_SDK_PATH}/Include")
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
+ "$ENV{VULKAN_SDK}/Lib"
+ "$ENV{VULKAN_SDK}/Bin"
+ "$ENV{VK_SDK_PATH}/Bin")
+ find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
+ "$ENV{VULKAN_SDK}/Lib"
+ "$ENV{VULKAN_SDK}/Bin"
+ "$ENV{VK_SDK_PATH}/Bin")
+ else()
+ find_library(VULKAN_LIBRARY NAMES vulkan-1 HINTS
+ "$ENV{VULKAN_SDK}/Lib32"
+ "$ENV{VULKAN_SDK}/Bin32"
+ "$ENV{VK_SDK_PATH}/Bin32")
+ find_library(VULKAN_STATIC_LIBRARY NAMES vkstatic.1 HINTS
+ "$ENV{VULKAN_SDK}/Lib32"
+ "$ENV{VULKAN_SDK}/Bin32"
+ "$ENV{VK_SDK_PATH}/Bin32")
+ endif()
+elseif (APPLE)
+ find_library(VULKAN_LIBRARY vulkan.1 HINTS
+ "$ENV{VULKAN_SDK}/macOS/lib")
+ find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
+ "$ENV{VULKAN_SDK}/macOS/include")
+else()
+ find_path(VULKAN_INCLUDE_DIR NAMES vulkan/vulkan.h HINTS
+ "$ENV{VULKAN_SDK}/include")
+ find_library(VULKAN_LIBRARY NAMES vulkan HINTS
+ "$ENV{VULKAN_SDK}/lib")
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Vulkan DEFAULT_MSG VULKAN_LIBRARY VULKAN_INCLUDE_DIR)
+
+mark_as_advanced(VULKAN_INCLUDE_DIR VULKAN_LIBRARY VULKAN_STATIC_LIBRARY)
+
diff --git a/src/external/glfw/CMake/modules/FindWaylandProtocols.cmake b/src/external/glfw/CMake/modules/FindWaylandProtocols.cmake
new file mode 100644
index 00000000..8eb83f27
--- /dev/null
+++ b/src/external/glfw/CMake/modules/FindWaylandProtocols.cmake
@@ -0,0 +1,26 @@
+find_package(PkgConfig)
+
+pkg_check_modules(WaylandProtocols QUIET wayland-protocols>=${WaylandProtocols_FIND_VERSION})
+
+execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=pkgdatadir wayland-protocols
+ OUTPUT_VARIABLE WaylandProtocols_PKGDATADIR
+ RESULT_VARIABLE _pkgconfig_failed)
+if (_pkgconfig_failed)
+ message(FATAL_ERROR "Missing wayland-protocols pkgdatadir")
+endif()
+
+string(REGEX REPLACE "[\r\n]" "" WaylandProtocols_PKGDATADIR "${WaylandProtocols_PKGDATADIR}")
+
+find_package_handle_standard_args(WaylandProtocols
+ FOUND_VAR
+ WaylandProtocols_FOUND
+ REQUIRED_VARS
+ WaylandProtocols_PKGDATADIR
+ VERSION_VAR
+ WaylandProtocols_VERSION
+ HANDLE_COMPONENTS
+)
+
+set(WAYLAND_PROTOCOLS_FOUND ${WaylandProtocols_FOUND})
+set(WAYLAND_PROTOCOLS_PKGDATADIR ${WaylandProtocols_PKGDATADIR})
+set(WAYLAND_PROTOCOLS_VERSION ${WaylandProtocols_VERSION})
diff --git a/src/external/glfw/CMake/modules/FindXKBCommon.cmake b/src/external/glfw/CMake/modules/FindXKBCommon.cmake
new file mode 100644
index 00000000..0f571eea
--- /dev/null
+++ b/src/external/glfw/CMake/modules/FindXKBCommon.cmake
@@ -0,0 +1,34 @@
+# - Try to find XKBCommon
+# Once done, this will define
+#
+# XKBCOMMON_FOUND - System has XKBCommon
+# XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories
+# XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon
+# XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon
+
+find_package(PkgConfig)
+pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon)
+set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER})
+
+find_path(XKBCOMMON_INCLUDE_DIR
+ NAMES xkbcommon/xkbcommon.h
+ HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS}
+)
+
+find_library(XKBCOMMON_LIBRARY
+ NAMES xkbcommon
+ HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS}
+)
+
+set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY})
+set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS})
+set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XKBCommon DEFAULT_MSG
+ XKBCOMMON_LIBRARY
+ XKBCOMMON_INCLUDE_DIR
+)
+
+mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR)
+
diff --git a/src/external/glfw/CMake/x86_64-w64-mingw32.cmake b/src/external/glfw/CMake/x86_64-w64-mingw32.cmake
new file mode 100644
index 00000000..e629e457
--- /dev/null
+++ b/src/external/glfw/CMake/x86_64-w64-mingw32.cmake
@@ -0,0 +1,13 @@
+# Define the environment for cross compiling from Linux to Win32
+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)