-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmake.sh
More file actions
54 lines (48 loc) · 942 Bytes
/
make.sh
File metadata and controls
54 lines (48 loc) · 942 Bytes
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
# Function to display usage
usage() {
echo "Usage: $0 -t <target_name> [-a <app_name>] [-r] [-c]"
exit 1
}
# Initialize variables
TARGET=""
APP=""
MODE="Debug"
CLEAN=0
# Parse command-line arguments
while getopts ":t:a:r:c:" opt; do
case ${opt} in
( t )
TARGET="$OPTARG"
;;
( a )
APP="$OPTARG"
;;
( \? )
echo "Invalid option: -$OPTARG" 1>&2
usage
;;
( : )
if [[ "$OPTARG" == "c" ]]; then
CLEAN=1
elif [[ "$OPTARG" == "r" ]]; then
MODE="Release"
else
echo "Option -$OPTARG requires an argument." 1>&2
usage
fi
;;
esac
done
# Check if the target name is provided
if [ -z "$TARGET" ]; then
usage
fi
if [ "$CLEAN" == 1 ]; then
echo "Performing clean build..."
rm -rf build/$TARGET
fi
cmake --preset=$TARGET -DTARGET_APP=$APP -DCMAKE_BUILD_TYPE=$MODE
pushd build/$TARGET
cmake --build .
popd