CMake: Replace "else(condition)" with "else()", etc.

Bumped required CMake version to 2.8.

Thanks to the SDL/Emscripten porting team for this cleanup.
This commit is contained in:
Ryan C. Gordon 2014-12-13 02:33:52 -05:00
parent 708a43f50e
commit a228b67d88
2 changed files with 141 additions and 141 deletions

View File

@ -2,7 +2,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there") message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
endif() endif()
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.8)
project(SDL2 C) project(SDL2 C)
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckLibraryExists) include(CheckLibraryExists)
@ -144,7 +144,7 @@ if("$ENV{CFLAGS}" STREQUAL "")
if(USE_GCC OR USE_CLANG) if(USE_GCC OR USE_CLANG)
set(CMAKE_C_FLAGS "-g -O3") set(CMAKE_C_FLAGS "-g -O3")
endif() endif()
else("$ENV{CFLAGS}" STREQUAL "") else()
set(CMAKE_C_FLAGS "$ENV{CFLAGS}") set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}") list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}")
endif() endif()
@ -161,7 +161,7 @@ if(MSVC)
if(${flag_var} MATCHES "/MD") if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif() endif()
endforeach(flag_var) endforeach()
endif() endif()
endif() endif()
@ -486,7 +486,7 @@ if(ASSEMBLY)
set(SDL_ASSEMBLY_ROUTINES 1) set(SDL_ASSEMBLY_ROUTINES 1)
endif() endif()
# TODO: # TODO:
#else(ASSEMBLY) #else()
# if(USE_GCC OR USE_CLANG) # if(USE_GCC OR USE_CLANG)
# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx") # list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx")
# endif() # endif()
@ -518,7 +518,7 @@ if(LIBC)
set(HAVE_M_PI 1) set(HAVE_M_PI 1)
add_definitions(-D_USE_MATH_DEFINES) # needed for M_PI add_definitions(-D_USE_MATH_DEFINES) # needed for M_PI
set(STDC_HEADERS 1) set(STDC_HEADERS 1)
else(WINDOWS AND NOT MINGW) else()
set(HAVE_LIBC TRUE) set(HAVE_LIBC TRUE)
check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H)
foreach(_HEADER foreach(_HEADER
@ -571,7 +571,7 @@ if(LIBC)
check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION) check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION)
endif() endif()
else(LIBC) else()
if(WINDOWS) if(WINDOWS)
set(HAVE_STDARG_H 1) set(HAVE_STDARG_H 1)
set(HAVE_STDDEF_H 1) set(HAVE_STDDEF_H 1)
@ -752,7 +752,7 @@ if(UNIX AND NOT APPLE)
if(FOUND_CLOCK_GETTIME) if(FOUND_CLOCK_GETTIME)
list(APPEND EXTRA_LIBS rt) list(APPEND EXTRA_LIBS rt)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
else(FOUND_CLOCK_GETTIME) else()
check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME) check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME)
if(FOUND_CLOCK_GETTIME) if(FOUND_CLOCK_GETTIME)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
@ -1193,14 +1193,14 @@ if(NOT WINDOWS OR CYGWIN)
if(SDL_STATIC) if(SDL_STATIC)
set(ENABLE_STATIC_TRUE "") set(ENABLE_STATIC_TRUE "")
set(ENABLE_STATIC_FALSE "#") set(ENABLE_STATIC_FALSE "#")
else(SDL_STATIC) else()
set(ENABLE_STATIC_TRUE "#") set(ENABLE_STATIC_TRUE "#")
set(ENABLE_STATIC_FALSE "") set(ENABLE_STATIC_FALSE "")
endif() endif()
if(SDL_SHARED) if(SDL_SHARED)
set(ENABLE_SHARED_TRUE "") set(ENABLE_SHARED_TRUE "")
set(ENABLE_SHARED_FALSE "#") set(ENABLE_SHARED_FALSE "#")
else(SDL_SHARED) else()
set(ENABLE_SHARED_TRUE "#") set(ENABLE_SHARED_TRUE "#")
set(ENABLE_SHARED_FALSE "") set(ENABLE_SHARED_FALSE "")
endif() endif()
@ -1281,7 +1281,7 @@ if(SDL_SHARED)
VERSION ${LT_VERSION} VERSION ${LT_VERSION}
SOVERSION ${LT_REVISION} SOVERSION ${LT_REVISION}
OUTPUT_NAME "SDL2-${LT_RELEASE}") OUTPUT_NAME "SDL2-${LT_RELEASE}")
else(UNIX) else()
set_target_properties(SDL2 PROPERTIES set_target_properties(SDL2 PROPERTIES
VERSION ${SDL_VERSION} VERSION ${SDL_VERSION}
SOVERSION ${LT_REVISION} SOVERSION ${LT_REVISION}
@ -1330,7 +1330,7 @@ if(NOT WINDOWS OR CYGWIN)
if(FREEBSD) if(FREEBSD)
# FreeBSD uses ${PREFIX}/libdata/pkgconfig # FreeBSD uses ${PREFIX}/libdata/pkgconfig
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig") install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig")
else(FREEBSD) else()
install(FILES ${SDL2_BINARY_DIR}/sdl2.pc install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
DESTINATION "lib${LIB_SUFFIX}/pkgconfig") DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
endif() endif()

View File

@ -39,7 +39,7 @@ macro(CheckDLOPEN)
set(_DLLIB ${_LIBNAME}) set(_DLLIB ${_LIBNAME})
set(HAVE_DLOPEN TRUE) set(HAVE_DLOPEN TRUE)
break() break()
endif(DLOPEN_LIB) endif()
endforeach() endforeach()
endif() endif()
@ -63,7 +63,7 @@ macro(CheckDLOPEN)
set(SOURCE_FILES ${SOURCE_FILES} ${DLOPEN_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DLOPEN_SOURCES})
set(HAVE_SDL_LOADSO TRUE) set(HAVE_SDL_LOADSO TRUE)
endif() endif()
endmacro(CheckDLOPEN) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -78,23 +78,23 @@ macro(CheckOSS)
check_c_source_compiles(" check_c_source_compiles("
#include <soundcard.h> #include <soundcard.h>
int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND) int main() { int arg = SNDCTL_DSP_SETFRAGMENT; }" OSS_FOUND)
endif(NOT OSS_FOUND) endif()
if(OSS_FOUND) if(OSS_FOUND)
set(HAVE_OSS TRUE) set(HAVE_OSS TRUE)
file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c) file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c)
if(OSS_HEADER_FILE STREQUAL "soundcard.h") if(OSS_HEADER_FILE STREQUAL "soundcard.h")
set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1) set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1)
endif(OSS_HEADER_FILE STREQUAL "soundcard.h") endif()
set(SDL_AUDIO_DRIVER_OSS 1) set(SDL_AUDIO_DRIVER_OSS 1)
set(SOURCE_FILES ${SOURCE_FILES} ${OSS_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${OSS_SOURCES})
if(NETBSD OR OPENBSD) if(NETBSD OR OPENBSD)
list(APPEND EXTRA_LIBS ossaudio) list(APPEND EXTRA_LIBS ossaudio)
endif(NETBSD OR OPENBSD) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(OSS_FOUND) endif()
endif(OSS) endif()
endmacro(CheckOSS) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -117,14 +117,14 @@ macro(CheckALSA)
FindLibraryAndSONAME("asound") FindLibraryAndSONAME("asound")
set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"")
set(HAVE_ALSA_SHARED TRUE) set(HAVE_ALSA_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(ALSA_SHARED) else()
list(APPEND EXTRA_LIBS asound) list(APPEND EXTRA_LIBS asound)
endif(ALSA_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(HAVE_ASOUNDLIB_H) endif()
endif(ALSA) endif()
endmacro(CheckALSA) endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
@ -147,14 +147,14 @@ macro(CheckPulseAudio)
FindLibraryAndSONAME("pulse-simple") FindLibraryAndSONAME("pulse-simple")
set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"")
set(HAVE_PULSEAUDIO_SHARED TRUE) set(HAVE_PULSEAUDIO_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(PULSEAUDIO_SHARED) else()
list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS})
endif(PULSEAUDIO_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(PKG_PULSEAUDIO_FOUND) endif()
endif(PULSEAUDIO) endif()
endmacro(CheckPulseAudio) endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
@ -177,14 +177,14 @@ macro(CheckESD)
FindLibraryAndSONAME(esd) FindLibraryAndSONAME(esd)
set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_ESD_DYNAMIC "\"${ESD_LIB_SONAME}\"")
set(HAVE_ESD_SHARED TRUE) set(HAVE_ESD_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(ESD_SHARED) else()
list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${PKG_ESD_LDFLAGS})
endif(ESD_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(PKG_ESD_FOUND) endif()
endif(ESD) endif()
endmacro(CheckESD) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -212,14 +212,14 @@ macro(CheckARTS)
FindLibraryAndSONAME(artsc) FindLibraryAndSONAME(artsc)
set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"")
set(HAVE_ARTS_SHARED TRUE) set(HAVE_ARTS_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(ARTS_SHARED) else()
list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS}) list(APPEND EXTRA_LDFLAGS ${ARTS_LIBS})
endif(ARTS_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(ARTS_CONFIG) endif()
endif(ARTS) endif()
endmacro(CheckARTS) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -243,14 +243,14 @@ macro(CheckNAS)
FindLibraryAndSONAME("audio") FindLibraryAndSONAME("audio")
set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_NAS_DYNAMIC "\"${AUDIO_LIB_SONAME}\"")
set(HAVE_NAS_SHARED TRUE) set(HAVE_NAS_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(NAS_SHARED) else()
list(APPEND EXTRA_LIBS ${D_NAS_LIB}) list(APPEND EXTRA_LIBS ${D_NAS_LIB})
endif(NAS_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(HAVE_NAS_H AND D_NAS_LIB) endif()
endif(NAS) endif()
endmacro(CheckNAS) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -274,14 +274,14 @@ macro(CheckSNDIO)
FindLibraryAndSONAME("sndio") FindLibraryAndSONAME("sndio")
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
set(HAVE_SNDIO_SHARED TRUE) set(HAVE_SNDIO_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(SNDIO_SHARED) else()
list(APPEND EXTRA_LIBS ${D_SNDIO_LIB}) list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
endif(SNDIO_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(HAVE_SNDIO_H AND D_SNDIO_LIB) endif()
endif(SNDIO) endif()
endmacro(CheckSNDIO) endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
@ -304,14 +304,14 @@ macro(CheckFusionSound)
FindLibraryAndSONAME("fusionsound") FindLibraryAndSONAME("fusionsound")
set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "\"${FUSIONSOUND_LIB_SONAME}\"")
set(HAVE_FUSIONSOUND_SHARED TRUE) set(HAVE_FUSIONSOUND_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(FUSIONSOUND_SHARED) else()
list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${PKG_FUSIONSOUND_LDFLAGS})
endif(FUSIONSOUND_SHARED) endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif(PKG_FUSIONSOUND_FOUND) endif()
endif(FUSIONSOUND) endif()
endmacro(CheckFusionSound) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -353,34 +353,34 @@ macro(CheckX11)
if(APPLE) if(APPLE)
set(X11_SHARED OFF) set(X11_SHARED OFF)
endif(APPLE) endif()
check_function_exists("shmat" HAVE_SHMAT) check_function_exists("shmat" HAVE_SHMAT)
if(NOT HAVE_SHMAT) if(NOT HAVE_SHMAT)
check_library_exists(ipc shmat "" HAVE_SHMAT) check_library_exists(ipc shmat "" HAVE_SHMAT)
if(HAVE_SHMAT) if(HAVE_SHMAT)
list(APPEND EXTRA_LIBS ipc) list(APPEND EXTRA_LIBS ipc)
endif(HAVE_SHMAT) endif()
if(NOT HAVE_SHMAT) if(NOT HAVE_SHMAT)
add_definitions(-DNO_SHARED_MEMORY) add_definitions(-DNO_SHARED_MEMORY)
set(X_CFLAGS "${X_CFLAGS} -DNO_SHARED_MEMORY") set(X_CFLAGS "${X_CFLAGS} -DNO_SHARED_MEMORY")
endif(NOT HAVE_SHMAT) endif()
endif(NOT HAVE_SHMAT) endif()
if(X11_SHARED) if(X11_SHARED)
if(NOT HAVE_DLOPEN) if(NOT HAVE_DLOPEN)
message_warn("You must have SDL_LoadObject() support for dynamic X11 loading") message_warn("You must have SDL_LoadObject() support for dynamic X11 loading")
set(HAVE_X11_SHARED FALSE) set(HAVE_X11_SHARED FALSE)
else(NOT HAVE_DLOPEN) else()
set(HAVE_X11_SHARED TRUE) set(HAVE_X11_SHARED TRUE)
endif() endif()
if(HAVE_X11_SHARED) if(HAVE_X11_SHARED)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC "\"${X11_LIB_SONAME}\"")
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "\"${XEXT_LIB_SONAME}\"")
else(HAVE_X11_SHARED) else()
list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB}) list(APPEND EXTRA_LIBS ${X11_LIB} ${XEXT_LIB})
endif(HAVE_X11_SHARED) endif()
endif(X11_SHARED) endif()
set(SDL_CFLAGS "${SDL_CFLAGS} ${X_CFLAGS}") set(SDL_CFLAGS "${SDL_CFLAGS} ${X_CFLAGS}")
@ -394,7 +394,7 @@ macro(CheckX11)
int main(int argc, char **argv) {}" HAVE_CONST_XEXT_ADDDISPLAY) int main(int argc, char **argv) {}" HAVE_CONST_XEXT_ADDDISPLAY)
if(HAVE_CONST_XEXT_ADDDISPLAY) if(HAVE_CONST_XEXT_ADDDISPLAY)
set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1) set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1)
endif(HAVE_CONST_XEXT_ADDDISPLAY) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -407,7 +407,7 @@ macro(CheckX11)
XFreeEventData(display, cookie); }" HAVE_XGENERICEVENT) XFreeEventData(display, cookie); }" HAVE_XGENERICEVENT)
if(HAVE_XGENERICEVENT) if(HAVE_XGENERICEVENT)
set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1) set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
endif(HAVE_XGENERICEVENT) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <X11/Xlibint.h> #include <X11/Xlibint.h>
@ -415,7 +415,7 @@ macro(CheckX11)
int main(int argc, char **argv) {}" HAVE_CONST_XDATA32) int main(int argc, char **argv) {}" HAVE_CONST_XDATA32)
if(HAVE_CONST_XDATA32) if(HAVE_CONST_XDATA32)
set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1) set(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 1)
endif(HAVE_CONST_XDATA32) endif()
check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM) check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
@ -423,29 +423,29 @@ macro(CheckX11)
set(HAVE_VIDEO_X11_XCURSOR TRUE) set(HAVE_VIDEO_X11_XCURSOR TRUE)
if(HAVE_X11_SHARED AND XCURSOR_LIB) if(HAVE_X11_SHARED AND XCURSOR_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "\"${XCURSOR_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "\"${XCURSOR_LIB_SONAME}\"")
else(HAVE_X11_SHARED AND XCURSOR_LIB) else()
list(APPEND EXTRA_LIBS ${XCURSOR_LIB}) list(APPEND EXTRA_LIBS ${XCURSOR_LIB})
endif(HAVE_X11_SHARED AND XCURSOR_LIB) endif()
set(SDL_VIDEO_DRIVER_X11_XCURSOR 1) set(SDL_VIDEO_DRIVER_X11_XCURSOR 1)
endif(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H) endif()
if(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H) if(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H)
set(HAVE_VIDEO_X11_XINERAMA TRUE) set(HAVE_VIDEO_X11_XINERAMA TRUE)
if(HAVE_X11_SHARED AND XINERAMA_LIB) if(HAVE_X11_SHARED AND XINERAMA_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "\"${XINERAMA_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "\"${XINERAMA_LIB_SONAME}\"")
else(HAVE_X11_SHARED AND XINERAMA_LIB) else()
list(APPEND EXTRA_LIBS ${XINERAMA_LIB}) list(APPEND EXTRA_LIBS ${XINERAMA_LIB})
endif(HAVE_X11_SHARED AND XINERAMA_LIB) endif()
set(SDL_VIDEO_DRIVER_X11_XINERAMA 1) set(SDL_VIDEO_DRIVER_X11_XINERAMA 1)
endif(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H) endif()
if(VIDEO_X11_XINPUT AND HAVE_XINPUT_H) if(VIDEO_X11_XINPUT AND HAVE_XINPUT_H)
set(HAVE_VIDEO_X11_XINPUT TRUE) set(HAVE_VIDEO_X11_XINPUT TRUE)
if(HAVE_X11_SHARED AND XI_LIB) if(HAVE_X11_SHARED AND XI_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "\"${XI_LIB_SONAME}\"")
else(HAVE_X11_SHARED AND XI_LIB) else()
list(APPEND EXTRA_LIBS ${XI_LIB}) list(APPEND EXTRA_LIBS ${XI_LIB})
endif(HAVE_X11_SHARED AND XI_LIB) endif()
set(SDL_VIDEO_DRIVER_X11_XINPUT2 1) set(SDL_VIDEO_DRIVER_X11_XINPUT2 1)
# Check for multitouch # Check for multitouch
@ -462,48 +462,48 @@ macro(CheckX11)
int main(int argc, char **argv) {}" HAVE_XINPUT2_MULTITOUCH) int main(int argc, char **argv) {}" HAVE_XINPUT2_MULTITOUCH)
if(HAVE_XINPUT2_MULTITOUCH) if(HAVE_XINPUT2_MULTITOUCH)
set(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1) set(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH 1)
endif(HAVE_XINPUT2_MULTITOUCH) endif()
endif(VIDEO_X11_XINPUT AND HAVE_XINPUT_H) endif()
if(VIDEO_X11_XRANDR AND HAVE_XRANDR_H) if(VIDEO_X11_XRANDR AND HAVE_XRANDR_H)
if(HAVE_X11_SHARED AND XRANDR_LIB) if(HAVE_X11_SHARED AND XRANDR_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "\"${XRANDR_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "\"${XRANDR_LIB_SONAME}\"")
else(HAVE_X11_SHARED AND XRANDR_LIB) else()
list(APPEND EXTRA_LIBS ${XRANDR_LIB}) list(APPEND EXTRA_LIBS ${XRANDR_LIB})
endif(HAVE_X11_SHARED AND XRANDR_LIB) endif()
set(SDL_VIDEO_DRIVER_X11_XRANDR 1) set(SDL_VIDEO_DRIVER_X11_XRANDR 1)
set(HAVE_VIDEO_X11_XRANDR TRUE) set(HAVE_VIDEO_X11_XRANDR TRUE)
endif(VIDEO_X11_XRANDR AND HAVE_XRANDR_H) endif()
if(VIDEO_X11_XSCRNSAVER AND HAVE_XSS_H) if(VIDEO_X11_XSCRNSAVER AND HAVE_XSS_H)
if(HAVE_X11_SHARED AND XSS_LIB) if(HAVE_X11_SHARED AND XSS_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "\"${XSS_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "\"${XSS_LIB_SONAME}\"")
else(HAVE_X11_SHARED AND XSS_LIB) else()
list(APPEND EXTRA_LIBS ${XSS_LIB}) list(APPEND EXTRA_LIBS ${XSS_LIB})
endif(HAVE_X11_SHARED AND XSS_LIB) endif()
set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1) set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1)
set(HAVE_VIDEO_X11_XSCRNSAVER TRUE) set(HAVE_VIDEO_X11_XSCRNSAVER TRUE)
endif(VIDEO_X11_XSCRNSAVER AND HAVE_XSS_H) endif()
if(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H) if(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H)
set(SDL_VIDEO_DRIVER_X11_XSHAPE 1) set(SDL_VIDEO_DRIVER_X11_XSHAPE 1)
set(HAVE_VIDEO_X11_XSHAPE TRUE) set(HAVE_VIDEO_X11_XSHAPE TRUE)
endif(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H) endif()
if(VIDEO_X11_XVM AND HAVE_XF86VM_H) if(VIDEO_X11_XVM AND HAVE_XF86VM_H)
if(HAVE_X11_SHARED AND XXF86VM_LIB) if(HAVE_X11_SHARED AND XXF86VM_LIB)
set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XXF86VM_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "\"${XXF86VM_LIB_SONAME}\"")
else(HAVE_X11_SHARED AND XXF86VM_LIB) else()
list(APPEND EXTRA_LIBS ${XXF86VM_LIB}) list(APPEND EXTRA_LIBS ${XXF86VM_LIB})
endif(HAVE_X11_SHARED AND XXF86VM_LIB) endif()
set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1) set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1)
set(HAVE_VIDEO_X11_XVM TRUE) set(HAVE_VIDEO_X11_XVM TRUE)
endif(VIDEO_X11_XVM AND HAVE_XF86VM_H) endif()
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
endif(X11_LIB) endif()
endif(VIDEO_X11) endif()
endmacro(CheckX11) endmacro()
macro(CheckMir) macro(CheckMir)
# !!! FIXME: hook up dynamic loading here. # !!! FIXME: hook up dynamic loading here.
@ -524,8 +524,8 @@ macro(CheckMir)
list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS}) list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS})
list(APPEND EXTRA_LDFLAGS ${MIR_TOOLKIT_LDFLAGS} ${EGL_LDLAGS} ${XKB_LDLAGS}) list(APPEND EXTRA_LDFLAGS ${MIR_TOOLKIT_LDFLAGS} ${EGL_LDLAGS} ${XKB_LDLAGS})
endif (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND) endif (MIR_LIB AND MIR_TOOLKIT_FOUND AND EGL_FOUND AND XKB_FOUND)
endif(VIDEO_MIR) endif()
endmacro(CheckMir) endmacro()
# Requires: # Requires:
# - EGL # - EGL
@ -547,9 +547,9 @@ macro(CheckWayland)
file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${WAYLAND_SOURCES})
set(SDL_VIDEO_DRIVER_WAYLAND 1) set(SDL_VIDEO_DRIVER_WAYLAND 1)
endif(WAYLAND_FOUND) endif()
endif(VIDEO_WAYLAND) endif()
endmacro(CheckWayland) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -558,16 +558,16 @@ macro(CheckCOCOA)
if(VIDEO_COCOA) if(VIDEO_COCOA)
if(APPLE) # Apple always has Cocoa. if(APPLE) # Apple always has Cocoa.
set(HAVE_VIDEO_COCOA TRUE) set(HAVE_VIDEO_COCOA TRUE)
endif(APPLE) endif()
if(HAVE_VIDEO_COCOA) if(HAVE_VIDEO_COCOA)
file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m) file(GLOB COCOA_SOURCES ${SDL2_SOURCE_DIR}/src/video/cocoa/*.m)
set_source_files_properties(${COCOA_SOURCES} PROPERTIES LANGUAGE C) set_source_files_properties(${COCOA_SOURCES} PROPERTIES LANGUAGE C)
set(SOURCE_FILES ${SOURCE_FILES} ${COCOA_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${COCOA_SOURCES})
set(SDL_VIDEO_DRIVER_COCOA 1) set(SDL_VIDEO_DRIVER_COCOA 1)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
endif(HAVE_VIDEO_COCOA) endif()
endif(VIDEO_COCOA) endif()
endmacro(CheckCOCOA) endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
@ -591,14 +591,14 @@ macro(CheckDirectFB)
FindLibraryAndSONAME("directfb") FindLibraryAndSONAME("directfb")
set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC "\"${DIRECTFB_LIB_SONAME}\"")
set(HAVE_DIRECTFB_SHARED TRUE) set(HAVE_DIRECTFB_SHARED TRUE)
endif(NOT HAVE_DLOPEN) endif()
else(DIRECTFB_SHARED) else()
list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${PKG_DIRECTFB_LDFLAGS})
endif(DIRECTFB_SHARED) endif()
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
endif(PKG_DIRECTFB_FOUND) endif()
endif(VIDEO_DIRECTFB) endif()
endmacro(CheckDirectFB) endmacro()
# Requires: # Requires:
# - n/a # - n/a
@ -645,9 +645,9 @@ macro(CheckOpenGLX11)
set(SDL_VIDEO_OPENGL_GLX 1) set(SDL_VIDEO_OPENGL_GLX 1)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
list(APPEND EXTRA_LIBS GL) list(APPEND EXTRA_LIBS GL)
endif(HAVE_VIDEO_OPENGL) endif()
endif(VIDEO_OPENGL) endif()
endmacro(CheckOpenGLX11) endmacro()
# Requires: # Requires:
# - nada # - nada
@ -659,7 +659,7 @@ macro(CheckOpenGLESX11)
int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL) int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL)
if(HAVE_VIDEO_OPENGL_EGL) if(HAVE_VIDEO_OPENGL_EGL)
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
endif(HAVE_VIDEO_OPENGL_EGL) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
@ -668,7 +668,7 @@ macro(CheckOpenGLESX11)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_VIDEO_OPENGLES TRUE)
set(SDL_VIDEO_OPENGL_ES 1) set(SDL_VIDEO_OPENGL_ES 1)
set(SDL_VIDEO_RENDER_OGL_ES 1) set(SDL_VIDEO_RENDER_OGL_ES 1)
endif(HAVE_VIDEO_OPENGLES_V1) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <GLES2/gl2.h> #include <GLES2/gl2.h>
#include <GLES2/gl2ext.h> #include <GLES2/gl2ext.h>
@ -677,10 +677,10 @@ macro(CheckOpenGLESX11)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_VIDEO_OPENGLES TRUE)
set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_OPENGL_ES2 1)
set(SDL_VIDEO_RENDER_OGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1)
endif(HAVE_VIDEO_OPENGLES_V2) endif()
endif(VIDEO_OPENGLES) endif()
endmacro(CheckOpenGLESX11) endmacro()
# Rquires: # Rquires:
# - nada # - nada
@ -729,7 +729,7 @@ macro(CheckPTHREAD)
else() else()
set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_CFLAGS "-D_REENTRANT")
set(PTHREAD_LDFLAGS "-lpthread") set(PTHREAD_LDFLAGS "-lpthread")
endif(LINUX) endif()
# Run some tests # Run some tests
set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}") set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}")
@ -756,7 +756,7 @@ macro(CheckPTHREAD)
}" HAVE_RECURSIVE_MUTEXES) }" HAVE_RECURSIVE_MUTEXES)
if(HAVE_RECURSIVE_MUTEXES) if(HAVE_RECURSIVE_MUTEXES)
set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1) set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1)
else(HAVE_RECURSIVE_MUTEXES) else()
check_c_source_compiles(" check_c_source_compiles("
#include <pthread.h> #include <pthread.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
@ -766,8 +766,8 @@ macro(CheckPTHREAD)
}" HAVE_RECURSIVE_MUTEXES_NP) }" HAVE_RECURSIVE_MUTEXES_NP)
if(HAVE_RECURSIVE_MUTEXES_NP) if(HAVE_RECURSIVE_MUTEXES_NP)
set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1) set(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1)
endif(HAVE_RECURSIVE_MUTEXES_NP) endif()
endif(HAVE_RECURSIVE_MUTEXES) endif()
if(PTHREADS_SEM) if(PTHREADS_SEM)
check_c_source_compiles("#include <pthread.h> check_c_source_compiles("#include <pthread.h>
@ -781,8 +781,8 @@ macro(CheckPTHREAD)
sem_timedwait(NULL, NULL); sem_timedwait(NULL, NULL);
return 0; return 0;
}" HAVE_SEM_TIMEDWAIT) }" HAVE_SEM_TIMEDWAIT)
endif(HAVE_PTHREADS_SEM) endif()
endif(PTHREADS_SEM) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <pthread.h> #include <pthread.h>
@ -801,14 +801,14 @@ macro(CheckPTHREAD)
if(HAVE_PTHREADS_SEM) if(HAVE_PTHREADS_SEM)
set(SOURCE_FILES ${SOURCE_FILES} set(SOURCE_FILES ${SOURCE_FILES}
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_syssem.c) ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_syssem.c)
else(HAVE_PTHREADS_SEM) else()
set(SOURCE_FILES ${SOURCE_FILES} set(SOURCE_FILES ${SOURCE_FILES}
${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syssem.c) ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syssem.c)
endif(HAVE_PTHREADS_SEM) endif()
set(HAVE_SDL_THREADS TRUE) set(HAVE_SDL_THREADS TRUE)
endif(HAVE_PTHREADS) endif()
endif(PTHREADS) endif()
endmacro(CheckPTHREAD) endmacro()
# Requires # Requires
# - nada # - nada
@ -822,27 +822,27 @@ macro(CheckUSBHID)
check_include_file(usbhid.h HAVE_USBHID_H) check_include_file(usbhid.h HAVE_USBHID_H)
if(HAVE_USBHID_H) if(HAVE_USBHID_H)
set(USB_CFLAGS "-DHAVE_USBHID_H") set(USB_CFLAGS "-DHAVE_USBHID_H")
endif(HAVE_USBHID_H) endif()
check_include_file(libusbhid.h HAVE_LIBUSBHID_H) check_include_file(libusbhid.h HAVE_LIBUSBHID_H)
if(HAVE_LIBUSBHID_H) if(HAVE_LIBUSBHID_H)
set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSBHID_H") set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSBHID_H")
endif(HAVE_LIBUSBHID_H) endif()
set(USB_LIBS ${USB_LIBS} usbhid) set(USB_LIBS ${USB_LIBS} usbhid)
else(LIBUSBHID) else()
check_include_file(usb.h HAVE_USB_H) check_include_file(usb.h HAVE_USB_H)
if(HAVE_USB_H) if(HAVE_USB_H)
set(USB_CFLAGS "-DHAVE_USB_H") set(USB_CFLAGS "-DHAVE_USB_H")
endif(HAVE_USB_H) endif()
check_include_file(libusb.h HAVE_LIBUSB_H) check_include_file(libusb.h HAVE_LIBUSB_H)
if(HAVE_LIBUSB_H) if(HAVE_LIBUSB_H)
set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSB_H") set(USB_CFLAGS "${USB_CFLAGS} -DHAVE_LIBUSB_H")
endif(HAVE_LIBUSB_H) endif()
check_library_exists(usb hid_init "" LIBUSB) check_library_exists(usb hid_init "" LIBUSB)
if(LIBUSB) if(LIBUSB)
set(USB_LIBS ${USB_LIBS} usb) set(USB_LIBS ${USB_LIBS} usb)
endif(LIBUSB) endif()
endif(LIBUSBHID) endif()
set(CMAKE_REQUIRED_FLAGS "${USB_CFLAGS}") set(CMAKE_REQUIRED_FLAGS "${USB_CFLAGS}")
set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}") set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}")
@ -898,7 +898,7 @@ macro(CheckUSBHID)
}" HAVE_USBHID_UCR_DATA) }" HAVE_USBHID_UCR_DATA)
if(HAVE_USBHID_UCR_DATA) if(HAVE_USBHID_UCR_DATA)
set(USB_CFLAGS "${USB_CFLAGS} -DUSBHID_UCR_DATA") set(USB_CFLAGS "${USB_CFLAGS} -DUSBHID_UCR_DATA")
endif(HAVE_USBHID_UCR_DATA) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <sys/types.h> #include <sys/types.h>
@ -926,7 +926,7 @@ macro(CheckUSBHID)
}" HAVE_USBHID_NEW) }" HAVE_USBHID_NEW)
if(HAVE_USBHID_NEW) if(HAVE_USBHID_NEW)
set(USB_CFLAGS "${USB_CFLAGS} -DUSBHID_NEW") set(USB_CFLAGS "${USB_CFLAGS} -DUSBHID_NEW")
endif(HAVE_USBHID_NEW) endif()
check_c_source_compiles(" check_c_source_compiles("
#include <machine/joystick.h> #include <machine/joystick.h>
@ -936,7 +936,7 @@ macro(CheckUSBHID)
}" HAVE_MACHINE_JOYSTICK) }" HAVE_MACHINE_JOYSTICK)
if(HAVE_MACHINE_JOYSTICK) if(HAVE_MACHINE_JOYSTICK)
set(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H 1) set(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H 1)
endif(HAVE_MACHINE_JOYSTICK) endif()
set(SDL_JOYSTICK_USBHID 1) set(SDL_JOYSTICK_USBHID 1)
file(GLOB BSD_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/bsd/*.c) file(GLOB BSD_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/bsd/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${BSD_JOYSTICK_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${BSD_JOYSTICK_SOURCES})
@ -946,8 +946,8 @@ macro(CheckUSBHID)
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
set(CMAKE_REQUIRED_FLAGS) set(CMAKE_REQUIRED_FLAGS)
endif(HAVE_USBHID) endif()
endmacro(CheckUSBHID) endmacro()
# Requires: # Requires:
# - n/a # - n/a