cmake: Prefix all options with "SDL_"

This makes it clear which options came from SDL's CMake project when
building SDL as a subdirectory of a parent CMake project.

Fixes #4139.
This commit is contained in:
Ryan C. Gordon 2021-10-05 10:43:35 -04:00
parent 172957387e
commit 7850d0cf6f
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
5 changed files with 286 additions and 278 deletions

View File

@ -212,8 +212,8 @@ if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA)
endif() endif()
if(MSVC) if(MSVC)
option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF) option(SDL_FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
if(FORCE_STATIC_VCRT) if(SDL_FORCE_STATIC_VCRT)
foreach(flag_var foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO) CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
@ -324,82 +324,82 @@ foreach(_SUB ${SDL_SUBSYSTEMS})
option(SDL_${_OPT} "Enable the ${_SUB} subsystem" ${SDL_${_OPT}_ENABLED_BY_DEFAULT}) option(SDL_${_OPT} "Enable the ${_SUB} subsystem" ${SDL_${_OPT}_ENABLED_BY_DEFAULT})
endforeach() endforeach()
option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
#set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) #set_option(SDL_DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
set_option(LIBC "Use the system C library" ${OPT_DEF_LIBC}) set_option(SDL_LIBC "Use the system C library" ${OPT_DEF_LIBC})
set_option(GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS}) set_option(SDL_GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS})
set_option(ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM}) set_option(SDL_ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM})
set_option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) set_option(SDL_SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH})
set_option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) set_option(SDL_MMX "Use MMX assembly routines" ${OPT_DEF_ASM})
set_option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) set_option(SDL_3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM})
set_option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) set_option(SDL_SSE "Use SSE assembly routines" ${OPT_DEF_ASM})
set_option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) set_option(SDL_SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
set_option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH}) set_option(SDL_SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH})
set_option(ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM}) set_option(SDL_ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM})
set_option(ARMSIMD "use SIMD assembly blitters on ARM" OFF) set_option(SDL_ARMSIMD "use SIMD assembly blitters on ARM" OFF)
set_option(ARMNEON "use NEON assembly blitters on ARM" OFF) set_option(SDL_ARMNEON "use NEON assembly blitters on ARM" OFF)
set_option(DISKAUDIO "Support the disk writer audio driver" ON) set_option(SDL_DISKAUDIO "Support the disk writer audio driver" ON)
set_option(DUMMYAUDIO "Support the dummy audio driver" ON) set_option(SDL_DUMMYAUDIO "Support the dummy audio driver" ON)
set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF) set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF)
dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF) dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF)
set_option(VIDEO_DUMMY "Use dummy video driver" ON) set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON)
set_option(VIDEO_OPENGL "Include OpenGL support" ON) set_option(SDL_OPENGL "Include OpenGL support" ON)
set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON) set_option(SDL_OPENGLES "Include OpenGL ES support" ON)
set_option(PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
dep_option(PTHREADS_SEM "Use pthread semaphores" ON "PTHREADS" OFF) dep_option(SDL_PTHREADS_SEM "Use pthread semaphores" ON "SDL_PTHREADS" OFF)
dep_option(OSS "Support the OSS audio API" ON "UNIX_SYS OR RISCOS" OFF) dep_option(SDL_OSS "Support the OSS audio API" ON "UNIX_SYS OR RISCOS" OFF)
set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS}) set_option(SDL_ALSA "Support the ALSA audio API" ${UNIX_SYS})
dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF) dep_option(SDL_ALSA_SHARED "Dynamically load ALSA audio support" ON "SDL_ALSA" OFF)
set_option(JACK "Support the JACK audio API" ${UNIX_SYS}) set_option(SDL_JACK "Support the JACK audio API" ${UNIX_SYS})
dep_option(JACK_SHARED "Dynamically load JACK audio support" ON "JACK" OFF) dep_option(SDL_JACK_SHARED "Dynamically load JACK audio support" ON "SDL_JACK" OFF)
set_option(ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) set_option(SDL_ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS})
dep_option(ESD_SHARED "Dynamically load ESD audio support" ON "ESD" OFF) dep_option(SDL_ESD_SHARED "Dynamically load ESD audio support" ON "SDL_ESD" OFF)
set_option(PIPEWIRE "Use Pipewire audio" ${UNIX_SYS}) set_option(SDL_PIPEWIRE "Use Pipewire audio" ${UNIX_SYS})
dep_option(PIPEWIRE_SHARED "Dynamically load Pipewire support" ON "PIPEWIRE" OFF) dep_option(SDL_PIPEWIRE_SHARED "Dynamically load Pipewire support" ON "SDL_PIPEWIRE" OFF)
set_option(PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) set_option(SDL_PULSEAUDIO "Use PulseAudio" ${UNIX_SYS})
dep_option(PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "PULSEAUDIO" OFF) dep_option(SDL_PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "SDL_PULSEAUDIO" OFF)
set_option(ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS}) set_option(SDL_ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS})
dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" OFF) dep_option(SDL_ARTS_SHARED "Dynamically load aRts audio support" ON "SDL_ARTS" OFF)
set_option(NAS "Support the NAS audio API" ${UNIX_SYS}) set_option(SDL_NAS "Support the NAS audio API" ${UNIX_SYS})
set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS}) dep_option(SDL_NAS_SHARED "Dynamically load NAS audio support" ON "SDL_NAS" OFF)
set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS}) set_option(SDL_SNDIO "Support the sndio audio API" ${UNIX_SYS})
dep_option(SNDIO_SHARED "Dynamically load the sndio audio API" ${UNIX_SYS} ON "SNDIO" OFF) dep_option(SDL_SNDIO_SHARED "Dynamically load the sndio audio API" ${UNIX_SYS} ON "SDL_SNDIO" OFF)
set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) set_option(SDL_FUSIONSOUND "Use FusionSound audio driver" OFF)
dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) dep_option(SDL_FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "SDL_FUSIONSOUND" OFF)
set_option(LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) set_option(SDL_LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS})
dep_option(LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "LIBSAMPLERATE" OFF) dep_option(SDL_LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "SDL_LIBSAMPLERATE" OFF)
set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) set_option(SDL_RPATH "Use an rpath when linking SDL" ${UNIX_SYS})
set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF) set_option(SDL_CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF)
set_option(VIDEO_X11 "Use X11 video driver" ${UNIX_SYS}) set_option(SDL_X11 "Use X11 video driver" ${UNIX_SYS})
set_option(VIDEO_WAYLAND "Use Wayland video driver" ${UNIX_SYS}) dep_option(SDL_X11_SHARED "Dynamically load X11 support" ON "SDL_X11" OFF)
dep_option(WAYLAND_SHARED "Dynamically load Wayland support" ON "VIDEO_WAYLAND" OFF)
dep_option(WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "VIDEO_WAYLAND" ON)
dep_option(LIBDECOR_SHARED "Dynamically load libdecor support" ON "WAYLAND_LIBDECOR" OFF)
dep_option(VIDEO_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "VIDEO_WAYLAND" OFF)
set_option(VIDEO_RPI "Use Raspberry Pi video driver" ${UNIX_SYS})
dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF)
set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm) set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm)
foreach(_SUB ${SDL_X11_OPTIONS}) foreach(_SUB ${SDL_X11_OPTIONS})
string(TOUPPER "VIDEO_X11_${_SUB}" _OPT) string(TOUPPER "SDL_X11_${_SUB}" _OPT)
dep_option(${_OPT} "Enable ${_SUB} support" ON "VIDEO_X11" OFF) dep_option(${_OPT} "Enable ${_SUB} support" ON "SDL_X11" OFF)
endforeach() endforeach()
set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE}) set_option(SDL_WAYLAND "Use Wayland video driver" ${UNIX_SYS})
set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) dep_option(SDL_WAYLAND_SHARED "Dynamically load Wayland support" ON "SDL_WAYLAND" OFF)
set_option(XINPUT "Use Xinput for Windows" ${WINDOWS}) dep_option(SDL_WAYLAND_LIBDECOR "Use client-side window decorations on Wayland" ON "SDL_WAYLAND" ON)
set_option(WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS}) dep_option(SDL_WAYLAND_LIBDECOR_SHARED "Dynamically load libdecor support" ON "SDL_WAYLAND_LIBDECOR" OFF)
set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS}) dep_option(SDL_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "SDL_WAYLAND" OFF)
set_option(RENDER_METAL "Enable the Metal render driver" ${APPLE}) set_option(SDL_RPI "Use Raspberry Pi video driver" ${UNIX_SYS})
set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) set_option(SDL_COCOA "Use Cocoa video driver" ${APPLE})
dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF) set_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS})
set_option(VIDEO_METAL "Enable Metal support" ${APPLE}) set_option(SDL_XINPUT "Use Xinput for Windows" ${WINDOWS})
set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS}) set_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ${WINDOWS})
dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF) set_option(SDL_RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS})
set_option(VIDEO_OFFSCREEN "Use offscreen video driver" OFF) set_option(SDL_RENDER_METAL "Enable the Metal render driver" ${APPLE})
option_string(BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" "OFF") set_option(SDL_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS})
option_string(FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF") dep_option(SDL_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
set_option(HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI}) set_option(SDL_METAL "Enable Metal support" ${APPLE})
set_option(JOYSTICK_VIRTUAL "Enable the virtual-joystick driver" ON) set_option(SDL_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS})
set_option(ASAN "Use AddressSanitizer to detect memory errors" OFF) dep_option(SDL_KMSDRM_SHARED "Dynamically load KMS DRM support" ON "SDL_KMSDRM" OFF)
set_option(SDL_OFFSCREEN "Use offscreen video driver" OFF)
option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" "OFF")
option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" "OFF")
set_option(SDL_HIDAPI "Use HIDAPI for low level joystick drivers" ${OPT_DEF_HIDAPI})
set_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON)
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library") set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared version of the library")
set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library") set(SDL_STATIC ${SDL_STATIC_ENABLED_BY_DEFAULT} CACHE BOOL "Build a static version of the library")
@ -436,27 +436,27 @@ file(GLOB SOURCE_FILES
${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
if(ASSERTIONS STREQUAL "auto") if(SDL_ASSERTIONS STREQUAL "auto")
# Do nada - use optimization settings to determine the assertion level # Do nada - use optimization settings to determine the assertion level
elseif(ASSERTIONS STREQUAL "disabled") elseif(SDL_ASSERTIONS STREQUAL "disabled")
set(SDL_DEFAULT_ASSERT_LEVEL 0) set(SDL_DEFAULT_ASSERT_LEVEL 0)
elseif(ASSERTIONS STREQUAL "release") elseif(SDL_ASSERTIONS STREQUAL "release")
set(SDL_DEFAULT_ASSERT_LEVEL 1) set(SDL_DEFAULT_ASSERT_LEVEL 1)
elseif(ASSERTIONS STREQUAL "enabled") elseif(SDL_ASSERTIONS STREQUAL "enabled")
set(SDL_DEFAULT_ASSERT_LEVEL 2) set(SDL_DEFAULT_ASSERT_LEVEL 2)
elseif(ASSERTIONS STREQUAL "paranoid") elseif(SDL_ASSERTIONS STREQUAL "paranoid")
set(SDL_DEFAULT_ASSERT_LEVEL 3) set(SDL_DEFAULT_ASSERT_LEVEL 3)
else() else()
message_error("unknown assertion level") message_error("unknown assertion level")
endif() endif()
set(HAVE_ASSERTIONS ${ASSERTIONS}) set(HAVE_ASSERTIONS ${SDL_ASSERTIONS})
if(NOT BACKGROUNDING_SIGNAL STREQUAL "OFF") if(NOT SDL_BACKGROUNDING_SIGNAL STREQUAL "OFF")
add_definitions("-DSDL_BACKGROUNDING_SIGNAL=${BACKGROUNDING_SIGNAL}") add_definitions("-DSDL_BACKGROUNDING_SIGNAL=${SDL_BACKGROUNDING_SIGNAL}")
endif() endif()
if(NOT FOREGROUNDING_SIGNAL STREQUAL "OFF") if(NOT SDL_FOREGROUNDING_SIGNAL STREQUAL "OFF")
add_definitions("-DSDL_FOREGROUNDING_SIGNAL=${FOREGROUNDING_SIGNAL}") add_definitions("-DSDL_FOREGROUNDING_SIGNAL=${SDL_FOREGROUNDING_SIGNAL}")
endif() endif()
# Compiler option evaluation # Compiler option evaluation
@ -492,7 +492,7 @@ if(USE_GCC OR USE_CLANG)
int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING) int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING)
endif() endif()
if(GCC_ATOMICS) if(SDL_GCC_ATOMICS)
check_c_source_compiles("int main(int argc, char **argv) { check_c_source_compiles("int main(int argc, char **argv) {
int a; int a;
void *x, *y, *z; void *x, *y, *z;
@ -553,7 +553,7 @@ if(USE_GCC OR USE_CLANG)
endif() endif()
endif() endif()
if(ASSEMBLY) if(SDL_ASSEMBLY)
if(USE_GCC OR USE_CLANG) if(USE_GCC OR USE_CLANG)
set(SDL_ASSEMBLY_ROUTINES 1) set(SDL_ASSEMBLY_ROUTINES 1)
# TODO: Those all seem to be quite GCC specific - needs to be # TODO: Those all seem to be quite GCC specific - needs to be
@ -582,7 +582,7 @@ if(ASSEMBLY)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
if(3DNOW) if(SDL_3DNOW)
set(CMAKE_REQUIRED_FLAGS "-m3dnow") set(CMAKE_REQUIRED_FLAGS "-m3dnow")
check_c_source_compiles(" check_c_source_compiles("
#include <mm3dnow.h> #include <mm3dnow.h>
@ -599,7 +599,7 @@ if(ASSEMBLY)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
if(SSE) if(SDL_SSE)
set(CMAKE_REQUIRED_FLAGS "-msse") set(CMAKE_REQUIRED_FLAGS "-msse")
check_c_source_compiles(" check_c_source_compiles("
#ifdef __MINGW32__ #ifdef __MINGW32__
@ -622,7 +622,7 @@ if(ASSEMBLY)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
if(SSE2) if(SDL_SSE2)
set(CMAKE_REQUIRED_FLAGS "-msse2") set(CMAKE_REQUIRED_FLAGS "-msse2")
check_c_source_compiles(" check_c_source_compiles("
#ifdef __MINGW32__ #ifdef __MINGW32__
@ -645,7 +645,7 @@ if(ASSEMBLY)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
if(SSE3) if(SDL_SSE3)
set(CMAKE_REQUIRED_FLAGS "-msse3") set(CMAKE_REQUIRED_FLAGS "-msse3")
check_c_source_compiles(" check_c_source_compiles("
#ifdef __MINGW32__ #ifdef __MINGW32__
@ -668,8 +668,8 @@ if(ASSEMBLY)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
if(NOT SSEMATH) if(NOT SDL_SSEMATH)
if(SSE OR SSE2 OR SSE3) if(SDL_SSE OR SDL_SSE2 OR SDL_SSE3)
if(USE_GCC) if(USE_GCC)
check_c_compiler_flag(-mfpmath=387 HAVE_FP_387) check_c_compiler_flag(-mfpmath=387 HAVE_FP_387)
if(HAVE_FP_387) if(HAVE_FP_387)
@ -682,7 +682,7 @@ if(ASSEMBLY)
check_include_file("immintrin.h" HAVE_IMMINTRIN_H) check_include_file("immintrin.h" HAVE_IMMINTRIN_H)
if(ALTIVEC) if(SDL_ALTIVEC)
set(CMAKE_REQUIRED_FLAGS "-maltivec") set(CMAKE_REQUIRED_FLAGS "-maltivec")
check_c_source_compiles(" check_c_source_compiles("
#include <altivec.h> #include <altivec.h>
@ -706,7 +706,7 @@ if(ASSEMBLY)
endif() endif()
endif() endif()
if(ARMSIMD) if(SDL_ARMSIMD)
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
check_c_source_compiles(" check_c_source_compiles("
@ -732,7 +732,7 @@ if(ASSEMBLY)
endif() endif()
endif() endif()
if(ARMNEON) if(SDL_ARMNEON)
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
check_c_source_compiles(" check_c_source_compiles("
@ -777,7 +777,7 @@ endif()
# TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define # TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define
# anything. # anything.
if(LIBC) if(SDL_LIBC)
if(WINDOWS AND NOT MINGW) if(WINDOWS AND NOT MINGW)
set(HAVE_LIBC TRUE) set(HAVE_LIBC TRUE)
foreach(_HEADER stdio.h string.h wchar.h ctype.h math.h limits.h) foreach(_HEADER stdio.h string.h wchar.h ctype.h math.h limits.h)
@ -920,13 +920,13 @@ endif()
# General SDL subsystem options, valid for all platforms # General SDL subsystem options, valid for all platforms
if(SDL_AUDIO) if(SDL_AUDIO)
# CheckDummyAudio/CheckDiskAudio - valid for all platforms # CheckDummyAudio/CheckDiskAudio - valid for all platforms
if(DUMMYAUDIO) if(SDL_DUMMYAUDIO)
set(SDL_AUDIO_DRIVER_DUMMY 1) set(SDL_AUDIO_DRIVER_DUMMY 1)
file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c) file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES})
set(HAVE_DUMMYAUDIO TRUE) set(HAVE_DUMMYAUDIO TRUE)
endif() endif()
if(DISKAUDIO) if(SDL_DISKAUDIO)
set(SDL_AUDIO_DRIVER_DISK 1) set(SDL_AUDIO_DRIVER_DISK 1)
file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c) file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES})
@ -947,7 +947,8 @@ if(UNIX OR APPLE)
endif() endif()
if(SDL_JOYSTICK) if(SDL_JOYSTICK)
if(JOYSTICK_VIRTUAL) if(SDL_VIRTUAL_JOYSTICK)
set(HAVE_VIRTUAL_JOYSTICK TRUE)
set(SDL_JOYSTICK_VIRTUAL 1) set(SDL_JOYSTICK_VIRTUAL 1)
file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c) file(GLOB JOYSTICK_VIRTUAL_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/virtual/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_VIRTUAL_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_VIRTUAL_SOURCES})
@ -955,18 +956,18 @@ if(SDL_JOYSTICK)
endif() endif()
if(SDL_VIDEO) if(SDL_VIDEO)
if(VIDEO_DUMMY) if(SDL_DUMMYVIDEO)
set(SDL_VIDEO_DRIVER_DUMMY 1) set(SDL_VIDEO_DRIVER_DUMMY 1)
file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c) file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES})
set(HAVE_VIDEO_DUMMY TRUE) set(HAVE_DUMMY TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
endif() endif()
if(VIDEO_OFFSCREEN) if(SDL_OFFSCREEN)
set(SDL_VIDEO_DRIVER_OFFSCREEN 1) set(SDL_VIDEO_DRIVER_OFFSCREEN 1)
file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c) file(GLOB VIDEO_OFFSCREEN_SOURCES ${SDL2_SOURCE_DIR}/src/video/offscreen/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_OFFSCREEN_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_OFFSCREEN_SOURCES})
set(HAVE_VIDEO_OFFSCREEN TRUE) set(HAVE_OFFSCREEN TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
endif() endif()
endif() endif()
@ -1078,9 +1079,9 @@ if(ANDROID)
endif() endif()
#enable gles #enable gles
if(VIDEO_OPENGLES) if(SDL_OPENGLES)
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_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)
set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_OPENGL_ES2 1)
@ -1101,7 +1102,7 @@ if(ANDROID)
} }
" VULKAN_PASSED_ANDROID_CHECKS) " VULKAN_PASSED_ANDROID_CHECKS)
if(NOT VULKAN_PASSED_ANDROID_CHECKS) if(NOT VULKAN_PASSED_ANDROID_CHECKS)
set(VIDEO_VULKAN OFF) set(SDL_VULKAN OFF)
message(STATUS "Vulkan doesn't work on this configuration") message(STATUS "Vulkan doesn't work on this configuration")
endif() endif()
endif() endif()
@ -1147,7 +1148,7 @@ elseif(EMSCRIPTEN)
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE) set(HAVE_SDL_TIMERS TRUE)
if(CLOCK_GETTIME) if(SDL_CLOCK_GETTIME)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
endif() endif()
endif() endif()
@ -1158,9 +1159,9 @@ elseif(EMSCRIPTEN)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
#enable gles #enable gles
if(VIDEO_OPENGLES) if(SDL_OPENGLES)
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_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() endif()
@ -1366,7 +1367,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
CheckPTHREAD() CheckPTHREAD()
if(CLOCK_GETTIME) if(SDL_CLOCK_GETTIME)
check_library_exists(rt clock_gettime "" FOUND_CLOCK_GETTIME) check_library_exists(rt clock_gettime "" FOUND_CLOCK_GETTIME)
if(FOUND_CLOCK_GETTIME) if(FOUND_CLOCK_GETTIME)
list(APPEND EXTRA_LIBS rt) list(APPEND EXTRA_LIBS rt)
@ -1418,7 +1419,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
endif() endif()
set(SDL_RLD_FLAGS "") set(SDL_RLD_FLAGS "")
if(RPATH AND SDL_SHARED) if(SDL_RPATH AND SDL_SHARED)
if(BSDI OR FREEBSD OR LINUX OR NETBSD) if(BSDI OR FREEBSD OR LINUX OR NETBSD)
set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags") set(CMAKE_REQUIRED_FLAGS "-Wl,--enable-new-dtags")
check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS) check_c_compiler_flag("" HAVE_ENABLE_NEW_DTAGS)
@ -1468,7 +1469,7 @@ elseif(WINDOWS)
set(HAVE_SDL_MISC TRUE) set(HAVE_SDL_MISC TRUE)
# Check for DirectX # Check for DirectX
if(DIRECTX) if(SDL_DIRECTX)
if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700) if(DEFINED MSVC_VERSION AND NOT ${MSVC_VERSION} LESS 1700)
set(USE_WINSDK_DIRECTX TRUE) set(USE_WINSDK_DIRECTX TRUE)
endif() endif()
@ -1499,7 +1500,7 @@ elseif(WINDOWS)
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
endif() endif()
if(XINPUT) if(SDL_XINPUT)
# xinput.h may need windows.h, but does not include it itself. # xinput.h may need windows.h, but does not include it itself.
check_c_source_compiles(" check_c_source_compiles("
#include <windows.h> #include <windows.h>
@ -1536,7 +1537,7 @@ elseif(WINDOWS)
set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
endif() endif()
if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) if(SDL_WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
set(SDL_AUDIO_DRIVER_WASAPI 1) set(SDL_AUDIO_DRIVER_WASAPI 1)
file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c) file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
if(WINDOWS_STORE) if(WINDOWS_STORE)
@ -1564,11 +1565,11 @@ elseif(WINDOWS)
endif() endif()
set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES})
if(RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE) if(SDL_RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE)
set(SDL_VIDEO_RENDER_D3D 1) set(SDL_VIDEO_RENDER_D3D 1)
set(HAVE_RENDER_D3D TRUE) set(HAVE_RENDER_D3D TRUE)
endif() endif()
if(RENDER_D3D AND HAVE_D3D11_H) if(SDL_RENDER_D3D AND HAVE_D3D11_H)
set(SDL_VIDEO_RENDER_D3D11 1) set(SDL_VIDEO_RENDER_D3D11 1)
set(HAVE_RENDER_D3D TRUE) set(HAVE_RENDER_D3D TRUE)
endif() endif()
@ -1661,18 +1662,18 @@ elseif(WINDOWS)
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
if(SDL_VIDEO) if(SDL_VIDEO)
if(VIDEO_OPENGL AND NOT WINDOWS_STORE) if(SDL_OPENGL AND NOT WINDOWS_STORE)
set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_OPENGL_WGL 1) set(SDL_VIDEO_OPENGL_WGL 1)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
set(HAVE_VIDEO_OPENGL TRUE) set(HAVE_OPENGL TRUE)
endif() endif()
if(VIDEO_OPENGLES) if(SDL_OPENGLES)
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
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)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_OPENGLES TRUE)
endif() endif()
endif() endif()
@ -1875,15 +1876,15 @@ elseif(APPLE)
set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
else() else()
CheckCOCOA() CheckCOCOA()
if(VIDEO_OPENGL) if(SDL_OPENGL)
set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_OPENGL_CGL 1) set(SDL_VIDEO_OPENGL_CGL 1)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
set(HAVE_VIDEO_OPENGL TRUE) set(HAVE_OPENGL TRUE)
endif() endif()
endif() endif()
if(VIDEO_OPENGLES) if(SDL_OPENGLES)
if(IOS OR TVOS) if(IOS OR TVOS)
set(SDL_FRAMEWORK_OPENGLES 1) set(SDL_FRAMEWORK_OPENGLES 1)
set(SDL_VIDEO_OPENGL_ES 1) set(SDL_VIDEO_OPENGL_ES 1)
@ -1893,10 +1894,10 @@ elseif(APPLE)
endif() endif()
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)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_OPENGLES TRUE)
endif() endif()
if(VIDEO_VULKAN OR VIDEO_METAL OR RENDER_METAL) if(SDL_VULKAN OR SDL_METAL OR SDL_RENDER_METAL)
set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -ObjC")
check_c_source_compiles(" check_c_source_compiles("
@ -1917,18 +1918,18 @@ elseif(APPLE)
set(SDL_FRAMEWORK_METAL 1) set(SDL_FRAMEWORK_METAL 1)
set(SDL_FRAMEWORK_QUARTZCORE 1) set(SDL_FRAMEWORK_QUARTZCORE 1)
else() else()
set(VIDEO_VULKAN 0) set(SDL_VULKAN 0)
set(VIDEO_METAL 0) set(SDL_METAL 0)
set(RENDER_METAL 0) set(SDL_RENDER_METAL 0)
endif() endif()
endif() endif()
if(VIDEO_METAL) if(SDL_METAL)
set(SDL_VIDEO_METAL 1) set(SDL_VIDEO_METAL 1)
set(HAVE_VIDEO_METAL TRUE) set(HAVE_METAL TRUE)
endif() endif()
if(RENDER_METAL) if(SDL_RENDER_METAL)
file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m) file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES})
set(SDL_VIDEO_RENDER_METAL 1) set(SDL_VIDEO_RENDER_METAL 1)
@ -2047,13 +2048,13 @@ elseif(HAIKU)
set(SOURCE_FILES ${SOURCE_FILES} ${HAIKUVIDEO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${HAIKUVIDEO_SOURCES})
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
if(VIDEO_OPENGL) if(SDL_OPENGL)
# TODO: Use FIND_PACKAGE(OpenGL) instead # TODO: Use FIND_PACKAGE(OpenGL) instead
set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_OPENGL_HAIKU 1) set(SDL_VIDEO_OPENGL_HAIKU 1)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
list(APPEND EXTRA_LIBS GL) list(APPEND EXTRA_LIBS GL)
set(HAVE_VIDEO_OPENGL TRUE) set(HAVE_OPENGL TRUE)
endif() endif()
endif() endif()
@ -2101,7 +2102,7 @@ elseif(RISCOS)
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE) set(HAVE_SDL_TIMERS TRUE)
if(CLOCK_GETTIME) if(SDL_CLOCK_GETTIME)
set(HAVE_CLOCK_GETTIME 1) set(HAVE_CLOCK_GETTIME 1)
endif() endif()
endif() endif()
@ -2183,10 +2184,10 @@ elseif(VITA)
list(APPEND EXTRA_LIBS list(APPEND EXTRA_LIBS
pib pib
) )
set(HAVE_VIDEO_VITA_PIB ON) set(HAVE_VITA_PIB ON)
set(SDL_VIDEO_VITA_PIB 1) set(SDL_VIDEO_VITA_PIB 1)
else() else()
set(HAVE_VIDEO_VITA_PIB OFF) set(HAVE_VITA_PIB OFF)
endif() endif()
endif() endif()
@ -2196,7 +2197,7 @@ elseif(VITA)
if(HAVE_PVR_H) if(HAVE_PVR_H)
add_definitions("-D__psp2__") add_definitions("-D__psp2__")
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_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)
set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_OPENGL_ES2 1)
@ -2206,10 +2207,10 @@ elseif(VITA)
libgpu_es4_ext_stub_weak libgpu_es4_ext_stub_weak
libIMGEGL_stub_weak libIMGEGL_stub_weak
) )
set(HAVE_VIDEO_VITA_PVR ON) set(HAVE_VITA_PVR ON)
set(SDL_VIDEO_VITA_PVR 1) set(SDL_VIDEO_VITA_PVR 1)
else() else()
set(HAVE_VIDEO_VITA_PVR OFF) set(HAVE_VITA_PVR OFF)
endif() endif()
endif() endif()
@ -2233,7 +2234,7 @@ elseif(VITA)
SceProcessmgr_stub SceProcessmgr_stub
m m
) )
if(HAVE_VIDEO_VITA_PIB) if(HAVE_VITA_PIB)
list(PREPEND EXTRA_LIBS list(PREPEND EXTRA_LIBS
pib pib
libScePiglet_stub libScePiglet_stub
@ -2267,14 +2268,14 @@ elseif(VITA)
endif() endif()
if(VIDEO_VULKAN AND NOT SDL_LOADSO) if(SDL_VULKAN AND NOT SDL_LOADSO)
message(STATUS "Vulkan support is available, but disabled because there's no loadso.") message(STATUS "Vulkan support is available, but disabled because there's no loadso.")
set(VIDEO_VULKAN OFF) set(SDL_VULKAN OFF)
endif() endif()
if(VIDEO_VULKAN) if(SDL_VULKAN)
set(SDL_VIDEO_VULKAN 1) set(SDL_VIDEO_VULKAN 1)
set(HAVE_VIDEO_VULKAN TRUE) set(HAVE_VULKAN TRUE)
endif() endif()
# Dummies # Dummies
@ -2494,7 +2495,7 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
endmacro() endmacro()
# enable AddressSanitizer if supported # enable AddressSanitizer if supported
if (ASAN) if (SDL_ASAN)
asan_check_add_debug_flag2("address") asan_check_add_debug_flag2("address")
asan_check_add_debug_flag("bool") asan_check_add_debug_flag("bool")
asan_check_add_debug_flag("bounds") asan_check_add_debug_flag("bounds")
@ -2532,10 +2533,10 @@ message(STATUS "")
message(STATUS "Options:") message(STATUS "Options:")
list(SORT ALLOPTIONS) list(SORT ALLOPTIONS)
foreach(_OPT ${ALLOPTIONS}) foreach(_OPT ${ALLOPTIONS})
# Longest option is VIDEO_X11_XSCREENSAVER = 22 characters # Longest option is SDL_WAYLAND_LIBDECOR_SHARED = 27 characters
# Get the padding # Get the padding
string(LENGTH ${_OPT} _OPTLEN) string(LENGTH ${_OPT} _OPTLEN)
math(EXPR _PADLEN "23 - ${_OPTLEN}") math(EXPR _PADLEN "28 - ${_OPTLEN}")
string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING) string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING)
message_tested_option(${_OPT} ${_PADDING}) message_tested_option(${_OPT} ${_PADDING})
endforeach() endforeach()
@ -2569,7 +2570,7 @@ if(WARN_ABOUT_ARM_SIMD_ASM_MIT)
message(STATUS "uses code licensed under the MIT license. If this is a") message(STATUS "uses code licensed under the MIT license. If this is a")
message(STATUS "problem, please disable that code by rerunning CMake with:") message(STATUS "problem, please disable that code by rerunning CMake with:")
message(STATUS "") message(STATUS "")
message(STATUS " -DARMSIMD=OFF") message(STATUS " -DSDL_ARMSIMD=OFF")
endif() endif()
if(WARN_ABOUT_ARM_NEON_ASM_MIT) if(WARN_ABOUT_ARM_NEON_ASM_MIT)
@ -2578,7 +2579,7 @@ if(WARN_ABOUT_ARM_NEON_ASM_MIT)
message(STATUS "uses code licensed under the MIT license. If this is a") message(STATUS "uses code licensed under the MIT license. If this is a")
message(STATUS "problem, please disable that code by rerunning CMake with:") message(STATUS "problem, please disable that code by rerunning CMake with:")
message(STATUS "") message(STATUS "")
message(STATUS " -DARMNEON=OFF") message(STATUS " -DSDL_ARMNEON=OFF")
endif() endif()
# Ensure that the extra cflags are used at compile time # Ensure that the extra cflags are used at compile time
@ -2623,7 +2624,7 @@ if(SDL_SHARED)
SOVERSION ${LT_REVISION} SOVERSION ${LT_REVISION}
OUTPUT_NAME "SDL2") OUTPUT_NAME "SDL2")
endif() endif()
if(MSVC AND NOT LIBC) if(MSVC AND NOT SDL_LIBC)
# Don't try to link with the default set of libraries. # Don't try to link with the default set of libraries.
if(NOT WINDOWS_STORE) if(NOT WINDOWS_STORE)
set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
@ -2651,7 +2652,7 @@ if(ANDROID)
add_library(SDL2::hidapi ALIAS hidapi) add_library(SDL2::hidapi ALIAS hidapi)
endif() endif()
if(MSVC AND NOT LIBC) if(MSVC AND NOT SDL_LIBC)
# Don't try to link with the default set of libraries. # Don't try to link with the default set of libraries.
set_target_properties(hidapi PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(hidapi PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
set_target_properties(hidapi PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(hidapi PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
@ -2675,7 +2676,7 @@ if(SDL_STATIC)
# clobbered, when the suffix is realized via subsequent rename. # clobbered, when the suffix is realized via subsequent rename.
endif() endif()
set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC})
if(MSVC AND NOT LIBC) if(MSVC AND NOT SDL_LIBC)
set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")

View File

@ -27,7 +27,7 @@ cd checker-buildbot
# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found" # The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found"
# You might want to do this for CMake-backed builds instead... # You might want to do this for CMake-backed builds instead...
scan-build -o analysis cmake -G Ninja -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" .. scan-build -o analysis cmake -G Ninja -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" ..
# ...or run configure without the scan-build wrapper... # ...or run configure without the scan-build wrapper...
#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled #CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled

View File

@ -24,7 +24,7 @@ mkdir codechecker-buildbot
cd codechecker-buildbot cd codechecker-buildbot
# We turn off deprecated declarations, because we don't care about these warnings during static analysis. # We turn off deprecated declarations, because we don't care about these warnings during static analysis.
cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
# CMake on macOS adds "-arch arm64" or whatever is appropriate, but this confuses CodeChecker, so strip it out. # CMake on macOS adds "-arch arm64" or whatever is appropriate, but this confuses CodeChecker, so strip it out.
perl -w -pi -e 's/\-arch\s+.*?\s+//g;' compile_commands.json perl -w -pi -e 's/\-arch\s+.*?\s+//g;' compile_commands.json

View File

@ -42,12 +42,18 @@ macro(MESSAGE_TESTED_OPTION _NAME)
if(${ARGC} EQUAL 2) if(${ARGC} EQUAL 2)
set(_PAD ${ARGV1}) set(_PAD ${ARGV1})
endif() endif()
if(NOT HAVE_${_NAME}) string(SUBSTRING "${_NAME}" 0 4 _NAMESTART)
set(HAVE_${_NAME} OFF) if(_NAMESTART STREQUAL "SDL_")
elseif("${HAVE_${_NAME}}" MATCHES "1|TRUE|YES|Y") string(SUBSTRING "${_NAME}" 4 -1 _STRIPPEDNAME)
set(HAVE_${_NAME} ON) else()
set(_STRIPPEDNAME "${_NAME}")
endif() endif()
message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_NAME}}") if(NOT HAVE_${_STRIPPEDNAME})
set(HAVE_${_STRIPPEDNAME} OFF)
elseif("${HAVE_${_STRIPPEDNAME}}" MATCHES "1|TRUE|YES|Y")
set(HAVE_${_STRIPPEDNAME} ON)
endif()
message(STATUS " ${_NAME}${_PAD}(Wanted: ${_REQVALUE}): ${HAVE_${_STRIPPEDNAME}}")
endmacro() endmacro()
macro(LISTTOSTR _LIST _OUTPUT) macro(LISTTOSTR _LIST _OUTPUT)

View File

@ -57,7 +57,7 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
macro(CheckOSS) macro(CheckOSS)
if(OSS) if(SDL_OSS)
set(OSS_HEADER_FILE "sys/soundcard.h") set(OSS_HEADER_FILE "sys/soundcard.h")
check_c_source_compiles(" check_c_source_compiles("
#include <sys/soundcard.h> #include <sys/soundcard.h>
@ -88,10 +88,10 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
# Optional: # Optional:
# - ALSA_SHARED opt # - SDL_ALSA_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckALSA) macro(CheckALSA)
if(ALSA) if(SDL_ALSA)
CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H) CHECK_INCLUDE_FILE(alsa/asoundlib.h HAVE_ASOUNDLIB_H)
if(HAVE_ASOUNDLIB_H) if(HAVE_ASOUNDLIB_H)
CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND) CHECK_LIBRARY_EXISTS(asound snd_pcm_recover "" HAVE_LIBASOUND)
@ -101,10 +101,10 @@ macro(CheckALSA)
file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c) file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES})
set(SDL_AUDIO_DRIVER_ALSA 1) set(SDL_AUDIO_DRIVER_ALSA 1)
if(ALSA_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_ALSA_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading") message_warn("You must have SDL_LoadObject() support for dynamic ALSA loading")
endif() endif()
if(ALSA_SHARED AND HAVE_SDL_LOADSO) if(SDL_ALSA_SHARED AND HAVE_SDL_LOADSO)
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)
@ -119,10 +119,10 @@ endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
# Optional: # Optional:
# - PIPEWIRE_SHARED opt # - SDL_PIPEWIRE_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckPipewire) macro(CheckPipewire)
if(PIPEWIRE) if(SDL_PIPEWIRE)
pkg_check_modules(PKG_PIPEWIRE libpipewire-0.3>=0.3.20) pkg_check_modules(PKG_PIPEWIRE libpipewire-0.3>=0.3.20)
if(PKG_PIPEWIRE_FOUND) if(PKG_PIPEWIRE_FOUND)
set(HAVE_PIPEWIRE TRUE) set(HAVE_PIPEWIRE TRUE)
@ -130,10 +130,10 @@ macro(CheckPipewire)
set(SOURCE_FILES ${SOURCE_FILES} ${PIPEWIRE_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${PIPEWIRE_SOURCES})
set(SDL_AUDIO_DRIVER_PIPEWIRE 1) set(SDL_AUDIO_DRIVER_PIPEWIRE 1)
list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PKG_PIPEWIRE_CFLAGS})
if(PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_PIPEWIRE_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading") message_warn("You must have SDL_LoadObject() support for dynamic Pipewire loading")
endif() endif()
if(PIPEWIRE_SHARED AND HAVE_SDL_LOADSO) if(SDL_PIPEWIRE_SHARED AND HAVE_SDL_LOADSO)
FindLibraryAndSONAME("pipewire-0.3") FindLibraryAndSONAME("pipewire-0.3")
set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC "\"${PIPEWIRE_0.3_LIB_SONAME}\"")
set(HAVE_PIPEWIRE_SHARED TRUE) set(HAVE_PIPEWIRE_SHARED TRUE)
@ -149,10 +149,10 @@ endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
# Optional: # Optional:
# - PULSEAUDIO_SHARED opt # - SDL_PULSEAUDIO_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckPulseAudio) macro(CheckPulseAudio)
if(PULSEAUDIO) if(SDL_PULSEAUDIO)
pkg_check_modules(PKG_PULSEAUDIO libpulse-simple) pkg_check_modules(PKG_PULSEAUDIO libpulse-simple)
if(PKG_PULSEAUDIO_FOUND) if(PKG_PULSEAUDIO_FOUND)
set(HAVE_PULSEAUDIO TRUE) set(HAVE_PULSEAUDIO TRUE)
@ -160,15 +160,15 @@ macro(CheckPulseAudio)
set(SOURCE_FILES ${SOURCE_FILES} ${PULSEAUDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${PULSEAUDIO_SOURCES})
set(SDL_AUDIO_DRIVER_PULSEAUDIO 1) set(SDL_AUDIO_DRIVER_PULSEAUDIO 1)
list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PKG_PULSEAUDIO_CFLAGS})
if(PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading") message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading")
endif() endif()
if(PULSEAUDIO_SHARED AND HAVE_SDL_LOADSO) if(SDL_PULSEAUDIO_SHARED AND HAVE_SDL_LOADSO)
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)
else() else()
list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${PKG_sPULSEAUDIO_LDFLAGS})
endif() endif()
set(HAVE_SDL_AUDIO TRUE) set(HAVE_SDL_AUDIO TRUE)
endif() endif()
@ -178,10 +178,10 @@ endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
# Optional: # Optional:
# - JACK_SHARED opt # - SDL_JACK_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckJACK) macro(CheckJACK)
if(JACK) if(SDL_JACK)
pkg_check_modules(PKG_JACK jack) pkg_check_modules(PKG_JACK jack)
if(PKG_JACK_FOUND) if(PKG_JACK_FOUND)
set(HAVE_JACK TRUE) set(HAVE_JACK TRUE)
@ -189,10 +189,10 @@ macro(CheckJACK)
set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES})
set(SDL_AUDIO_DRIVER_JACK 1) set(SDL_AUDIO_DRIVER_JACK 1)
list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS})
if(JACK_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_JACK_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading")
endif() endif()
if(JACK_SHARED AND HAVE_SDL_LOADSO) if(SDL_JACK_SHARED AND HAVE_SDL_LOADSO)
FindLibraryAndSONAME("jack") FindLibraryAndSONAME("jack")
set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"")
set(HAVE_JACK_SHARED TRUE) set(HAVE_JACK_SHARED TRUE)
@ -207,10 +207,10 @@ endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
# Optional: # Optional:
# - ESD_SHARED opt # - SDL_ESD_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckESD) macro(CheckESD)
if(ESD) if(SDL_ESD)
pkg_check_modules(PKG_ESD esound) pkg_check_modules(PKG_ESD esound)
if(PKG_ESD_FOUND) if(PKG_ESD_FOUND)
set(HAVE_ESD TRUE) set(HAVE_ESD TRUE)
@ -218,10 +218,10 @@ macro(CheckESD)
set(SOURCE_FILES ${SOURCE_FILES} ${ESD_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${ESD_SOURCES})
set(SDL_AUDIO_DRIVER_ESD 1) set(SDL_AUDIO_DRIVER_ESD 1)
list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PKG_ESD_CFLAGS})
if(ESD_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_ESD_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ESD loading") message_warn("You must have SDL_LoadObject() support for dynamic ESD loading")
endif() endif()
if(ESD_SHARED AND HAVE_SDL_LOADSO) if(SDL_ESD_SHARED AND HAVE_SDL_LOADSO)
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)
@ -236,10 +236,10 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
# Optional: # Optional:
# - ARTS_SHARED opt # - SDL_ARTS_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckARTS) macro(CheckARTS)
if(ARTS) if(SDL_ARTS)
find_program(ARTS_CONFIG arts-config) find_program(ARTS_CONFIG arts-config)
if(ARTS_CONFIG) if(ARTS_CONFIG)
execute_process(CMD_ARTSCFLAGS ${ARTS_CONFIG} --cflags execute_process(CMD_ARTSCFLAGS ${ARTS_CONFIG} --cflags
@ -251,10 +251,10 @@ macro(CheckARTS)
set(SOURCE_FILES ${SOURCE_FILES} ${ARTS_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${ARTS_SOURCES})
set(SDL_AUDIO_DRIVER_ARTS 1) set(SDL_AUDIO_DRIVER_ARTS 1)
set(HAVE_ARTS TRUE) set(HAVE_ARTS TRUE)
if(ARTS_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_ARTS_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading") message_warn("You must have SDL_LoadObject() support for dynamic ARTS loading")
endif() endif()
if(ARTS_SHARED AND HAVE_SDL_LOADSO) if(SDL_ARTS_SHARED AND HAVE_SDL_LOADSO)
# TODO # TODO
FindLibraryAndSONAME(artsc) FindLibraryAndSONAME(artsc)
set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"") set(SDL_AUDIO_DRIVER_ARTS_DYNAMIC "\"${ARTSC_LIB_SONAME}\"")
@ -270,10 +270,10 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
# Optional: # Optional:
# - NAS_SHARED opt # - SDL_NAS_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckNAS) macro(CheckNAS)
if(NAS) if(SDL_NAS)
# TODO: set include paths properly, so the NAS headers are found # TODO: set include paths properly, so the NAS headers are found
check_include_file(audio/audiolib.h HAVE_NAS_H) check_include_file(audio/audiolib.h HAVE_NAS_H)
find_library(D_NAS_LIB audio) find_library(D_NAS_LIB audio)
@ -282,10 +282,10 @@ macro(CheckNAS)
file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c) file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${NAS_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${NAS_SOURCES})
set(SDL_AUDIO_DRIVER_NAS 1) set(SDL_AUDIO_DRIVER_NAS 1)
if(NAS_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_NAS_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic NAS loading") message_warn("You must have SDL_LoadObject() support for dynamic NAS loading")
endif() endif()
if(NAS_SHARED AND HAVE_SDL_LOADSO) if(SDL_NAS_SHARED AND HAVE_SDL_LOADSO)
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)
@ -300,10 +300,10 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
# Optional: # Optional:
# - SNDIO_SHARED opt # - SDL_SNDIO_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckSNDIO) macro(CheckSNDIO)
if(SNDIO) if(SDL_SNDIO)
# TODO: set include paths properly, so the sndio headers are found # TODO: set include paths properly, so the sndio headers are found
check_include_file(sndio.h HAVE_SNDIO_H) check_include_file(sndio.h HAVE_SNDIO_H)
find_library(D_SNDIO_LIB sndio) find_library(D_SNDIO_LIB sndio)
@ -312,10 +312,10 @@ macro(CheckSNDIO)
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
set(SDL_AUDIO_DRIVER_SNDIO 1) set(SDL_AUDIO_DRIVER_SNDIO 1)
if(SNDIO_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_SNDIO_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading") message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
endif() endif()
if(SNDIO_SHARED AND HAVE_SDL_LOADSO) if(SDL_SNDIO_SHARED AND HAVE_SDL_LOADSO)
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)
@ -357,19 +357,19 @@ macro(CheckFusionSound)
endmacro() endmacro()
# Requires: # Requires:
# - LIBSAMPLERATE # - SDL_LIBSAMPLERATE
# Optional: # Optional:
# - LIBSAMPLERATE_SHARED opt # - SDL_LIBSAMPLERATE_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckLibSampleRate) macro(CheckLibSampleRate)
if(LIBSAMPLERATE) if(SDL_LIBSAMPLERATE)
check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H) check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H)
if(HAVE_LIBSAMPLERATE_H) if(HAVE_LIBSAMPLERATE_H)
set(HAVE_LIBSAMPLERATE TRUE) set(HAVE_LIBSAMPLERATE TRUE)
if(LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_LIBSAMPLERATE_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading")
endif() endif()
if(LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO) if(SDL_LIBSAMPLERATE_SHARED AND HAVE_SDL_LOADSO)
FindLibraryAndSONAME("samplerate") FindLibraryAndSONAME("samplerate")
set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"")
set(HAVE_LIBSAMPLERATE_SHARED TRUE) set(HAVE_LIBSAMPLERATE_SHARED TRUE)
@ -383,10 +383,10 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
# Optional: # Optional:
# - X11_SHARED opt # - SDL_X11_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckX11) macro(CheckX11)
if(VIDEO_X11) if(SDL_X11)
foreach(_LIB X11 Xext Xcursor Xinerama Xi Xrandr Xrender Xss Xxf86vm) foreach(_LIB X11 Xext Xcursor Xinerama Xi Xrandr Xrender Xss Xxf86vm)
FindLibraryAndSONAME("${_LIB}") FindLibraryAndSONAME("${_LIB}")
endforeach() endforeach()
@ -423,15 +423,16 @@ macro(CheckX11)
message_error("Missing Xext.h, maybe you need to install the libxext-dev package?") message_error("Missing Xext.h, maybe you need to install the libxext-dev package?")
endif() endif()
set(HAVE_VIDEO_X11 TRUE) set(HAVE_X11 TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
file(GLOB X11_SOURCES ${SDL2_SOURCE_DIR}/src/video/x11/*.c) file(GLOB X11_SOURCES ${SDL2_SOURCE_DIR}/src/video/x11/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${X11_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${X11_SOURCES})
set(SDL_VIDEO_DRIVER_X11 1) set(SDL_VIDEO_DRIVER_X11 1)
# !!! FIXME: why is this disabled for Apple?
if(APPLE) if(APPLE)
set(X11_SHARED OFF) set(SDL_X11_SHARED OFF)
endif() endif()
check_symbol_exists(shmat "sys/shm.h" HAVE_SHMAT) check_symbol_exists(shmat "sys/shm.h" HAVE_SHMAT)
@ -446,7 +447,7 @@ macro(CheckX11)
endif() endif()
endif() endif()
if(X11_SHARED) if(SDL_X11_SHARED)
if(NOT HAVE_SDL_LOADSO) if(NOT HAVE_SDL_LOADSO)
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)
@ -478,8 +479,8 @@ macro(CheckX11)
check_symbol_exists(XkbKeycodeToKeysym "X11/Xlib.h;X11/XKBlib.h" SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM) check_symbol_exists(XkbKeycodeToKeysym "X11/Xlib.h;X11/XKBlib.h" SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H) if(SDL_X11_XCURSOR AND HAVE_XCURSOR_H)
set(HAVE_VIDEO_X11_XCURSOR TRUE) set(HAVE_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() else()
@ -488,8 +489,8 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XCURSOR 1) set(SDL_VIDEO_DRIVER_X11_XCURSOR 1)
endif() endif()
if(VIDEO_X11_XINERAMA AND HAVE_XINERAMA_H) if(SDL_X11_XINERAMA AND HAVE_XINERAMA_H)
set(HAVE_VIDEO_X11_XINERAMA TRUE) set(HAVE_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() else()
@ -498,8 +499,8 @@ macro(CheckX11)
set(SDL_VIDEO_DRIVER_X11_XINERAMA 1) set(SDL_VIDEO_DRIVER_X11_XINERAMA 1)
endif() endif()
if(VIDEO_X11_XINPUT AND HAVE_XINPUT2_H) if(SDL_X11_XINPUT AND HAVE_XINPUT2_H)
set(HAVE_VIDEO_X11_XINPUT TRUE) set(HAVE_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() else()
@ -524,45 +525,45 @@ macro(CheckX11)
endif() endif()
endif() endif()
if(VIDEO_X11_XRANDR AND HAVE_XRANDR_H) if(SDL_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() else()
list(APPEND EXTRA_LIBS ${XRANDR_LIB}) list(APPEND EXTRA_LIBS ${XRANDR_LIB})
endif() endif()
set(SDL_VIDEO_DRIVER_X11_XRANDR 1) set(SDL_VIDEO_DRIVER_X11_XRANDR 1)
set(HAVE_VIDEO_X11_XRANDR TRUE) set(HAVE_X11_XRANDR TRUE)
endif() endif()
if(VIDEO_X11_XSCRNSAVER AND HAVE_XSS_H) if(SDL_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() else()
list(APPEND EXTRA_LIBS ${XSS_LIB}) list(APPEND EXTRA_LIBS ${XSS_LIB})
endif() endif()
set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1) set(SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1)
set(HAVE_VIDEO_X11_XSCRNSAVER TRUE) set(HAVE_X11_XSCRNSAVER TRUE)
endif() endif()
if(VIDEO_X11_XSHAPE AND HAVE_XSHAPE_H) if(SDL_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_X11_XSHAPE TRUE)
endif() endif()
if(VIDEO_X11_XVM AND HAVE_XF86VM_H) if(SDL_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() else()
list(APPEND EXTRA_LIBS ${XXF86VM_LIB}) list(APPEND EXTRA_LIBS ${XXF86VM_LIB})
endif() endif()
set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1) set(SDL_VIDEO_DRIVER_X11_XVIDMODE 1)
set(HAVE_VIDEO_X11_XVM TRUE) set(HAVE_X11_XVM TRUE)
endif() endif()
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
endif() endif()
endif() endif()
if(NOT HAVE_VIDEO_X11) if(NOT HAVE_X11)
# Prevent Mesa from including X11 headers # Prevent Mesa from including X11 headers
list(APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11") list(APPEND EXTRA_CFLAGS "-DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11")
endif() endif()
@ -593,14 +594,14 @@ endmacro()
# - EGL # - EGL
# - PkgCheckModules # - PkgCheckModules
# Optional: # Optional:
# - WAYLAND_SHARED opt # - SDL_WAYLAND_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckWayland) macro(CheckWayland)
if(VIDEO_WAYLAND) if(SDL_WAYLAND)
pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl "xkbcommon>=0.5.0") pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl "xkbcommon>=0.5.0")
pkg_check_modules(WAYLAND_SCANNER_1_15 "wayland-scanner>=1.15") pkg_check_modules(WAYLAND_SCANNER_1_15 "wayland-scanner>=1.15")
if(WAYLAND_FOUND AND HAVE_VIDEO_OPENGL_EGL) if(WAYLAND_FOUND AND HAVE_OPENGL_EGL)
execute_process( execute_process(
COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=wayland_scanner wayland-scanner
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
@ -627,7 +628,7 @@ macro(CheckWayland)
include_directories( include_directories(
${WAYLAND_INCLUDE_DIRS} ${WAYLAND_INCLUDE_DIRS}
) )
set(HAVE_VIDEO_WAYLAND TRUE) set(HAVE_WAYLAND TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c) file(GLOB WAYLAND_SOURCES ${SDL2_SOURCE_DIR}/src/video/wayland/*.c)
@ -643,15 +644,15 @@ macro(CheckWayland)
WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}") WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_SCANNER_CODE_MODE}" "${SDL2_SOURCE_DIR}/wayland-protocols/${_XML}" "${_PROTL}")
endforeach() endforeach()
if(VIDEO_WAYLAND_QT_TOUCH) if(SDL_WAYLAND_QT_TOUCH)
set(HAVE_VIDEO_WAYLAND_QT_TOUCH TRUE) set(HAVE_WAYLAND_QT_TOUCH TRUE)
set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1) set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
endif() endif()
if(WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_WAYLAND_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading") message_warn("You must have SDL_LoadObject() support for dynamic Wayland loading")
endif() endif()
if(WAYLAND_SHARED AND HAVE_SDL_LOADSO) if(SDL_WAYLAND_SHARED AND HAVE_SDL_LOADSO)
FindLibraryAndSONAME(wayland-client) FindLibraryAndSONAME(wayland-client)
FindLibraryAndSONAME(wayland-egl) FindLibraryAndSONAME(wayland-egl)
FindLibraryAndSONAME(wayland-cursor) FindLibraryAndSONAME(wayland-cursor)
@ -665,17 +666,17 @@ macro(CheckWayland)
set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS}) set(EXTRA_LIBS ${WAYLAND_LIBRARIES} ${EXTRA_LIBS})
endif() endif()
if(WAYLAND_LIBDECOR) if(SDL_WAYLAND_LIBDECOR)
pkg_check_modules(LIBDECOR libdecor-0) pkg_check_modules(LIBDECOR libdecor-0)
if(LIBDECOR_FOUND) if(LIBDECOR_FOUND)
set(HAVE_WAYLAND_LIBDECOR TRUE) set(HAVE_WAYLAND_LIBDECOR TRUE)
set(HAVE_LIBDECOR_H 1) set(HAVE_LIBDECOR_H 1)
link_directories(${LIBDECOR_LIBRARY_DIRS}) link_directories(${LIBDECOR_LIBRARY_DIRS})
include_directories(${LIBDECOR_INCLUDE_DIRS}) include_directories(${LIBDECOR_INCLUDE_DIRS})
if(LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading") message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading")
endif() endif()
if(LIBDECOR_SHARED AND HAVE_SDL_LOADSO) if(SDL_WAYLAND_LIBDECOR_SHARED AND HAVE_SDL_LOADSO)
set(HAVE_LIBDECOR_SHARED TRUE) set(HAVE_LIBDECOR_SHARED TRUE)
FindLibraryAndSONAME(decor-0) FindLibraryAndSONAME(decor-0)
set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR "\"${DECOR_0_LIB_SONAME}\"")
@ -694,11 +695,11 @@ endmacro()
# - n/a # - n/a
# #
macro(CheckCOCOA) macro(CheckCOCOA)
if(VIDEO_COCOA) if(SDL_COCOA)
if(APPLE) # Apple always has Cocoa. if(APPLE) # Apple always has Cocoa.
set(HAVE_VIDEO_COCOA TRUE) set(HAVE_COCOA TRUE)
endif() endif()
if(HAVE_VIDEO_COCOA) if(HAVE_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})
@ -714,19 +715,19 @@ endmacro()
# - DIRECTFB_SHARED opt # - DIRECTFB_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckDirectFB) macro(CheckDirectFB)
if(VIDEO_DIRECTFB) if(SDL_DIRECTFB)
pkg_check_modules(PKG_DIRECTFB directfb>=1.0.0) pkg_check_modules(PKG_DIRECTFB directfb>=1.0.0)
if(PKG_DIRECTFB_FOUND) if(PKG_DIRECTFB_FOUND)
set(HAVE_VIDEO_DIRECTFB TRUE) set(HAVE_DIRECTFB TRUE)
file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c) file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${DIRECTFB_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${DIRECTFB_SOURCES})
set(SDL_VIDEO_DRIVER_DIRECTFB 1) set(SDL_VIDEO_DRIVER_DIRECTFB 1)
set(SDL_VIDEO_RENDER_DIRECTFB 1) set(SDL_VIDEO_RENDER_DIRECTFB 1)
list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS}) list(APPEND EXTRA_CFLAGS ${PKG_DIRECTFB_CFLAGS})
if(DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_DIRECTFB_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading") message_warn("You must have SDL_LoadObject() support for dynamic DirectFB loading")
endif() endif()
if(DIRECTFB_SHARED AND HAVE_SDL_LOADSO) if(SDL_DIRECTFB_SHARED AND HAVE_SDL_LOADSO)
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)
@ -741,41 +742,41 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
macro(CheckVivante) macro(CheckVivante)
if(VIDEO_VIVANTE) if(SDL_VIVANTE)
check_c_source_compiles(" check_c_source_compiles("
#include <gc_vdk.h> #include <gc_vdk.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_VIVANTE_VDK) int main(int argc, char** argv) {}" HAVE_VIVANTE_VDK)
check_c_source_compiles(" check_c_source_compiles("
#define LINUX #define LINUX
#define EGL_API_FB #define EGL_API_FB
#include <EGL/eglvivante.h> #include <EGL/eglvivante.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_VIVANTE_EGL_FB) int main(int argc, char** argv) {}" HAVE_VIVANTE_EGL_FB)
if(HAVE_VIDEO_VIVANTE_VDK OR HAVE_VIDEO_VIVANTE_EGL_FB) if(HAVE_VIVANTE_VDK OR HAVE_VIVANTE_EGL_FB)
set(HAVE_VIDEO_VIVANTE TRUE) set(HAVE_VIVANTE TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c) file(GLOB VIVANTE_SOURCES ${SDL2_SOURCE_DIR}/src/video/vivante/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${VIVANTE_SOURCES}) set(SOURCE_FILES ${SOURCE_FILES} ${VIVANTE_SOURCES})
set(SDL_VIDEO_DRIVER_VIVANTE 1) set(SDL_VIDEO_DRIVER_VIVANTE 1)
if(HAVE_VIDEO_VIVANTE_VDK) if(HAVE_VIVANTE_VDK)
set(SDL_VIDEO_DRIVER_VIVANTE_VDK 1) set(SDL_VIDEO_DRIVER_VIVANTE_VDK 1)
list(APPEND EXTRA_LIBS VDK VIVANTE) list(APPEND EXTRA_LIBS VDK VIVANTE)
else() else()
set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB") set(SDL_CFLAGS "${SDL_CFLAGS} -DLINUX -DEGL_API_FB")
list(APPEND EXTRA_LIBS EGL) list(APPEND EXTRA_LIBS EGL)
endif(HAVE_VIDEO_VIVANTE_VDK) endif(HAVE_VIVANTE_VDK)
endif(HAVE_VIDEO_VIVANTE_VDK OR HAVE_VIDEO_VIVANTE_EGL_FB) endif()
endif(VIDEO_VIVANTE) endif()
endmacro(CheckVivante) endmacro()
# Requires: # Requires:
# - nada # - nada
macro(CheckGLX) macro(CheckGLX)
if(VIDEO_OPENGL) if(SDL_OPENGL)
check_c_source_compiles(" check_c_source_compiles("
#include <GL/glx.h> #include <GL/glx.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL_GLX) int main(int argc, char** argv) {}" HAVE_OPENGL_GLX)
if(HAVE_VIDEO_OPENGL_GLX) if(HAVE_OPENGL_GLX)
set(SDL_VIDEO_OPENGL_GLX 1) set(SDL_VIDEO_OPENGL_GLX 1)
endif() endif()
endif() endif()
@ -784,7 +785,7 @@ endmacro()
# Requires: # Requires:
# - PkgCheckModules # - PkgCheckModules
macro(CheckEGL) macro(CheckEGL)
if (VIDEO_OPENGL OR VIDEO_OPENGLES) if (SDL_OPENGL OR SDL_OPENGLES)
pkg_check_modules(EGL egl) pkg_check_modules(EGL egl)
string(REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS}") string(REPLACE "-D_THREAD_SAFE;" "-D_THREAD_SAFE=1;" EGL_CFLAGS "${EGL_CFLAGS}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${EGL_CFLAGS}")
@ -794,8 +795,8 @@ macro(CheckEGL)
#define EGL_NO_X11 #define EGL_NO_X11
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGL_EGL) int main (int argc, char** argv) {}" HAVE_OPENGL_EGL)
if(HAVE_VIDEO_OPENGL_EGL) if(HAVE_OPENGL_EGL)
set(SDL_VIDEO_OPENGL_EGL 1) set(SDL_VIDEO_OPENGL_EGL 1)
endif() endif()
endif() endif()
@ -804,12 +805,12 @@ endmacro()
# Requires: # Requires:
# - nada # - nada
macro(CheckOpenGL) macro(CheckOpenGL)
if(VIDEO_OPENGL) if(SDL_OPENGL)
check_c_source_compiles(" check_c_source_compiles("
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glext.h> #include <GL/glext.h>
int main(int argc, char** argv) {}" HAVE_VIDEO_OPENGL) int main(int argc, char** argv) {}" HAVE_OPENGL)
if(HAVE_VIDEO_OPENGL) if(HAVE_OPENGL)
set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL 1)
set(SDL_VIDEO_RENDER_OGL 1) set(SDL_VIDEO_RENDER_OGL 1)
endif() endif()
@ -819,22 +820,22 @@ endmacro()
# Requires: # Requires:
# - nada # - nada
macro(CheckOpenGLES) macro(CheckOpenGLES)
if(VIDEO_OPENGLES) if(SDL_OPENGLES)
check_c_source_compiles(" check_c_source_compiles("
#include <GLES/gl.h> #include <GLES/gl.h>
#include <GLES/glext.h> #include <GLES/glext.h>
int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGLES_V1) int main (int argc, char** argv) {}" HAVE_OPENGLES_V1)
if(HAVE_VIDEO_OPENGLES_V1) if(HAVE_OPENGLES_V1)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_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() 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>
int main (int argc, char** argv) {}" HAVE_VIDEO_OPENGLES_V2) int main (int argc, char** argv) {}" HAVE_OPENGLES_V2)
if(HAVE_VIDEO_OPENGLES_V2) if(HAVE_OPENGLES_V2)
set(HAVE_VIDEO_OPENGLES TRUE) set(HAVE_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() endif()
@ -849,7 +850,7 @@ endmacro()
# PTHREAD_CFLAGS # PTHREAD_CFLAGS
# PTHREAD_LIBS # PTHREAD_LIBS
macro(CheckPTHREAD) macro(CheckPTHREAD)
if(PTHREADS) if(SDL_PTHREADS)
if(ANDROID) if(ANDROID)
# the android libc provides built-in support for pthreads, so no # the android libc provides built-in support for pthreads, so no
# additional linking or compile flags are necessary # additional linking or compile flags are necessary
@ -937,7 +938,7 @@ macro(CheckPTHREAD)
endif() endif()
endif() endif()
if(PTHREADS_SEM) if(SDL_PTHREADS_SEM)
check_c_source_compiles("#include <pthread.h> check_c_source_compiles("#include <pthread.h>
#include <semaphore.h> #include <semaphore.h>
int main(int argc, char **argv) { return 0; }" HAVE_PTHREADS_SEM) int main(int argc, char **argv) { return 0; }" HAVE_PTHREADS_SEM)
@ -1122,7 +1123,7 @@ endmacro()
# Check for HIDAPI joystick drivers. This is currently a Unix thing, not Windows or macOS! # Check for HIDAPI joystick drivers. This is currently a Unix thing, not Windows or macOS!
macro(CheckHIDAPI) macro(CheckHIDAPI)
if(HIDAPI) if(SDL_HIDAPI)
if(HIDAPI_SKIP_LIBUSB) if(HIDAPI_SKIP_LIBUSB)
set(HAVE_HIDAPI TRUE) set(HAVE_HIDAPI TRUE)
else() else()
@ -1161,7 +1162,7 @@ endmacro()
# Requires: # Requires:
# - n/a # - n/a
macro(CheckRPI) macro(CheckRPI)
if(VIDEO_RPI) if(SDL_RPI)
pkg_check_modules(VIDEO_RPI bcm_host brcmegl) pkg_check_modules(VIDEO_RPI bcm_host brcmegl)
if (NOT VIDEO_RPI_FOUND) if (NOT VIDEO_RPI_FOUND)
set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" )
@ -1177,11 +1178,11 @@ macro(CheckRPI)
set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}") set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}")
check_c_source_compiles(" check_c_source_compiles("
#include <bcm_host.h> #include <bcm_host.h>
int main(int argc, char **argv) {}" HAVE_VIDEO_RPI) int main(int argc, char **argv) {}" HAVE_RPI)
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
if(SDL_VIDEO AND HAVE_VIDEO_RPI) if(SDL_VIDEO AND HAVE_RPI)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
set(SDL_VIDEO_DRIVER_RPI 1) set(SDL_VIDEO_DRIVER_RPI 1)
file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c)
@ -1189,27 +1190,27 @@ macro(CheckRPI)
list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS}) list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
endif(SDL_VIDEO AND HAVE_VIDEO_RPI) endif()
endif(VIDEO_RPI) endif()
endmacro(CheckRPI) endmacro()
# Requires: # Requires:
# - EGL # - EGL
# - PkgCheckModules # - PkgCheckModules
# Optional: # Optional:
# - KMSDRM_SHARED opt # - SDL_KMSDRM_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckKMSDRM) macro(CheckKMSDRM)
if(VIDEO_KMSDRM) if(SDL_KMSDRM)
pkg_check_modules(KMSDRM libdrm gbm egl) pkg_check_modules(KMSDRM libdrm gbm egl)
if(KMSDRM_FOUND AND HAVE_VIDEO_OPENGL_EGL) if(KMSDRM_FOUND AND HAVE_OPENGL_EGL)
link_directories( link_directories(
${KMSDRM_LIBRARY_DIRS} ${KMSDRM_LIBRARY_DIRS}
) )
include_directories( include_directories(
${KMSDRM_INCLUDE_DIRS} ${KMSDRM_INCLUDE_DIRS}
) )
set(HAVE_VIDEO_KMSDRM TRUE) set(HAVE_KMSDRM TRUE)
set(HAVE_SDL_VIDEO TRUE) set(HAVE_SDL_VIDEO TRUE)
file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c)
@ -1219,10 +1220,10 @@ macro(CheckKMSDRM)
set(SDL_VIDEO_DRIVER_KMSDRM 1) set(SDL_VIDEO_DRIVER_KMSDRM 1)
if(KMSDRM_SHARED AND NOT HAVE_SDL_LOADSO) if(SDL_KMSDRM_SHARED AND NOT HAVE_SDL_LOADSO)
message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading")
endif() endif()
if(KMSDRM_SHARED AND HAVE_SDL_LOADSO) if(SDL_KMSDRM_SHARED AND HAVE_SDL_LOADSO)
FindLibraryAndSONAME(drm) FindLibraryAndSONAME(drm)
FindLibraryAndSONAME(gbm) FindLibraryAndSONAME(gbm)
set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"")