Skip to content

Commit c3d8ce5

Browse files
committed
SDL: Initial SDL3 port!
This work was done on YouTube: https://youtu.be/i3yVqWYFbCE
1 parent 44621cb commit c3d8ce5

File tree

2 files changed

+216
-291
lines changed

2 files changed

+216
-291
lines changed

CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,16 +173,26 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
173173
endif()
174174

175175
if(DIRKSIMPLE_SDL)
176-
find_package(SDL2 REQUIRED)
176+
if (EMSCRIPTEN)
177+
# FetchContent downloads and configures dependencies
178+
include(FetchContent)
179+
FetchContent_Declare(
180+
SDL3
181+
GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git"
182+
GIT_TAG "main"
183+
EXCLUDE_FROM_ALL
184+
)
185+
FetchContent_MakeAvailable(SDL3)
186+
else()
187+
find_package(SDL3 REQUIRED)
188+
endif()
177189
add_executable(dirksimple dirksimple.c dirksimple_sdl.c)
178190
target_include_directories(dirksimple PRIVATE
179-
${SDL2_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR}
180191
thirdparty/lua/src
181192
thirdparty/theoraplay
182193
thirdparty/lodepng
183194
)
184-
target_link_libraries(dirksimple ${SDL2_LIBRARIES} ${SDL2_LIBRARY})
185-
target_link_libraries(dirksimple dirksimple-theoraplay dirksimple-theora dirksimple-vorbis dirksimple-ogg dirksimple-lodepng dirksimple-lua)
195+
target_link_libraries(dirksimple SDL3::SDL3 dirksimple-theoraplay dirksimple-theora dirksimple-vorbis dirksimple-ogg dirksimple-lodepng dirksimple-lua)
186196
if(USE_PTHREAD)
187197
target_link_libraries(dirksimple pthread)
188198
endif()

0 commit comments

Comments
 (0)