Skip to content

Commit 465dc98

Browse files
committed
play with sdl3
1 parent 0833afa commit 465dc98

File tree

2 files changed

+18
-25
lines changed

2 files changed

+18
-25
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND USE_AUTO_VCPKG)
2727
endif()
2828

2929
vcpkg_bootstrap()
30-
vcpkg_install_packages(zlib bzip2 sdl2 glew)
30+
vcpkg_install_packages(zlib bzip2 glew)
3131
endif()
3232

3333
add_subdirectory("extern")

extern/CMakeLists.txt

+17-24
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,22 @@
11
find_package(OpenGL QUIET)
22

3-
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
4-
find_package(SDL2 CONFIG REQUIRED)
5-
elseif (NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
6-
find_package(SDL2 REQUIRED)
7-
endif()
8-
93
################################################################################
10-
# Find/download SDL2 for Android
4+
# Find/download SDL3
115
################################################################################
12-
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
13-
find_package(SDL2 QUIET)
14-
if (NOT ${SDL2_FOUND})
15-
include(FetchContent)
16-
FetchContent_Declare(
17-
SDL2
18-
GIT_REPOSITORY https://github.com/libsdl-org/SDL.git
19-
GIT_TAG release-2.28.1
20-
)
21-
message("SDL2 not found. Downloading now...")
22-
FetchContent_MakeAvailable(SDL2)
23-
message("SDL2 downloaded to " ${FETCHCONTENT_BASE_DIR}/sdl2-src)
24-
endif()
6+
find_package(SDL3 QUIET)
7+
if (NOT ${SDL3_FOUND})
8+
include(FetchContent)
9+
FetchContent_Declare(
10+
SDL3
11+
https://github.com/briaguya-ai/SDL.git
12+
GIT_TAG 2b09ae46442b659c4663a0dec9eb94ef3264abf5
13+
)
14+
message("SDL3 not found. Downloading now...")
15+
FetchContent_MakeAvailable(SDL3)
16+
message("SDL3 downloaded to " ${FETCHCONTENT_BASE_DIR}/sdl3-src)
2517
endif()
2618

19+
2720
#=================== DrLibs ===================
2821

2922
set(DRLIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dr_libs)
@@ -93,19 +86,19 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
9386
)
9487
endif()
9588

96-
target_include_directories(ImGui PUBLIC ${IMGUI_DIR} ${IMGUI_DIR}/backends PRIVATE ${SDL2_INCLUDE_DIRS})
89+
target_include_directories(ImGui PUBLIC ${IMGUI_DIR} ${IMGUI_DIR}/backends PRIVATE ${SDL3_INCLUDE_DIRS})
9790

9891
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
9992
target_include_directories(ImGui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/metal-cpp)
10093
target_compile_definitions(ImGui PUBLIC IMGUI_IMPL_METAL_CPP)
10194
endif()
10295

10396
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
104-
target_link_libraries(ImGui PUBLIC SDL2::SDL2 SDL2::SDL2main)
97+
target_link_libraries(ImGui PUBLIC SDL3::SDL3 SDL3::SDL3main)
10598
elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
106-
target_link_libraries(ImGui PUBLIC SDL2::SDL2-static)
99+
target_link_libraries(ImGui PUBLIC SDL3::SDL3-static)
107100
else()
108-
target_link_libraries(ImGui PUBLIC SDL2::SDL2)
101+
target_link_libraries(ImGui PUBLIC SDL3::SDL3)
109102
endif()
110103

111104
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")

0 commit comments

Comments
 (0)