|
|
|
@ -61,7 +61,7 @@ if (GLFW_USE_EGL) |
|
|
|
|
message(FATAL_ERROR "Unsupported client library") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/modules) |
|
|
|
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake/modules") |
|
|
|
|
find_package(EGL REQUIRED) |
|
|
|
|
|
|
|
|
|
if (NOT _GLFW_USE_OPENGL) |
|
|
|
@ -200,8 +200,8 @@ if (_GLFW_WGL) |
|
|
|
|
|
|
|
|
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lopengl32") |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
@ -214,10 +214,10 @@ if (_GLFW_X11) |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} x11") |
|
|
|
|
|
|
|
|
|
# Set up library and include paths |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${X11_X11_LIB} ${CMAKE_THREAD_LIBS_INIT}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") |
|
|
|
|
if (UNIX AND NOT APPLE) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${RT_LIBRARY}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
# Check for XRandR (modern resolution switching and gamma control) |
|
|
|
@ -225,8 +225,8 @@ if (_GLFW_X11) |
|
|
|
|
message(FATAL_ERROR "The RandR library and headers were not found") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${X11_Xrandr_INCLUDE_PATH}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${X11_Xrandr_LIB}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${X11_Xrandr_LIB}") |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xrandr") |
|
|
|
|
|
|
|
|
|
# Check for XInput (high-resolution cursor motion) |
|
|
|
@ -234,10 +234,10 @@ if (_GLFW_X11) |
|
|
|
|
message(FATAL_ERROR "The XInput library and headers were not found") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${X11_Xinput_INCLUDE_PATH}") |
|
|
|
|
|
|
|
|
|
if (X11_Xinput_LIB) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${X11_Xinput_LIB}") |
|
|
|
|
else() |
|
|
|
|
# Backwards compatibility (bug in CMake 2.8.7) |
|
|
|
|
list(APPEND glfw_LIBRARIES Xi) |
|
|
|
@ -249,11 +249,11 @@ if (_GLFW_X11) |
|
|
|
|
message(FATAL_ERROR "The Xf86VidMode library and headers were not found") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${X11_xf86vmode_INCLUDE_PATH}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${X11_xf86vmode_INCLUDE_PATH}") |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xxf86vm") |
|
|
|
|
|
|
|
|
|
if (X11_Xxf86vm_LIB) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${X11_Xxf86vm_LIB}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${X11_Xxf86vm_LIB}") |
|
|
|
|
else() |
|
|
|
|
# Backwards compatibility (see CMake bug 0006976) |
|
|
|
|
list(APPEND glfw_LIBRARIES Xxf86vm) |
|
|
|
@ -264,19 +264,19 @@ if (_GLFW_X11) |
|
|
|
|
message(FATAL_ERROR "The X keyboard extension headers were not found") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIR "${X11_Xkb_INCLUDE_PATH}") |
|
|
|
|
|
|
|
|
|
find_library(RT_LIBRARY rt) |
|
|
|
|
mark_as_advanced(RT_LIBRARY) |
|
|
|
|
if (RT_LIBRARY) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${RT_LIBRARY}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") |
|
|
|
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lrt") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
find_library(MATH_LIBRARY m) |
|
|
|
|
mark_as_advanced(MATH_LIBRARY) |
|
|
|
|
if (MATH_LIBRARY) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${MATH_LIBRARY}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") |
|
|
|
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
@ -285,8 +285,8 @@ if (_GLFW_X11) |
|
|
|
|
message(FATAL_ERROR "The Xcursor libraries and headers were not found") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIR ${X11_Xcursor_INCLUDE_PATH}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${X11_Xcursor_LIB}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIR "${X11_Xcursor_INCLUDE_PATH}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${X11_Xcursor_LIB}") |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xcursor") |
|
|
|
|
|
|
|
|
|
endif() |
|
|
|
@ -298,18 +298,18 @@ if (_GLFW_WAYLAND) |
|
|
|
|
find_package(Wayland REQUIRED) |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} wayland-egl") |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${WAYLAND_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${WAYLAND_LIBRARIES} -pthread) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${WAYLAND_INCLUDE_DIR}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${WAYLAND_LIBRARIES}" -pthread) |
|
|
|
|
|
|
|
|
|
find_package(XKBCommon REQUIRED) |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xkbcommon") |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIRS}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${XKBCOMMON_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}") |
|
|
|
|
|
|
|
|
|
find_library(MATH_LIBRARY m) |
|
|
|
|
mark_as_advanced(MATH_LIBRARY) |
|
|
|
|
if (MATH_LIBRARY) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${MATH_LIBRARY}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") |
|
|
|
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -lm") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
@ -319,14 +319,14 @@ endif() |
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
|
if (_GLFW_GLX) |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") |
|
|
|
|
|
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl") |
|
|
|
|
|
|
|
|
|
include(CheckFunctionExists) |
|
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY}) |
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES "${OPENGL_gl_LIBRARY}") |
|
|
|
|
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS) |
|
|
|
|
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB) |
|
|
|
|
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT) |
|
|
|
@ -338,14 +338,14 @@ if (_GLFW_GLX) |
|
|
|
|
|
|
|
|
|
# Check for dlopen support as a fallback |
|
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) |
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_DL_LIBS}") |
|
|
|
|
check_function_exists(dlopen _GLFW_HAS_DLOPEN) |
|
|
|
|
if (NOT _GLFW_HAS_DLOPEN) |
|
|
|
|
message(FATAL_ERROR "No entry point retrieval mechanism found") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
if (CMAKE_DL_LIBS) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${CMAKE_DL_LIBS}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}") |
|
|
|
|
set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} -l${CMAKE_DL_LIBS}") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
@ -357,22 +357,22 @@ endif() |
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
|
if (_GLFW_EGL) |
|
|
|
|
|
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${EGL_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${EGL_INCLUDE_DIR}") |
|
|
|
|
list(APPEND glfw_LIBRARIES "${EGL_LIBRARY}") |
|
|
|
|
|
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl") |
|
|
|
|
|
|
|
|
|
if (_GLFW_USE_OPENGL) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${OPENGL_gl_LIBRARY}") |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${OPENGL_INCLUDE_DIR}") |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl") |
|
|
|
|
elseif (_GLFW_USE_GLESV1) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${GLESv1_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${GLESv1_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${GLESv1_LIBRARY}") |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${GLESv1_INCLUDE_DIR}") |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv1_cm") |
|
|
|
|
elseif (_GLFW_USE_GLESV2) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${GLESv2_LIBRARY}) |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS ${GLESv2_INCLUDE_DIR}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${GLESv2_LIBRARY}") |
|
|
|
|
list(APPEND glfw_INCLUDE_DIRS "${GLESv2_INCLUDE_DIR}") |
|
|
|
|
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv2") |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
@ -407,11 +407,11 @@ if (_GLFW_COCOA AND _GLFW_NSGL) |
|
|
|
|
find_library(IOKIT_FRAMEWORK IOKit) |
|
|
|
|
find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation) |
|
|
|
|
find_library(CORE_VIDEO_FRAMEWORK CoreVideo) |
|
|
|
|
list(APPEND glfw_LIBRARIES ${COCOA_FRAMEWORK} |
|
|
|
|
${OPENGL_gl_LIBRARY} |
|
|
|
|
${IOKIT_FRAMEWORK} |
|
|
|
|
${CORE_FOUNDATION_FRAMEWORK} |
|
|
|
|
${CORE_VIDEO_FRAMEWORK}) |
|
|
|
|
list(APPEND glfw_LIBRARIES "${COCOA_FRAMEWORK}" |
|
|
|
|
"${OPENGL_gl_LIBRARY}" |
|
|
|
|
"${IOKIT_FRAMEWORK}" |
|
|
|
|
"${CORE_FOUNDATION_FRAMEWORK}" |
|
|
|
|
"${CORE_VIDEO_FRAMEWORK}") |
|
|
|
|
|
|
|
|
|
set(GLFW_PKG_DEPS "") |
|
|
|
|
set(GLFW_PKG_LIBS "-framework Cocoa -framework OpenGL -framework IOKit -framework CoreFoundation -framework CoreVideo") |
|
|
|
@ -436,21 +436,21 @@ endif() |
|
|
|
|
# Create generated files |
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
|
if (GLFW_BUILD_DOCS) |
|
|
|
|
configure_file(${GLFW_SOURCE_DIR}/docs/Doxyfile.in |
|
|
|
|
${GLFW_BINARY_DIR}/docs/Doxyfile @ONLY) |
|
|
|
|
configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in" |
|
|
|
|
"${GLFW_BINARY_DIR}/docs/Doxyfile" @ONLY) |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|
configure_file(${GLFW_SOURCE_DIR}/src/glfw_config.h.in |
|
|
|
|
${GLFW_BINARY_DIR}/src/glfw_config.h @ONLY) |
|
|
|
|
configure_file("${GLFW_SOURCE_DIR}/src/glfw_config.h.in" |
|
|
|
|
"${GLFW_BINARY_DIR}/src/glfw_config.h" @ONLY) |
|
|
|
|
|
|
|
|
|
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in |
|
|
|
|
${GLFW_BINARY_DIR}/src/glfwConfig.cmake @ONLY) |
|
|
|
|
configure_file("${GLFW_SOURCE_DIR}/src/glfwConfig.cmake.in" |
|
|
|
|
"${GLFW_BINARY_DIR}/src/glfwConfig.cmake" @ONLY) |
|
|
|
|
|
|
|
|
|
configure_file(${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in |
|
|
|
|
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake @ONLY) |
|
|
|
|
configure_file("${GLFW_SOURCE_DIR}/src/glfwConfigVersion.cmake.in" |
|
|
|
|
"${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake" @ONLY) |
|
|
|
|
|
|
|
|
|
configure_file(${GLFW_SOURCE_DIR}/src/glfw3.pc.in |
|
|
|
|
${GLFW_BINARY_DIR}/src/glfw3.pc @ONLY) |
|
|
|
|
configure_file("${GLFW_SOURCE_DIR}/src/glfw3.pc.in" |
|
|
|
|
"${GLFW_BINARY_DIR}/src/glfw3.pc" @ONLY) |
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------- |
|
|
|
|
# Add subdirectories |
|
|
|
@ -477,22 +477,22 @@ if (GLFW_INSTALL) |
|
|
|
|
install(DIRECTORY include/GLFW DESTINATION include |
|
|
|
|
FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h) |
|
|
|
|
|
|
|
|
|
install(FILES ${GLFW_BINARY_DIR}/src/glfwConfig.cmake |
|
|
|
|
${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake |
|
|
|
|
install(FILES "${GLFW_BINARY_DIR}/src/glfwConfig.cmake" |
|
|
|
|
"${GLFW_BINARY_DIR}/src/glfwConfigVersion.cmake" |
|
|
|
|
DESTINATION lib${LIB_SUFFIX}/cmake/glfw) |
|
|
|
|
|
|
|
|
|
install(EXPORT glfwTargets DESTINATION lib${LIB_SUFFIX}/cmake/glfw) |
|
|
|
|
install(FILES ${GLFW_BINARY_DIR}/src/glfw3.pc |
|
|
|
|
install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc" |
|
|
|
|
DESTINATION lib${LIB_SUFFIX}/pkgconfig) |
|
|
|
|
|
|
|
|
|
# Only generate this target if no higher-level project already has |
|
|
|
|
if (NOT TARGET uninstall) |
|
|
|
|
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in |
|
|
|
|
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) |
|
|
|
|
configure_file("${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in" |
|
|
|
|
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) |
|
|
|
|
|
|
|
|
|
add_custom_target(uninstall |
|
|
|
|
${CMAKE_COMMAND} -P |
|
|
|
|
${GLFW_BINARY_DIR}/cmake_uninstall.cmake) |
|
|
|
|
"${CMAKE_COMMAND}" -P |
|
|
|
|
"${GLFW_BINARY_DIR}/cmake_uninstall.cmake") |
|
|
|
|
endif() |
|
|
|
|
endif() |
|
|
|
|
|
|
|
|
|