From d8451cdc3db0cec5c6092f48dff64937c4e07db1 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Wed, 24 Dec 2025 10:27:38 +0000 Subject: [PATCH 01/10] Use SDL3 imported target for linking --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ec2cfd..8ca4838 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ add_executable(sdl3_app src/script/cube_script.cpp ) target_include_directories(sdl3_app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src") - target_link_libraries(sdl3_app PRIVATE sdl::sdl Vulkan::Vulkan lua::lua CLI11::CLI11 rapidjson assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) + target_link_libraries(sdl3_app PRIVATE SDL3::SDL3 Vulkan::Vulkan lua::lua CLI11::CLI11 rapidjson assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) target_compile_definitions(sdl3_app PRIVATE SDL_MAIN_HANDLED) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") @@ -112,5 +112,5 @@ add_executable(cube_script_tests src/app/audio_player.cpp ) target_include_directories(cube_script_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src") -target_link_libraries(cube_script_tests PRIVATE sdl::sdl lua::lua assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) +target_link_libraries(cube_script_tests PRIVATE SDL3::SDL3 lua::lua assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) add_test(NAME cube_script_tests COMMAND cube_script_tests) From 2af92f67e4aa598f9af66ce9daad06692779594e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 10:30:37 +0000 Subject: [PATCH 02/10] Initial plan From 4ea38f7d3fb4412d9933e56199747c54f70a579c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 10:34:08 +0000 Subject: [PATCH 03/10] Add USE_SDL3 option to parameterize SDL version Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ca4838..03ee56e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,7 @@ if(ENABLE_CLANG_TIDY) endif() endif() option(BUILD_SDL3_APP "Build the SDL3 Vulkan demo" ON) +option(USE_SDL3 "Use SDL3 instead of SDL2" ON) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -71,8 +72,16 @@ endif() if(BUILD_SDL3_APP) find_package(Vulkan REQUIRED) - find_package(SDL3 CONFIG REQUIRED) endif() + +if(USE_SDL3) + find_package(SDL3 CONFIG REQUIRED) + set(SDL_TARGET SDL3::SDL3) +else() + find_package(SDL2 CONFIG REQUIRED) + set(SDL_TARGET SDL2::SDL2) +endif() + find_package(lua CONFIG REQUIRED) find_package(CLI11 CONFIG REQUIRED) find_package(rapidjson CONFIG REQUIRED) @@ -97,7 +106,7 @@ add_executable(sdl3_app src/script/cube_script.cpp ) target_include_directories(sdl3_app PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src") - target_link_libraries(sdl3_app PRIVATE SDL3::SDL3 Vulkan::Vulkan lua::lua CLI11::CLI11 rapidjson assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) + target_link_libraries(sdl3_app PRIVATE ${SDL_TARGET} Vulkan::Vulkan lua::lua CLI11::CLI11 rapidjson assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) target_compile_definitions(sdl3_app PRIVATE SDL_MAIN_HANDLED) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") @@ -112,5 +121,5 @@ add_executable(cube_script_tests src/app/audio_player.cpp ) target_include_directories(cube_script_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src") -target_link_libraries(cube_script_tests PRIVATE SDL3::SDL3 lua::lua assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) +target_link_libraries(cube_script_tests PRIVATE ${SDL_TARGET} lua::lua assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) add_test(NAME cube_script_tests COMMAND cube_script_tests) From 72bbea3caa111aef75ae353348ef8c363b83606b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 10:35:50 +0000 Subject: [PATCH 04/10] Improve USE_SDL3 option documentation and add clarifying comment Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 03ee56e..ce7e3b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ if(ENABLE_CLANG_TIDY) endif() endif() option(BUILD_SDL3_APP "Build the SDL3 Vulkan demo" ON) -option(USE_SDL3 "Use SDL3 instead of SDL2" ON) +option(USE_SDL3 "Use SDL3 instead of SDL2 for both the demo and tests" ON) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -74,6 +74,7 @@ if(BUILD_SDL3_APP) find_package(Vulkan REQUIRED) endif() +# SDL is required for both the demo app and cube_script_tests (used by audio_player) if(USE_SDL3) find_package(SDL3 CONFIG REQUIRED) set(SDL_TARGET SDL3::SDL3) From 8f727ab315ce81415bac0491cabf7ad1014cd285 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 11:16:52 +0000 Subject: [PATCH 05/10] Change SDL version selection to support SDL3, SDL2, and sdl Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce7e3b9..80014fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) From 35cda019fa4b727601f99d0519735aba43349e51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 11:31:52 +0000 Subject: [PATCH 06/10] Remove SDL2 option, keep only SDL3 and sdl Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com> --- CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80014fa..887cb1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,8 @@ if(ENABLE_CLANG_TIDY) endif() endif() option(BUILD_SDL3_APP "Build the SDL3 Vulkan demo" 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(SDL_VERSION "SDL3" CACHE STRING "SDL version to use: SDL3 or sdl") +set_property(CACHE SDL_VERSION PROPERTY STRINGS "SDL3" "sdl") set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -79,14 +79,11 @@ endif() if(SDL_VERSION STREQUAL "SDL3") find_package(SDL3 CONFIG REQUIRED) set(SDL_TARGET SDL3::SDL3) -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") + message(FATAL_ERROR "Invalid SDL_VERSION: ${SDL_VERSION}. Must be SDL3 or sdl") endif() find_package(lua CONFIG REQUIRED) From 12003b41a5cd60dfefd8683dc9c502e2c52e20da Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Dec 2025 11:47:40 +0000 Subject: [PATCH 07/10] Initial plan From 860a455027007583c8857f1b9986f51a9dcf9197 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Wed, 24 Dec 2025 11:50:41 +0000 Subject: [PATCH 08/10] Build CI artifacts for both SDL package names --- .github/workflows/package-release.yml | 22 ++++++++++++++++----- .github/workflows/upload-build-artifact.yml | 22 ++++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml index 1c0e350..d869ee3 100644 --- a/.github/workflows/package-release.yml +++ b/.github/workflows/package-release.yml @@ -13,18 +13,30 @@ jobs: fail-fast: false matrix: include: - - name: linux-amd64 + - name: linux-amd64-sdl3 runner: ubuntu-24.04 platform: linux arch: amd64 - - name: linux-arm64 + sdl_version: SDL3 + - name: linux-arm64-sdl3 runner: ubuntu-24.04-arm64 platform: linux arch: arm64 + sdl_version: SDL3 + - name: linux-amd64-sdl + runner: ubuntu-24.04 + platform: linux + arch: amd64 + sdl_version: sdl + - name: linux-arm64-sdl + runner: ubuntu-24.04-arm64 + platform: linux + arch: arm64 + sdl_version: sdl runs-on: ${{ matrix.runner }} env: - BUILD_DIR: build/${{ matrix.platform }}-${{ matrix.arch }} - ZIP_NAME: sdl3_app-${{ matrix.platform }}-${{ matrix.arch }}.zip + BUILD_DIR: build/${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.sdl_version }} + ZIP_NAME: sdl3_app-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.sdl_version }}.zip PLATFORM_NAME: ${{ matrix.platform }} steps: - name: Checkout @@ -33,7 +45,7 @@ jobs: - name: Download build artifact uses: actions/download-artifact@v4 with: - name: build-${{ matrix.platform }}-${{ matrix.arch }} + name: build-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.sdl_version }} path: . - name: Set up Python diff --git a/.github/workflows/upload-build-artifact.yml b/.github/workflows/upload-build-artifact.yml index 1ee901c..988e20e 100644 --- a/.github/workflows/upload-build-artifact.yml +++ b/.github/workflows/upload-build-artifact.yml @@ -12,15 +12,25 @@ jobs: fail-fast: false matrix: include: - - name: linux-amd64 + - name: linux-amd64-sdl3 platform: linux arch: amd64 - - name: linux-arm64 + sdl_version: SDL3 + - name: linux-arm64-sdl3 platform: linux arch: arm64 + sdl_version: SDL3 + - name: linux-amd64-sdl + platform: linux + arch: amd64 + sdl_version: sdl + - name: linux-arm64-sdl + platform: linux + arch: arm64 + sdl_version: sdl runs-on: ubuntu-24.04 env: - BUILD_DIR: build/${{ matrix.platform }}-${{ matrix.arch }} + BUILD_DIR: build/${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.sdl_version }} steps: - name: Checkout uses: actions/checkout@v4 @@ -49,20 +59,22 @@ jobs: if: matrix.platform == 'linux' env: BUILD_DIR: ${{ env.BUILD_DIR }} + SDL_VERSION: ${{ matrix.sdl_version }} run: | docker run --rm \ -e BUILD_DIR \ + -e SDL_VERSION \ -w /workspace \ -v "${{ github.workspace }}:/workspace" \ sdl3_app:${{ matrix.platform }}-${{ matrix.arch }} \ bash -c 'set -euo pipefail if [ -d "$BUILD_DIR" ]; then rm -rf "$BUILD_DIR"; fi cp -a /conan_build "$BUILD_DIR" - cmake -S . -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release + cmake -S . -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Release -DSDL_VERSION="$SDL_VERSION" cmake --build "$BUILD_DIR" --config Release' - name: Upload build artifact uses: actions/upload-artifact@v4 with: - name: build-${{ matrix.platform }}-${{ matrix.arch }} + name: build-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.sdl_version }} path: ${{ env.BUILD_DIR }} From dfff364ffe37d80ab4e489a25201bf363814afe4 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Wed, 24 Dec 2025 12:02:43 +0000 Subject: [PATCH 09/10] Skip SDL3 app when using sdl package --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a207564..cef9fbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,11 @@ option(BUILD_SDL3_APP "Build the SDL3 Vulkan demo" ON) set(SDL_VERSION "SDL3" CACHE STRING "SDL version to use: SDL3 or sdl") set_property(CACHE SDL_VERSION PROPERTY STRINGS "SDL3" "sdl") +if(BUILD_SDL3_APP AND NOT SDL_VERSION STREQUAL "SDL3") + message(STATUS "Disabling BUILD_SDL3_APP because SDL_VERSION is set to '${SDL_VERSION}' instead of SDL3") + set(BUILD_SDL3_APP OFF CACHE BOOL "Build the SDL3 Vulkan demo" FORCE) +endif() + set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) From 3b5bcfc82d896b371f2fcae61b56f788252b8d1f Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Wed, 24 Dec 2025 12:02:51 +0000 Subject: [PATCH 10/10] Guard asset copies with existence checks --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cef9fbf..be587f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,8 +118,13 @@ if(BUILD_SDL3_APP) target_link_libraries(sdl3_app PRIVATE ${SDL_TARGET} Vulkan::Vulkan lua::lua CLI11::CLI11 rapidjson assimp::assimp Bullet::Bullet glm::glm Vorbis::vorbisfile Vorbis::vorbis) target_compile_definitions(sdl3_app PRIVATE SDL_MAIN_HANDLED) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/scripts" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/shaders") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/shaders" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + endif() + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/scripts") + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/scripts" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") + endif() endif() enable_testing()