From 35afe7722f304cc5682b0367f79692e0de0addba Mon Sep 17 00:00:00 2001 From: tovjemam Date: Mon, 4 Aug 2025 16:24:31 +0200 Subject: [PATCH] Fix SDL --- .gitmodules | 4 ++++ CMakeLists.txt | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f74caa5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "external/SDL"] + path = external/SDL + url = https://github.com/libsdl-org/SDL.git + branch = release-2.32.x diff --git a/CMakeLists.txt b/CMakeLists.txt index 22bb653..b444416 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,12 @@ if(EMSCRIPTEN) ) else() # Native platform - find_package(SDL2 REQUIRED) - target_include_directories(PortalGame PRIVATE ${SDL2_INCLUDE_DIRS}) - target_link_libraries(PortalGame PRIVATE ${SDL2_LIBRARIES}) + # find_package(SDL2 REQUIRED) + # SDL2 build options to avoid unwanted components + set(SDL_TEST OFF CACHE BOOL "" FORCE) + set(SDL_SHARED OFF CACHE BOOL "" FORCE) + set(SDL_STATIC ON CACHE BOOL "" FORCE) + add_subdirectory(external/SDL) + target_include_directories(PortalGame PRIVATE "external/SDL/include") + target_link_libraries(PortalGame PRIVATE SDL2main SDL2-static) endif()