forked from Exawind/exawind-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.bash
61 lines (50 loc) · 1.47 KB
/
core.bash
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
#!/bin/bash
__EXAWIND_CORE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
source ${__EXAWIND_CORE_DIR}/src/environment.bash
source ${__EXAWIND_CORE_DIR}/src/builder.bash
source ${__EXAWIND_CORE_DIR}/src/python-env.bash
exawind_help ()
{
cat <<EOF
Exawind build script
Usage:
${0} <task> <arguments>
With no tasks provided, the script will configure the project and compile the code
Available tasks:
cmake - configure the project
cmake_full - configure project after removing CMakeCache
make - compile the code
ctest - run tests (if available)
run - run arbitrary command using the environment used to compile the code
py_build - build a python library
py_install - install a python library (in development mode)
EOF
}
exawind_save_func ()
{
local orig_func=$(declare -f $1)
local new_func="$2${orig_func#$1}"
eval "$new_func"
}
exawind_main ()
{
if [ "$#" == "0" ] ; then
exawind_env && exawind_proj_env && exawind_default_cmd
else
subcmd=$1
case ${subcmd} in
"-h" | "--help" | "-?")
exawind_help
exit 0
;;
*)
shift
exawind_env && exawind_proj_env && exawind_${subcmd} "$@"
if [ $? = 127 ] ; then
echo "ERROR: ${subcmd} is not a valid command."
exawind_help
fi
;;
esac
fi
}