-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_cmd
More file actions
executable file
·62 lines (47 loc) · 1.75 KB
/
build_cmd
File metadata and controls
executable file
·62 lines (47 loc) · 1.75 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
#!/usr/bin/env bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) #"
export CMAKE_DEBUG_OPTS=""
ENABLE_CMD="enable"
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
;;
local)
ENABLE_CMD="enable_local"
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
O2PHYS_TAG="${1}"
shift
# Load O2PHYSICS
source ${SCRIPT_DIR}/${ENABLE_CMD} "${O2PHYS_TAG}"
pushd ${SCRIPT_DIR} &> /dev/null
env > ${SCRIPT_DIR}/compilation_env.txt
# 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 \
.. 2>&1 | tee cmake_out.log
RET=$?
[[ "${RET}" == 0 ]] && { make -j4 2>&1 | tee compile.log; } || { popd &> /dev/null; echo "cmake failure"; exit ${RET}; }
rm -rf ../bin/* ## we are in BUILD
[[ "${RET}" == 0 ]] && { make install 2>&1 | tee install.log; } || { popd &> /dev/null; echo "make failure"; exit ${RET}; }
popd &> /dev/null # return to SCRIPT_DIR
popd &> /dev/null # return to original location