Allow to run xrandr instead of vidmode as an option

This commit is contained in:
Deve 2014-05-12 20:06:44 +02:00
parent 96babc81ad
commit 0b463f5222
3 changed files with 35 additions and 0 deletions

View File

@ -17,6 +17,7 @@ option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
if(UNIX)
option(USE_CPP2011 "Activate C++ 2011 mode (GCC only)" OFF)
option(USE_XRANDR "Use xrandr instead of vidmode" OFF)
endif()
if(MSVC)
# Normally hide the option to build wiiuse on VS, since it depends
@ -117,6 +118,11 @@ if(USE_FRIBIDI)
endif()
endif()
# Xrandr
if(UNIX AND USE_XRANDR)
find_package(Xrandr REQUIRED)
endif()
if(UNIX)
if(USE_CPP2011)
add_definitions("-std=c++0x")
@ -278,6 +284,11 @@ if(USE_WIIUSE)
endif()
# Xrandr
if(UNIX AND USE_XRANDR)
target_link_libraries(supertuxkart ${XRANDR_LIBRARIES})
endif()
if(MSVC)
target_link_libraries(supertuxkart iphlpapi.lib)
add_custom_command(TARGET supertuxkart POST_BUILD

18
cmake/FindXrandr.cmake Normal file
View File

@ -0,0 +1,18 @@
find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
PATH_SUFFIXES X11/extensions
DOC "The XRANDR include directory"
)
find_library(XRANDR_LIBRARY NAMES Xrandr
DOC "The XRANDR library"
)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XRANDR DEFAULT_MSG XRANDR_LIBRARY XRANDR_INCLUDE_DIR)
if(XRANDR_FOUND)
set( XRANDR_LIBRARIES ${XRANDR_LIBRARY} )
set( XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDE_DIR} )
endif()
mark_as_advanced(XRANDR_INCLUDE_DIR XRANDR_LIBRARY)

View File

@ -21,6 +21,12 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pipe -O3 -fno-exceptions -fstrict-aliasing -fexpensive-optimizations -I/usr/X11R6/include")
endif()
# Xrandr
if(UNIX AND USE_XRANDR)
add_definitions(-DNO_IRR_LINUX_X11_VIDMODE_)
add_definitions(-D_IRR_LINUX_X11_RANDR_)
endif()
set(IRRLICHT_SOURCES
source/Irrlicht/CTRStencilShadow.cpp
source/Irrlicht/CGUIListBox.cpp