This repository was archived by the owner on Mar 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.sh
More file actions
executable file
·36 lines (31 loc) · 1.45 KB
/
utility.sh
File metadata and controls
executable file
·36 lines (31 loc) · 1.45 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
#!/bin/sh
argc=$#
usage_exit() {
printf "\033[1;34mUses:\033[0m\\nutility.sh [help | build | unittest | profile | sloc]\\n\\tutility.sh (re)build [debug | profile | release | any-debug | any-profile | any-release] [CMake generator name]\\n\\tutility.sh test\\n\\tutility.sh profile <JS file path>\\n";
printf "\033[1;34mUSAGE NOTES:\033[0m\\n\\tany-* build modes are for compiler-platform setups that are outside Homebrew Clang on macOS.\\n\\tOn Linux platforms, try getting the latest version of GCC / Clang for a better chance of C++ modules and TCO working.\\n";
exit "$1";
}
if [[ $argc -lt 1 ]]; then
usage_exit 1;
fi
action="$1"
if [[ $action = "help" ]]; then
usage_exit 0;
elif [[ $action = "build" && $argc -eq 3 ]]; then
rm -rf ./.cache;
rm -f ./compile_commands.json;
rm -f ./build/derkjs;
cmake -S . -B build --preset "local-$2-build" -G "$3" && cmake --build build && mv ./build/compile_commands.json .;
elif [[ $action = "rebuild" && $argc -eq 3 ]]; then
rm -rf ./.cache;
rm -rf ./build/;
cmake --fresh -S . -B build --preset "local-$2-build" -G "$3" && cmake --build build && mv ./build/compile_commands.json .;
elif [[ $action = "test" ]]; then
python3 ./utility/run_suite.py
elif [[ $action = "profile" && $argc -eq 2 ]]; then
samply record --save-only -o prof_tco.json -- ./build/derkjs_tco -r "$2";
elif [[ $action = "sloc" ]]; then
wc -l ./src/derkjs_impl/**/*.ixx ./src/*.cpp;
else
usage_exit 1;
fi