Skip to content

Commit cb1f7c2

Browse files
committed
#2595: crash fix
1 parent 68ff5c5 commit cb1f7c2

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

cmake/sdl.cmake

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI)
1212
set(SDL_STATIC_PIC ON CACHE BOOL "" FORCE)
1313
endif()
1414

15-
set(SDL_SHARED OFF CACHE BOOL "" FORCE)
16-
1715
add_subdirectory(${THIRDPARTY_DIR}/sdl2)
1816

1917
endif()
@@ -41,7 +39,13 @@ if(BUILD_SDL AND BUILD_PLAYER AND NOT RPI)
4139
target_link_options(player-sdl PRIVATE -static)
4240
endif()
4341

44-
target_link_libraries(player-sdl PRIVATE tic80core SDL2main SDL2-static)
42+
target_link_libraries(player-sdl PRIVATE tic80core SDL2main)
43+
44+
if(BUILD_STATIC)
45+
target_link_libraries(player-sdl PRIVATE SDL2-static)
46+
else()
47+
target_link_libraries(player-sdl PRIVATE SDL2)
48+
endif()
4549
endif()
4650

4751
################################
@@ -113,7 +117,11 @@ if(ANDROID)
113117
endif()
114118

115119
if(NOT EMSCRIPTEN)
116-
target_link_libraries(sdlgpu SDL2-static)
120+
if(BUILD_STATIC)
121+
target_link_libraries(sdlgpu SDL2-static)
122+
else()
123+
target_link_libraries(sdlgpu SDL2)
124+
endif()
117125
endif()
118126

119127
endif()
@@ -184,7 +192,11 @@ if(BUILD_SDL)
184192
elseif(RPI)
185193
target_link_libraries(tic80 libSDL2.a bcm_host pthread)
186194
else()
187-
target_link_libraries(tic80 SDL2-static)
195+
if(BUILD_STATIC)
196+
target_link_libraries(tic80 SDL2-static)
197+
else()
198+
target_link_libraries(tic80 SDL2)
199+
endif()
188200
endif()
189201
endif()
190202

0 commit comments

Comments
 (0)