-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuildForDistribution.sh
More file actions
executable file
·44 lines (36 loc) · 1.16 KB
/
BuildForDistribution.sh
File metadata and controls
executable file
·44 lines (36 loc) · 1.16 KB
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
#!/usr/bin/env bash
set -eo pipefail
shopt -s globstar
shopt -s extglob
SRC_DIR=$PWD
BUILD_DIR=$1
if [ -z "$BUILD_DIR" ]; then
echo "No build folder specified, defaulting to \$PWD/build."
BUILD_DIR=$PWD/build
fi
BUILD_TYPE=$2
if [ -z "$BUILD_TYPE" ]; then
echo "No build type specified, defaulting to Release."
BUILD_TYPE="Release"
fi
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
clean_build_dir() {
if [ -d "$BUILD_DIR" ]; then
cd "$BUILD_DIR" # Make sure we don't break things by being in the wrong directory :)
rm -rf !(out|_deps|discord_game_sdk.@(so|dll)) _deps/!(sdl3*|*-src)/
fi
cd "$SRC_DIR"
}
clean_build_dir
for i in {1..4}; do
echo "---------- CONFIGURING x86_64 v$i ----------"
cmake -B "$BUILD_DIR" -DX86_64_VERSION=$i -DCMAKE_BUILD_TYPE="$BUILD_TYPE" $3
echo "---------- BUILDING x86_64 v$i ----------"
cmake --build "$BUILD_DIR" --target game $4
clean_build_dir
done
echo "---------- CONFIGURING Launcher ----------"
cmake -B "$BUILD_DIR" -DX86_64_VERSION=$i -DSTANDALONE_LAUNCHER=ON -DCMAKE_BUILD_TYPE="$BUILD_TYPE" $3
echo "---------- BUILDING Launcher ----------"
cmake --build "$BUILD_DIR" --target launcher $4
clean_build_dir