forked from NVIDIA/Audio2Face-3D-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·68 lines (53 loc) · 1.62 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·68 lines (53 loc) · 1.62 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
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
set -e # Exit on any error
# Set the default build configuration to release
BUILD_CONFIG="release"
# Set the default build project to all
BUILD_PROJECT="all"
# Select the build configuration and the project to build in arbitrary order.
if [ "$1" = "release" ] || [ "$1" = "debug" ]; then
BUILD_CONFIG="$1"
if [ -n "$2" ]; then
BUILD_PROJECT="$2"
fi
else
BUILD_PROJECT="$1"
if [ -n "$2" ]; then
BUILD_CONFIG="$2"
fi
fi
BASE_DIR="$(dirname ${BASH_SOURCE})"
BUILD_DIR="${BASE_DIR}/_build/${BUILD_CONFIG}"
export PATH="$PATH:${BASE_DIR}/_deps/build-deps/ninja"
CMAKE="${BASE_DIR}/_deps/build-deps/cmake/bin/cmake"
# Set the default build configuration to release
BUILD_CONFIG="release"
# Check if a build configuration was provided as an argument
if [ -n "$2" ]; then
BUILD_CONFIG="$2"
fi
BUILD_DIR="${BASE_DIR}/_build/${BUILD_CONFIG}"
BUILD_PROJECT="all"
if [ "$1" = "clean" ]; then
rm -rf "$BUILD_DIR"
exit 0
fi
if [ ! -d "${BASE_DIR}/_deps" ]; then
echo "Dependencies not found. Please run ./fetch_deps.sh ${BUILD_CONFIG} first."
exit 1
fi
if [ ! -d "$BUILD_DIR" ]; then
mkdir -p "$BUILD_DIR"
fi
# Check if cmake exists
if [ ! -f "$CMAKE" ]; then
echo "CMake not found at $CMAKE. Please ensure dependencies are fetched."
exit 1
fi
# Check if ninja exists
if ! command -v ninja >/dev/null 2>&1; then
echo "Ninja not found in PATH. Please ensure dependencies are fetched."
exit 1
fi
"$CMAKE" -B "$BUILD_DIR" -G Ninja -S . -DCMAKE_BUILD_TYPE="${BUILD_CONFIG^}"
"$CMAKE" --build "$BUILD_DIR" --target "$BUILD_PROJECT" --config "$BUILD_CONFIG" --parallel