-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.sh
More file actions
executable file
·67 lines (42 loc) · 1.33 KB
/
compile.sh
File metadata and controls
executable file
·67 lines (42 loc) · 1.33 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
#!/bin/bash
source ./utils/inc/sh/colors.sh
COMPILATION_FILE_PATH=".private/dev/compilation.json"
PROJECT_INFO_PATH=".private/project.json"
cores=$(jq '.cores' $COMPILATION_FILE_PATH)
projectName=$(jq -r '.CMakeName' $PROJECT_INFO_PATH)
if [ ! -d "build" ]; then
mkdir build
fi
cd build/
if [[ "$1" == "--no-backup" ]] || [[ "$1" == "--no-bak" ]]; then
echo "${BOLD}${GREEN}[ INFO ] Continuing without executable backup${RESET}"
else
printf "${BOLD}${GREEN}[ INFO ] Backing up executable\n${RESET}"
exeBakPath="./exeBackup"
if [ ! -d "$exeBakPath" ]; then
mkdir -p "$exeBakPath"
fi
cp "$projectName" "$exeBakPath/$projectName-bak"
echo " [ Done ]"
fi
if [ "$1" == "" ]; then
cmake ..
elif [ "$1" == "--settings" ]; then
cd ..
echo "[ * ] Compilation settings"
echo -e "${BOLD}[ PROMPT ] Enter the number of cores to compile the program ${RESET}"
read cores
if [ ! -d "tmp" ]; then
echo -e "${BOLD}[ NOTE ] Creating \`tmp/\` dir"
mkdir tmp
fi
if [[ ! -s "$COMPILATION_FILE_PATH" ]]; then
echo "{}" > "$COMPILATION_FILE_PATH"
fi
jq ".cores = $cores" "$COMPILATION_FILE_PATH" > tmp/tmp_dev_compilation.json
mv tmp/tmp_dev_compilation.json "$COMPILATION_FILE_PATH"
echo "[ DONE ]"
exit
fi
make -j${cores}
cd ..