-
Notifications
You must be signed in to change notification settings - Fork 3
/
sdl.sh
68 lines (57 loc) · 1.74 KB
/
sdl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Oliver Epper <oliver.epper@gmail.com>
set -e
if [ $# -eq 0 ]
then
echo "sh ./sdl.sh <absolute path>"
exit 1
fi
PREFIX=$1
SDL_VERSION=release-2.26.2
IOS_TOOLCHAIN_VERSION=4.3.0
if [ -d SDL ]
then
pushd SDL
git clean -fxd
git reset --hard $SDL_VERSION
popd
else
git -c advice.detachedHead=false clone --depth 1 --branch $SDL_VERSION https://github.com/libsdl-org/SDL.git
fi
if [ -d ios-cmake ]
then
pushd ios-cmake
git clean -fxd
git reset --hard $IOS_TOOLCHAIN_VERSION
popd
else
git -c advice.detachedHead=false clone --depth 1 --branch $IOS_TOOLCHAIN_VERSION https://github.com/leetal/ios-cmake.git
fi
function build {
local TOOLCHAIN_PLATFORM_NAME=$1
local INSTALL_PREFIX=$2
local DEPLOYMENT_TARGET=$3
echo "Building for platform ${TOOLCHAIN_PLATFORM_NAME} with deployment target ${DEPLOYMENT_TARGET}"
echo "Installing to: ${INSTALL_PREFIX}"
cmake -Bbuild/"${TOOLCHAIN_PLATFORM_NAME}" \
-SSDL \
-G Ninja \
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" \
-DCMAKE_TOOLCHAIN_FILE=../ios-cmake/ios.toolchain.cmake \
-DPLATFORM="${TOOLCHAIN_PLATFORM_NAME}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${DEPLOYMENT_TARGET}" \
-DENABLE_BITCODE=OFF \
-DSDL_HAPTIC=OFF \
-DSDL_HIDAPI_JOYSTICK=OFF \
-DSDL_SYSTEM_ICONV=OFF \
-DSDL_JOYSTICK=OFF &&
cmake --build build/"${TOOLCHAIN_PLATFORM_NAME}" \
--config Release \
--target install
}
# build for macOS on arm64
MACOS_ARM64_INSTALL_PREFIX="${PREFIX}/macos-arm64"
build MAC_ARM64 "${MACOS_ARM64_INSTALL_PREFIX}" 11.0
# build for macOS on x86_64
MACOS_X86_64_INSTALL_PREFIX="${PREFIX}/macos-x86_64"
build MAC "${MACOS_X86_64_INSTALL_PREFIX}" 11.0