Merge pull request #194 from hwsmm/fix-build

Fix Windows builds
This commit is contained in:
Dan Balasescu 2025-01-02 15:00:33 +09:00 committed by GitHub
commit 07db29ef06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 13 deletions

20
External/build.sh vendored
View File

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
pushd "$(dirname "$0")" >/dev/null set -e
pushd "$(dirname "$0")"
# Check if environment variables are defined # Check if environment variables are defined
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
@ -8,7 +10,7 @@ if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
exit 1 exit 1
fi fi
SUDO=$(which sudo) SUDO=$(which sudo || exit 0)
if [[ $RUNNER_OS == 'Linux' ]]; then if [[ $RUNNER_OS == 'Linux' ]]; then
# Setup Linux dependencies # Setup Linux dependencies
@ -86,12 +88,18 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
fi fi
# Build SDL # Build SDL
pushd SDL >/dev/null pushd SDL
git reset --hard HEAD git reset --hard HEAD || echo "Failed to clean up the repository"
if [[ $RUNNER_OS == 'Windows' ]]; then
echo "Patching SDL to not include gameinput.h"
sed -i 's/#include <gameinput.h>/#_include <gameinput.h>/g' CMakeLists.txt
fi
cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
cmake --build build/ --config Release cmake --build build/ --config Release
$SUDO cmake --install build/ --prefix install_output --config Release $SUDO cmake --install build/ --prefix install_output --config Release
popd >/dev/null popd
# Move build lib into correct folders # Move build lib into correct folders
if [[ $RUNNER_OS == 'Windows' ]]; then if [[ $RUNNER_OS == 'Windows' ]]; then
@ -102,4 +110,4 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then
cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib
fi fi
popd >/dev/null popd