mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 21:55:09 +00:00
Change SDL version selection to support SDL3, SDL2, and sdl
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -51,7 +51,8 @@ if(ENABLE_CLANG_TIDY)
|
||||
endif()
|
||||
endif()
|
||||
option(BUILD_SDL3_APP "Build the SDL3 Vulkan demo" ON)
|
||||
option(USE_SDL3 "Use SDL3 instead of SDL2 for both the demo and tests" ON)
|
||||
set(SDL_VERSION "SDL3" CACHE STRING "SDL version to use: SDL3, SDL2, or sdl")
|
||||
set_property(CACHE SDL_VERSION PROPERTY STRINGS "SDL3" "SDL2" "sdl")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@@ -75,12 +76,17 @@ if(BUILD_SDL3_APP)
|
||||
endif()
|
||||
|
||||
# SDL is required for both the demo app and cube_script_tests (used by audio_player)
|
||||
if(USE_SDL3)
|
||||
if(SDL_VERSION STREQUAL "SDL3")
|
||||
find_package(SDL3 CONFIG REQUIRED)
|
||||
set(SDL_TARGET SDL3::SDL3)
|
||||
else()
|
||||
elseif(SDL_VERSION STREQUAL "SDL2")
|
||||
find_package(SDL2 CONFIG REQUIRED)
|
||||
set(SDL_TARGET SDL2::SDL2)
|
||||
elseif(SDL_VERSION STREQUAL "sdl")
|
||||
find_package(SDL CONFIG REQUIRED)
|
||||
set(SDL_TARGET SDL::SDL)
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid SDL_VERSION: ${SDL_VERSION}. Must be SDL3, SDL2, or sdl")
|
||||
endif()
|
||||
|
||||
find_package(lua CONFIG REQUIRED)
|
||||
|
||||
Reference in New Issue
Block a user