-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·46 lines (40 loc) · 1.13 KB
/
build.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
#!/usr/bin/env bash
# toggle to debug the script
# options could be found by 'set help'
set -o errexit
#set -o xtrace
#set -o verbose
OS_NAME="$(uname -s)"
MACH_TYPE="$(uname -m)"
#### global variables ####
if [ ${OS_NAME} == "Darwin" ]; then
ABSOLUTE_FILENAME=`readlink -f "$0"`
BUILD_VARIANT="darwin"
elif [ "$(expr substr ${OS_NAME} 1 5)" == "Linux" ]; then
ABSOLUTE_FILENAME=`readlink -e "$0"`
if [ ${MACH_TYPE} == "x86_64" ]; then
BUILD_VARIANT="linux64"
elif [ ${MACH_TYPE} == "i686" ]; then
BUILD_VARIANT="linux32"
elif [ ${MACH_TYPE} == "armv7l" ]; then
BUILD_VARIANT="armv7l"
else
echo "Unsupported machine type: ${MACH_TYPE}"
exit 1
fi
else
echo "Unsupported OS"
exit 1
fi
PROJECT_ROOT=$(dirname ${ABSOLUTE_FILENAME})
BUILD_DIR=${PROJECT_ROOT}/build/"${BUILD_VARIANT}"
CONANFILE=${PROJECT_ROOT}/conanfile_"${BUILD_VARIANT}".txt
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
conan install ${CONANFILE} --build=missing
cmake -S ${PROJECT_ROOT} -B ${BUILD_DIR}
cmake --build ${BUILD_DIR}
cd ${BUILD_DIR}
ctest
ctest --rerun-failed --output-on-failure
cd ${PROJECT_ROOT}