Add CMake USE_INTERNAL_SDL option, defaulting to ON
This commit is contained in:
parent
f848f8ad8d
commit
2383bd1351
|
|
@ -25,6 +25,7 @@ option(USE_MUMBLE "Mumble support" ON)
|
|||
option(USE_FREETYPE "Freetype font rendering" OFF)
|
||||
|
||||
option(USE_INTERNAL_LIBS "Use internally packaged libraries" ON)
|
||||
option(USE_INTERNAL_SDL "Use internal SDL binary (if available)" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_ZLIB "Use internal copy of zlib" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_JPEG "Use internal copy of libjpeg" ${USE_INTERNAL_LIBS})
|
||||
option(USE_INTERNAL_OGG "Use internal copy of ogg" ${USE_INTERNAL_LIBS})
|
||||
|
|
|
|||
|
|
@ -2,16 +2,14 @@ set(INTERNAL_SDL_DIR ${SOURCE_DIR}/thirdparty/SDL2-2.32.8)
|
|||
|
||||
include(utils/arch)
|
||||
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
set(SYSTEM_SDL_REQUIRED REQUIRED)
|
||||
if(WIN32 OR APPLE)
|
||||
# On Windows and macOS we have internal SDL binaries we can use
|
||||
set(HAVE_INTERNAL_SDL true)
|
||||
endif()
|
||||
|
||||
find_package(SDL2 QUIET ${SYSTEM_SDL_REQUIRED})
|
||||
|
||||
if(NOT SDL2_FOUND)
|
||||
if(USE_INTERNAL_SDL AND HAVE_INTERNAL_SDL)
|
||||
set(SDL2_INCLUDE_DIRS ${INTERNAL_SDL_DIR}/include)
|
||||
|
||||
# On Windows and macOS we have internal SDL binaries we can use
|
||||
if(WIN32)
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
set(LIB_DIR ${SOURCE_DIR}/thirdparty/libs/win64)
|
||||
|
|
@ -39,8 +37,10 @@ if(NOT SDL2_FOUND)
|
|||
list(APPEND CLIENT_DEPLOY_LIBRARIES
|
||||
${SOURCE_DIR}/thirdparty/libs/macos/libSDL2-2.0.0.dylib)
|
||||
else()
|
||||
message(FATAL_ERROR "SDL2 not found and no internal binaries available")
|
||||
message(FATAL_ERROR "HAVE_INTERNAL_SDL set incorrectly; file a bug")
|
||||
endif()
|
||||
else()
|
||||
find_package(SDL2 REQUIRED)
|
||||
endif()
|
||||
|
||||
list(APPEND CLIENT_LIBRARIES ${SDL2_LIBRARIES})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user