-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·54 lines (42 loc) · 1.24 KB
/
build.sh
File metadata and controls
executable file
·54 lines (42 loc) · 1.24 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
#!/bin/bash
# Hint: Run 'chmod +x build.sh' to make this script executable.
# Then you can run './build.sh' to execute it
# and you'll avoid error like build.sh: 26: [[: not found
BASEDIR="$(cd "$(dirname "$0")" && pwd)"
BUILD_DIR="../$(basename ${BASEDIR})_build"
CLEAN_BUILD=false
THREADS_COUNT=4
usage() {
echo "Usage: ./build.sh [options]"
echo "Options:"
echo " -c, --clean Clean the build directory"
echo " -t <n>, --threads <n> Set the number of threads for building (default: 4)"
exit 1
}
unknown_option() {
echo "Error: Unknown option $1"
usage
exit 1 # Add exit 1 to terminate the script
}
while [[ "$#" -gt 0 ]]; do
case $1 in
-c|--clean) CLEAN_BUILD=true;;
-t|--threads) THREADS_COUNT="$2"; shift;;
-h|--help) usage;;
*) echo "Error: Unknown option $1"; usage;;
esac
shift
done
echo "build.sh script location: ${BASEDIR}"
cd ${BASEDIR}
if [ "$CLEAN_BUILD" = true ]; then
echo "Cleaning build directory..."
rm -rf "${BUILD_DIR:?}"
fi
mkdir -p "${BUILD_DIR:?}"
echo "Build directory: ${BUILD_DIR}"
cd ${BUILD_DIR}
cmake ${BASEDIR}
make -j${THREADS_COUNT}
# in case You want to run app immediately after compiling uncomment line below
#./R2F-MessengerServer