all variants (windows/linux)(static/dynamic) now work
This commit is contained in:
@@ -18,6 +18,13 @@ message(STATUS "Build config: PLATFORM=${PLATFORM}, SDL_LINK_TYPE=${SDL_LINK_TYP
|
|||||||
# --- Resolve SDL ---
|
# --- Resolve SDL ---
|
||||||
include(cmake/SDLSetup.cmake)
|
include(cmake/SDLSetup.cmake)
|
||||||
|
|
||||||
|
# --- Apply Linux dynamic RPATH globally so all targets can find libSDL3.so.0
|
||||||
|
# at runtime. SDL_LINUX_RPATH is set by SDLSetup.cmake only on Linux + dynamic.
|
||||||
|
if(DEFINED SDL_LINUX_RPATH)
|
||||||
|
message(STATUS "Setting CMAKE_BUILD_RPATH to: ${SDL_LINUX_RPATH}")
|
||||||
|
set(CMAKE_BUILD_RPATH "${SDL_LINUX_RPATH}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# --- Subdirectories ---
|
# --- Subdirectories ---
|
||||||
add_subdirectory(engine)
|
add_subdirectory(engine)
|
||||||
add_subdirectory(game)
|
add_subdirectory(game)
|
||||||
@@ -30,7 +30,18 @@ if(SDL_LINK_TYPE STREQUAL "dynamic" AND WIN32)
|
|||||||
add_custom_target(copy_sdl_dll ALL
|
add_custom_target(copy_sdl_dll ALL
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
$<TARGET_FILE:SDL3::SDL3>
|
$<TARGET_FILE:SDL3::SDL3>
|
||||||
"${CMAKE_BINARY_DIR}/game"
|
"${CMAKE_BINARY_DIR}/game/$<TARGET_FILE_NAME:SDL3::SDL3>"
|
||||||
COMMENT "Copying SDL3.dll to output directory"
|
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()
|
endif()
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
/* #undef SDL_VENDOR_INFO */
|
/* #undef SDL_VENDOR_INFO */
|
||||||
|
|
||||||
#ifdef SDL_VENDOR_INFO
|
#ifdef SDL_VENDOR_INFO
|
||||||
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-501-gf3a3b4b95 (" SDL_VENDOR_INFO ")"
|
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-502-gf4255e15b (" SDL_VENDOR_INFO ")"
|
||||||
#else
|
#else
|
||||||
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-501-gf3a3b4b95"
|
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-502-gf4255e15b"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* SDL_revision_h_ */
|
#endif /* SDL_revision_h_ */
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
libSDL3.so.0.5.0
|
libSDL3.so.0.5
|
||||||
1
prebuilt/linux/SDL3-dynamic/lib/libSDL3.so.0.5
Symbolic link
1
prebuilt/linux/SDL3-dynamic/lib/libSDL3.so.0.5
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
libSDL3.so.0.5.0
|
||||||
Binary file not shown.
@@ -31,9 +31,9 @@
|
|||||||
/* #undef SDL_VENDOR_INFO */
|
/* #undef SDL_VENDOR_INFO */
|
||||||
|
|
||||||
#ifdef SDL_VENDOR_INFO
|
#ifdef SDL_VENDOR_INFO
|
||||||
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-501-gf3a3b4b95 (" SDL_VENDOR_INFO ")"
|
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-502-gf4255e15b (" SDL_VENDOR_INFO ")"
|
||||||
#else
|
#else
|
||||||
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-501-gf3a3b4b95"
|
#define SDL_REVISION "SDL-3.5.0-release-3.4.0-502-gf4255e15b"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* SDL_revision_h_ */
|
#endif /* SDL_revision_h_ */
|
||||||
|
|||||||
Binary file not shown.
@@ -39,6 +39,32 @@ build_sdl() {
|
|||||||
echo "=== Done: $OUT_DIR ==="
|
echo "=== Done: $OUT_DIR ==="
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_dynamic_symlinks() {
|
||||||
|
local LIB_DIR="$PREBUILT_DIR/SDL3-dynamic/lib"
|
||||||
|
|
||||||
|
local REAL_FILE
|
||||||
|
REAL_FILE="$(find "$LIB_DIR" -maxdepth 1 -name 'libSDL3.so.*.*' | head -1)"
|
||||||
|
|
||||||
|
if [ -z "$REAL_FILE" ]; then
|
||||||
|
echo "ERROR: No versioned libSDL3.so file found in $LIB_DIR" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local REAL_NAME
|
||||||
|
REAL_NAME="$(basename "$REAL_FILE")"
|
||||||
|
local SONAME="${REAL_NAME%.*}"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Creating SDL3 symlinks in $LIB_DIR ==="
|
||||||
|
echo " $SONAME -> $REAL_NAME"
|
||||||
|
echo " libSDL3.so -> $SONAME"
|
||||||
|
|
||||||
|
ln -sf "$REAL_NAME" "$LIB_DIR/$SONAME"
|
||||||
|
ln -sf "$SONAME" "$LIB_DIR/libSDL3.so"
|
||||||
|
|
||||||
|
echo "=== Done ==="
|
||||||
|
}
|
||||||
|
|
||||||
# Install build dependencies if needed (Debian 12 bookworm)
|
# Install build dependencies if needed (Debian 12 bookworm)
|
||||||
echo "Checking build dependencies..."
|
echo "Checking build dependencies..."
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
@@ -50,4 +76,9 @@ sudo apt-get install -y --no-install-recommends \
|
|||||||
libgl1-mesa-dev
|
libgl1-mesa-dev
|
||||||
|
|
||||||
build_sdl "dynamic"
|
build_sdl "dynamic"
|
||||||
build_sdl "static"
|
build_sdl "static"
|
||||||
|
|
||||||
|
# Always recreate symlinks regardless of whether the build was a no-op.
|
||||||
|
# cmake --install does not preserve symlinks and Ninja may skip the build
|
||||||
|
# entirely if sources are unchanged, leaving the lib directory without them.
|
||||||
|
create_dynamic_symlinks
|
||||||
Reference in New Issue
Block a user