-
Notifications
You must be signed in to change notification settings - Fork 2
/
build_cmd
executable file
·54 lines (40 loc) · 1.61 KB
/
build_cmd
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
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) #"
# Load O2PHYSICS
source ${SCRIPT_DIR}/enable
env | sort > ${SCRIPT_DIR}/compilation_env.txt
export CMAKE_DEBUG_OPTS=""
ARGS=()
while [[ $# -gt 0 ]]; do
case $1 in
debug)
export CMAKE_DEBUG_OPTS=" --debug-output --debug-find --trace --trace-expand --trace-format=human --trace-redirect=cmake_trace.log "
shift
;;
-h|--help)
echo -e "debug\t: enable cmake debug options"
exit 0
;;
*)
ARGS+=("${1}") # save positional arg
shift # past argument
;;
esac
done
set -- "${ARGS[@]}" # restore positional parameters
pushd ${SCRIPT_DIR} &> /dev/null
# Compile the tasks
mkdir -p BUILD
rm -rf BUILD/*
pushd BUILD &> /dev/null || { echo "Could not cd to BUILD dir"; exit 1; }
cmake -DCMAKE_INSTALL_PREFIX=.. -DBUILD_TEST_ROOT_MACROS=OFF ${CMAKE_DEBUG_OPTS} \
-DENABLE_CUDA=OFF -DENABLE_OPENCL1=OFF -DENABLE_OPENCL2=OFF -DENABLE_HIP=OFF \
-DLIBJALIENO2_INCLUDE_DIR=${LIBJALIENO2_ROOT}/include -DLIBJALIENO2_LIBPATH=${LIBJALIENO2_ROOT}/lib/libjalienO2.so \
-DJALIEN_ROOT_INCLUDE_DIR=${JALIEN_ROOT_ROOT}/include -DJAliEnRoot_LIB=${JALIEN_ROOT_ROOT}/lib/libJAliEnROOT.so \
.. &> cmake_out.log
RET=$?
[[ "${RET}" == 0 ]] && { make -j4 &> compile.log; } || { popd &> /dev/null; echo "cmake failure"; exit ${RET}; }
rm -rf ../bin/* ## we are in BUILD
[[ "${RET}" == 0 ]] && { make install &> install.log; } || { popd &> /dev/null; echo "make failure"; exit ${RET}; }
popd &> /dev/null # return to SCRIPT_DIR
popd &> /dev/null # return to original location