all variants (windows/linux)(static/dynamic) now work

This commit is contained in:
Colin Sames
2026-04-03 17:27:10 +02:00
parent 9e56634fd5
commit 7b07d01400
9 changed files with 57 additions and 7 deletions

View File

@@ -30,7 +30,18 @@ if(SDL_LINK_TYPE STREQUAL "dynamic" AND WIN32)
add_custom_target(copy_sdl_dll ALL
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:SDL3::SDL3>
"${CMAKE_BINARY_DIR}/game"
"${CMAKE_BINARY_DIR}/game/$<TARGET_FILE_NAME:SDL3::SDL3>"
COMMENT "Copying SDL3.dll to output directory"
)
endif()
# On Linux with dynamic linking, embed the absolute path to the prebuilt lib
# directory in the binary's RPATH. The prebuilt/linux directory is built
# in-place on Linux by build_sdl_linux.sh and is never synced from Windows,
# so the path is always valid on the remote machine.
if(SDL_LINK_TYPE STREQUAL "dynamic" AND UNIX AND NOT APPLE)
get_target_property(SDL3_SO_LOCATION SDL3::SDL3 LOCATION)
get_filename_component(SDL3_LIB_DIR "${SDL3_SO_LOCATION}" DIRECTORY)
message(STATUS "SDL3 runtime library directory: ${SDL3_LIB_DIR}")
set(SDL_LINUX_RPATH "${SDL3_LIB_DIR}" CACHE INTERNAL "")
endif()