mirror of
https://github.com/libsdl-org/SDL.git
synced 2024-11-23 10:53:27 +08:00
cmake: add qnx support
Co-authored-by: elahav <elahav@users.noreply.github.com>
This commit is contained in:
parent
145ad48c0e
commit
24d145f4b6
@ -227,11 +227,13 @@ elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "^Intel$")
|
||||
set(OPT_DEF_ASM TRUE)
|
||||
set(USE_INTELCC TRUE)
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "QCC")
|
||||
set(USE_QCC TRUE)
|
||||
else()
|
||||
set(OPT_DEF_ASM FALSE)
|
||||
endif()
|
||||
|
||||
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
|
||||
if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
|
||||
set(OPT_DEF_GCC_ATOMICS ON)
|
||||
endif()
|
||||
|
||||
@ -569,7 +571,7 @@ if(NOT SDL_FOREGROUNDING_SIGNAL STREQUAL "OFF")
|
||||
endif()
|
||||
|
||||
# Compiler option evaluation
|
||||
if(USE_GCC OR USE_CLANG OR USE_INTELCC)
|
||||
if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
|
||||
# Check for -Wall first, so later things can override pieces of it.
|
||||
# Note: clang-cl treats -Wall as -Weverything (which is very loud),
|
||||
# /W3 as -Wall, and /W4 as -Wall -Wextra. So: /W3 is enough.
|
||||
@ -1428,6 +1430,12 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
|
||||
file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c)
|
||||
list(APPEND SOURCE_FILES ${AIX_AUDIO_SOURCES})
|
||||
set(HAVE_SDL_AUDIO TRUE)
|
||||
elseif(QNX)
|
||||
set(SDL_AUDIO_DRIVER_QSA 1)
|
||||
file(GLOB QSA_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/qsa/*.c)
|
||||
list(APPEND SOURCE_FILES ${QSA_AUDIO_SOURCES})
|
||||
list(APPEND EXTRA_LIBS asound)
|
||||
set(HAVE_SDL_AUDIO TRUE)
|
||||
endif()
|
||||
CheckOSS()
|
||||
CheckALSA()
|
||||
@ -1459,6 +1467,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
|
||||
set(SDL_VIDEO_VULKAN 1)
|
||||
set(HAVE_VULKAN TRUE)
|
||||
endif()
|
||||
CheckQNXScreen()
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
@ -1709,6 +1718,13 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
|
||||
set(HAVE_RPATH TRUE)
|
||||
endif()
|
||||
|
||||
if(QNX)
|
||||
# QNX's *printf() family generates a SIGSEGV if NULL is passed for a string
|
||||
# specifier (on purpose), but SDL expects "(null)". Use the built-in
|
||||
# implementation.
|
||||
set(HAVE_VSNPRINTF 0)
|
||||
set(USE_POSIX_SPAWN 1)
|
||||
endif()
|
||||
elseif(WINDOWS)
|
||||
find_program(WINDRES windres)
|
||||
|
||||
|
@ -905,6 +905,22 @@ macro(CheckOpenGLES)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Requires:
|
||||
# - EGL
|
||||
macro(CheckQNXScreen)
|
||||
if(QNX AND HAVE_OPENGL_EGL)
|
||||
check_c_source_compiles("
|
||||
#include <screen/screen.h>
|
||||
int main (int argc, char** argv) { return 0; }" HAVE_QNX_SCREEN)
|
||||
if(HAVE_QNX_SCREEN)
|
||||
set(SDL_VIDEO_DRIVER_QNX 1)
|
||||
file(GLOB QNX_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/qnx/*.c)
|
||||
list(APPEND SOURCE_FILES ${QNX_VIDEO_SOURCES})
|
||||
list(APPEND EXTRA_LIBS screen EGL)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# Requires:
|
||||
# - nada
|
||||
# Optional:
|
||||
@ -955,6 +971,8 @@ macro(CheckPTHREAD)
|
||||
elseif(EMSCRIPTEN)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT -pthread")
|
||||
set(PTHREAD_LDFLAGS "-pthread")
|
||||
elseif(QNX)
|
||||
# pthread support is baked in
|
||||
else()
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "-lpthread")
|
||||
|
@ -28,6 +28,8 @@ macro(SDL_DetectCMakePlatform)
|
||||
set(SDL_CMAKE_PLATFORM AIX)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
|
||||
set(SDL_CMAKE_PLATFORM MINIX)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "QNX")
|
||||
set(SDL_CMAKE_PLATFORM QNX)
|
||||
endif()
|
||||
elseif(APPLE)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
|
||||
|
Loading…
Reference in New Issue
Block a user