Skip to content

Commit 07db29e

Browse files
authored
Merge pull request #194 from hwsmm/fix-build
Fix Windows builds
2 parents 20e10af + 2f7c96d commit 07db29e

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

External/build.sh

+21-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/bin/bash
22

3-
pushd "$(dirname "$0")" >/dev/null
3+
set -e
4+
5+
pushd "$(dirname "$0")"
46

57
# Check if environment variables are defined
68
if [[ -z $NAME || -z $RUNNER_OS || -z $FLAGS ]]; then
79
echo "One or more required environment variables are not defined."
810
exit 1
911
fi
1012

11-
SUDO=$(which sudo)
13+
SUDO=$(which sudo || exit 0)
1214

1315
if [[ $RUNNER_OS == 'Linux' ]]; then
1416
# Setup Linux dependencies
@@ -34,22 +36,22 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
3436
$SUDO apt-get install -y \
3537
$GCC \
3638
$GPP \
37-
git \
39+
git \
3840
cmake \
3941
ninja-build \
4042
wayland-scanner++ \
4143
wayland-protocols \
42-
meson \
44+
meson \
4345
pkg-config$TARGET_APT_ARCH \
4446
libasound2-dev$TARGET_APT_ARCH \
4547
libdbus-1-dev$TARGET_APT_ARCH \
4648
libegl1-mesa-dev$TARGET_APT_ARCH \
4749
libgl1-mesa-dev$TARGET_APT_ARCH \
4850
libgles2-mesa-dev$TARGET_APT_ARCH \
4951
libglu1-mesa-dev$TARGET_APT_ARCH \
50-
libgtk-3-dev$TARGET_APT_ARCH \
52+
libgtk-3-dev$TARGET_APT_ARCH \
5153
libibus-1.0-dev$TARGET_APT_ARCH \
52-
libpango1.0-dev$TARGET_APT_ARCH \
54+
libpango1.0-dev$TARGET_APT_ARCH \
5355
libpulse-dev$TARGET_APT_ARCH \
5456
libsndio-dev$TARGET_APT_ARCH \
5557
libudev-dev$TARGET_APT_ARCH \
@@ -72,9 +74,9 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
7274
if [[ $TARGET_APT_ARCH != :i386 ]]; then
7375
# Build libdecor.
7476
# This is required so that window decorations can work on wayland.
75-
# The support will only be enabled in SDL, but we're not shipping the libdecor binaries
76-
# because making them work from a c# app as everything else does (via runtimes) is too difficult.
77-
# Also skip i386 because attempting to support this for i386 is a pain.
77+
# The support will only be enabled in SDL, but we're not shipping the libdecor binaries
78+
# because making them work from a c# app as everything else does (via runtimes) is too difficult.
79+
# Also skip i386 because attempting to support this for i386 is a pain.
7880
# Special shoutouts to gnome for refusing to support server-side decorations.
7981
git clone https://gitlab.freedesktop.org/libdecor/libdecor.git
8082
cd libdecor
@@ -86,12 +88,18 @@ if [[ $RUNNER_OS == 'Linux' ]]; then
8688
fi
8789

8890
# Build SDL
89-
pushd SDL >/dev/null
90-
git reset --hard HEAD
91+
pushd SDL
92+
git reset --hard HEAD || echo "Failed to clean up the repository"
93+
94+
if [[ $RUNNER_OS == 'Windows' ]]; then
95+
echo "Patching SDL to not include gameinput.h"
96+
sed -i 's/#include <gameinput.h>/#_include <gameinput.h>/g' CMakeLists.txt
97+
fi
98+
9199
cmake -B build $FLAGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSDL_SHARED_ENABLED_BY_DEFAULT=ON -DSDL_STATIC_ENABLED_BY_DEFAULT=ON
92100
cmake --build build/ --config Release
93101
$SUDO cmake --install build/ --prefix install_output --config Release
94-
popd >/dev/null
102+
popd
95103

96104
# Move build lib into correct folders
97105
if [[ $RUNNER_OS == 'Windows' ]]; then
@@ -102,4 +110,4 @@ elif [[ $RUNNER_OS == 'macOS' ]]; then
102110
cp SDL/install_output/lib/libSDL3.dylib ../native/$NAME/libSDL3.dylib
103111
fi
104112

105-
popd >/dev/null
113+
popd

0 commit comments

Comments
 (0)