From 8e3f95a0fcfa86dc362853d44b0182994a5800da Mon Sep 17 00:00:00 2001 From: Vadim Grigoruk Date: Sat, 25 May 2024 15:35:56 +0200 Subject: [PATCH] #2595: crash fix (#2599) --- cmake/sdl.cmake | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/cmake/sdl.cmake b/cmake/sdl.cmake index 2b4d8e6fc..8fbd8f02c 100644 --- a/cmake/sdl.cmake +++ b/cmake/sdl.cmake @@ -12,8 +12,6 @@ if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI) set(SDL_STATIC_PIC ON CACHE BOOL "" FORCE) endif() - set(SDL_SHARED OFF CACHE BOOL "" FORCE) - add_subdirectory(${THIRDPARTY_DIR}/sdl2) endif() @@ -41,7 +39,13 @@ if(BUILD_SDL AND BUILD_PLAYER AND NOT RPI) target_link_options(player-sdl PRIVATE -static) endif() - target_link_libraries(player-sdl PRIVATE tic80core SDL2main SDL2-static) + target_link_libraries(player-sdl PRIVATE tic80core SDL2main) + + if(BUILD_STATIC) + target_link_libraries(player-sdl PRIVATE SDL2-static) + else() + target_link_libraries(player-sdl PRIVATE SDL2) + endif() endif() ################################ @@ -113,7 +117,11 @@ if(ANDROID) endif() if(NOT EMSCRIPTEN) - target_link_libraries(sdlgpu SDL2-static) + if(BUILD_STATIC) + target_link_libraries(sdlgpu SDL2-static) + else() + target_link_libraries(sdlgpu SDL2) + endif() endif() endif() @@ -184,7 +192,11 @@ if(BUILD_SDL) elseif(RPI) target_link_libraries(tic80 libSDL2.a bcm_host pthread) else() - target_link_libraries(tic80 SDL2-static) + if(BUILD_STATIC) + target_link_libraries(tic80 SDL2-static) + else() + target_link_libraries(tic80 SDL2) + endif() endif() endif()