mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Replaced hand rolled X extension detection with built-in version.
This commit is contained in:
parent
f2062e06b7
commit
d608eb0086
@ -1,88 +0,0 @@
|
||||
# - Check if X11 RandR extension is available
|
||||
# Check if the X11 extension RandR is available.
|
||||
# This macro defines :
|
||||
# - X11_RANDR_FOUND, If set to NO RandR is not available.
|
||||
# - X11_RANDR_INCLUDE_DIR, includes directory containing the RandR header.
|
||||
# - X11_RANDR_LIBRARIES, libraries to link in the library to use RandR.
|
||||
#
|
||||
# Created by Olivier Delannoy.
|
||||
macro(CHECK_X11_XRANDR)
|
||||
message(STATUS "Checking for X11 extension XRandR")
|
||||
set(X11_XRANDR_FOUND "NO")
|
||||
find_path(X11_XRANDR_INCLUDE_DIR "X11/extensions/Xrandr.h"
|
||||
PATHS
|
||||
/usr/local/include
|
||||
/usr/local/X11/include
|
||||
/usr/local/X11R6/include
|
||||
/usr/include
|
||||
/usr/X11/include
|
||||
/usr/X11R6/include)
|
||||
|
||||
find_library(X11_XRANDR_LIBRARIES NAMES Xrandr
|
||||
PATHS
|
||||
/usr/local/lib
|
||||
/usr/local/X11/lib
|
||||
/usr/local/X11R6/lib
|
||||
/usr/lib
|
||||
/usr/X11/lib
|
||||
/usr/X11R6/lib)
|
||||
# Create check if file compiles with randr
|
||||
|
||||
if (X11_XRANDR_LIBRARIES AND X11_XRANDR_INCLUDE_DIR)
|
||||
set(X11_XRANDR_FOUND "YES")
|
||||
endif (X11_XRANDR_LIBRARIES AND X11_XRANDR_INCLUDE_DIR)
|
||||
|
||||
if (X11_XRANDR_FOUND)
|
||||
message(STATUS "Checking for X11 extension XRandR -- found")
|
||||
else (X11_XRANDR_FOUND)
|
||||
message(STATUS "Checking for X11 extension XRandR -- not found")
|
||||
endif (X11_XRANDR_FOUND)
|
||||
|
||||
mark_as_advanced(X11_XRANDR_LIBRARIES X11_XRANDR_INCLUDE_DIR)
|
||||
endmacro(CHECK_X11_XRANDR)
|
||||
|
||||
|
||||
# - Check if X11 VidMod extension is available
|
||||
# Check if the X11 extension VidMod is available.
|
||||
# This macro defines :
|
||||
# - X11_VIDMOD_FOUND, If set to NO VidMod is not available.
|
||||
# - X11_VIDMOD_INCLUDE_DIR, includes directory containing the headers.
|
||||
# - X11_VIDMOD_LIBRARIES, libraries to link in the libraries.
|
||||
#
|
||||
# Created by Olivier Delannoy.
|
||||
macro(CHECK_X11_XF86VIDMODE)
|
||||
message(STATUS "Checking for X11 extension xf86vidmode")
|
||||
set(X11_XF86VIDMODE_FOUND "NO")
|
||||
find_path(X11_XF86VIDMODE_INCLUDE_DIR "X11/extensions/xf86vmode.h"
|
||||
PATHS
|
||||
/usr/local/include
|
||||
/usr/local/X11/include
|
||||
/usr/local/X11R6/include
|
||||
/usr/include
|
||||
/usr/X11/include
|
||||
/usr/X11R6/include)
|
||||
|
||||
find_library(X11_XF86VIDMODE_LIBRARIES NAMES Xxf86vm PATHS
|
||||
/usr/local/lib
|
||||
/usr/local/X11/lib
|
||||
/usr/local/X11R6/lib
|
||||
/usr/lib
|
||||
/usr/X11/lib
|
||||
/usr/X11R6/lib)
|
||||
# Add a test case here
|
||||
if (X11_XF86VIDMODE_LIBRARIES AND X11_XF86VIDMODE_INCLUDE_DIR)
|
||||
set(X11_XF86VIDMODE_FOUND "YES")
|
||||
endif (X11_XF86VIDMODE_LIBRARIES AND X11_XF86VIDMODE_INCLUDE_DIR)
|
||||
|
||||
if (X11_XF86VIDMODE_FOUND)
|
||||
message(STATUS "Checking for X11 extension xf86vidmode -- found")
|
||||
else (X11_XF86VIDMODE_FOUND)
|
||||
message(STATUS "Checking for X11 extension xf86vidmode -- not found")
|
||||
endif(X11_XF86VIDMODE_FOUND)
|
||||
|
||||
mark_as_advanced(
|
||||
X11_XF86VIDMODE_LIBRARIES
|
||||
X11_XF86VIDMODE_INCLUDE_DIR
|
||||
)
|
||||
|
||||
endmacro(CHECK_X11_XF86VIDMODE)
|
@ -38,6 +38,8 @@ if (UNIX AND NOT APPLE)
|
||||
# Define the platform identifier
|
||||
set(_GLFW_X11_GLX 1)
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND GLFW_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY})
|
||||
@ -55,27 +57,26 @@ if (UNIX AND NOT APPLE)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
include(${GLFW_SOURCE_DIR}/CMake/CheckX11Extensions.cmake)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GLFW_LIBRARIES})
|
||||
|
||||
# Check for XRandR (modern resolution switching extension)
|
||||
check_x11_xrandr()
|
||||
if (X11_XRANDR_FOUND)
|
||||
if (X11_Xrandr_FOUND)
|
||||
set(_GLFW_HAS_XRANDR 1)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_XRANDR_INCLUDE_DIR})
|
||||
list(APPEND GLFW_LIBRARIES ${X11_XRANDR_LIBRARIES})
|
||||
endif(X11_XRANDR_FOUND)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH})
|
||||
list(APPEND GLFW_LIBRARIES ${X11_Xrandr_LIB})
|
||||
endif()
|
||||
|
||||
# Check for Xf86VidMode (fallback legacy resolution switching extension)
|
||||
check_x11_xf86vidmode()
|
||||
if (X11_XF86VIDMODE_FOUND)
|
||||
if (X11_xf86vmode_FOUND)
|
||||
set(_GLFW_HAS_XF86VIDMODE 1)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_XF86VIDMODE_INCLUDE_DIR})
|
||||
list(APPEND GLFW_LIBRARIES ${X11_XF86VIDMODE_LIBRARIES})
|
||||
endif(X11_XF86VIDMODE_FOUND)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_xf86vmode_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
# Check for Xkb (X keyboard extension)
|
||||
check_function_exists(XkbQueryExtension _GLFW_HAS_XKB)
|
||||
if (X11_Xkb_FOUND)
|
||||
set(_GLFW_HAS_XKB 1)
|
||||
list(APPEND GLFW_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
# Check for glXGetProcAddress
|
||||
check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
|
||||
|
Loading…
Reference in New Issue
Block a user