-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_withcmake.sh
executable file
·47 lines (40 loc) · 1010 Bytes
/
compile_withcmake.sh
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
#!/bin/bash
# args
if [ "$#" -ne 2 ]; then
echo "Using Release and logging false"
BUILDTYPE="Release"
LOGGING="false"
else
BUILDTYPE=$1
LOGGING=$2
fi
# build-type options: Release,Debug
declare dynwmis_buildtype=$BUILDTYPE
# logging: true/false
declare dynwmis_is_logging=$LOGGING
# determine CPUs
declare NCORES=4
declare unamestr=$(uname)
if [[ "$unamestr" == "Linux" ]]; then
NCORES=$(grep -c ^processor /proc/cpuinfo)
fi
if [[ "$unamestr" == "Darwin" ]]; then
NCORES=$(sysctl -n hw.ncpu)
fi
# build
rm -rf build
mkdir build
cd build
if [[ "$unamestr" == "Linux" ]]; then
cmake ../ -DCMAKE_BUILD_TYPE=${dynwmis_buildtype} -DDELTA_ORIENTATIONS_IS_LOGGING=${dynwmis_is_logging} -DGurobi_DIR="${GUROBI_HOME}"
fi
if [[ "$unamestr" == "Darwin" ]]; then
cmake ../ -DCMAKE_BUILD_TYPE=${dynwmis_buildtype} -DDELTA_ORIENTATIONS_IS_LOGGING=${dynwmis_is_logging} -DGurobi_DIR="${GUROBI_HOME}"
fi
make -j $NCORES
# test
#ctest
# deploy
cmake --install .
cd ..
echo "Build completed."