-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_redist
executable file
·54 lines (45 loc) · 1.24 KB
/
build_redist
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
#!/usr/bin/env bash
SRC_DIR=$(pwd)
BUILD_DIR="$(pwd)/build.tmp"
function build_platform() {
TARGETS=$1
PLATFORM="$2"
SRC_DIR="$3"
BUILD_DIR="$4"
NCPU="$5"
# PLUGIN_DIR="$SRC_DIR/q4fms/$PLATFORM"
PLATFORM_DIR="$BUILD_DIR/$PLATFORM"
CMAKE_FLAGS=(
-DCMAKE_BUILD_TYPE=RelWithDbgInfo
)
if [ "$PLATFORM" == "win_x64" ]; then
CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="$SRC_DIR/XCompile.txt")
CMAKE_FLAGS+=(-DHOST=x86_64-w64-mingw32)
fi
mkdir -p "$PLATFORM_DIR"
(\
cd "$PLATFORM_DIR" && \
cmake "${CMAKE_FLAGS[@]}" "$SRC_DIR" && \
make "${TARGETS[@]}" -j $NCPUS \
) || exit 1
}
mkdir -p "$BUILD_DIR"
TARGETS=(avionics)
case $(uname) in
Linux)
NCPUS=$(( $(grep 'processor[[:space:]]\+:' /proc/cpuinfo | wc -l) + 1 ))
build_platform $TARGETS "lin_x64" "$SRC_DIR" "$BUILD_DIR" $NCPUS && \
build_platform $TARGETS "win_x64" "$SRC_DIR" "$BUILD_DIR" $NCPUS && \
rm -rf "$BUILD_DIR"
# rm -rf "$BUILD_DIR"
;;
Darwin)
NCPUS=$(( $(sysctl -n hw.ncpu) + 1 ))
build_platform $TARGETS "mac_x64" "$SRC_DIR" "$BUILD_DIR" $NCPUS && \
rm -rf "$BUILD_DIR"
;;
*)
echo "Unsupported build platform" >&2
exit 1
;;
esac