-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminimake.sh
More file actions
executable file
·28 lines (26 loc) · 927 Bytes
/
minimake.sh
File metadata and controls
executable file
·28 lines (26 loc) · 927 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
#!/bin/sh
# https://github.com/s-t-a-n
build_dir=build
if [ $# -eq 1 ] && [ "$1" == "test" ]; then
# compile and test
cmake -S . -B $build_dir -DBUILD_TESTING=ON && ( cd $build_dir && make ) \
&& ( cd $build_dir && ctest --output-on-failure ./) \
&& echo -e "Tests ran: \e[92mok\e[39m." \
|| { echo -e "Tests ran: \e[91mNOPE\e[39m."; false; }
elif [ $# -eq 1 ] && [ "$1" == "clean" ]; then
# clean all files which are specified in .gitignore
git clean -d -f -X
elif [ $# -eq 0 ]; then
# compile and copy hashmap binary and lib to root folder
cmake -S . -B $build_dir -DBUILD_TESTING=OFF && ( cd $build_dir && make ) \
&& cp $build_dir/src/libhashmap.a ./ \
&& echo -e "You can include \e[92mlibhashmap.a\e[39m in your library." \
|| { echo -e "Compilation ran: \e[91mNOPE\e[39m."; false; }
else
cat<<-EOF
usage:
$0 -> compile
$0 test -> compile and test
$0 clean -> remove build files
EOF
fi