-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
49 lines (39 loc) · 1.2 KB
/
build.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
# exit on error
set -e
BUILD_TYPE="release"
WITH_PORTABLE_RESOURCES="OFF"
for arg in "$@"; do
if [ "$arg" == "--debug" ]; then
BUILD_TYPE="debug"
fi
done
BINARY_DIR="build/$BUILD_TYPE/"
PROJECT_EXECUTABLE_PATH="${BINARY_DIR}apps/"
cmake --preset "$BUILD_TYPE" \
-D CMAKE_TOOLCHAIN_FILE="../../dep/vcpkg/scripts/buildsystems/vcpkg.cmake" \
-D VCPKG_MANIFEST_INSTALL=ON \
-D WITH_PORTABLE_RESOURCES="$WITH_PORTABLE_RESOURCES"
if [ $? -ne 0 ]; then
echo "cmake config failed"
exit 1
fi
mkdir -p "$BINARY_DIR"
cmake --build "$BINARY_DIR"
if [ $? -ne 0 ]; then
echo "build failed"
exit 1
fi
# This logic is moved to CMakeLists.txt for cross-platform compatibility
# echo copy compile_commands.json to .vscode folder
# cp "$BINARY_DIR/compile_commands.json" ".vscode/"
if [ "$WITH_PORTABLE_RESOURCES" == "ON" ]; then
echo
echo "copy resources folder for portable build"
RESOURCES_PATH="${PROJECT_EXECUTABLE_PATH}resources/"
rm -rf "$RESOURCES_PATH"
mkdir -p "$RESOURCES_PATH"
cp -r "resources/"* "$RESOURCES_PATH"
fi
# Run the application
# The equivalent of start /wait /b is to just run the executable in the current shell
./$PROJECT_EXECUTABLE_PATH/run