CMake: Make X11 and EGL optional

This commit is contained in:
Stenzek
2018-10-14 23:17:31 +10:00
parent 0559311f92
commit c95802afeb
5 changed files with 126 additions and 43 deletions

View File

@ -414,18 +414,30 @@ if (OPENGL_GL)
endif()
if(ENABLE_X11)
find_package(X11 REQUIRED)
add_definitions(-DHAVE_X11=1)
message(STATUS "X11 support enabled")
check_lib(XRANDR xrandr Xrandr)
if(XRANDR_FOUND)
add_definitions(-DHAVE_XRANDR=1)
find_package(X11)
if(X11_FOUND)
add_definitions(-DHAVE_X11=1)
check_lib(XRANDR xrandr Xrandr)
if(XRANDR_FOUND)
add_definitions(-DHAVE_XRANDR=1)
else()
add_definitions(-DHAVE_XRANDR=0)
endif()
pkg_check_modules(X11_INPUT REQUIRED xi>=1.5.0)
message(STATUS "X11 support enabled")
else()
add_definitions(-DHAVE_XRANDR=0)
message(WARNING "X11 support enabled but not found. This build will not support X11.")
endif()
endif()
pkg_check_modules(X11_INPUT REQUIRED xi>=1.5.0)
if(ENABLE_EGL)
find_package(EGL)
if(EGL_FOUND)
add_definitions(-DHAVE_EGL=1)
message(STATUS "EGL OpenGL interface enabled")
else()
message(WARNING "EGL support enabled but not found. This build will not support EGL.")
endif()
endif()
if(ENCODE_FRAMEDUMPS)
@ -451,11 +463,6 @@ if(OPROFILING)
endif()
endif()
if(ENABLE_EGL)
message(STATUS "EGL OpenGL interface enabled")
add_definitions(-DUSE_EGL=1)
endif()
if(ENABLE_EVDEV)
find_package(Libudev REQUIRED)
find_package(Libevdev REQUIRED)