-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathbuild.sh
executable file
·54 lines (46 loc) · 1.53 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
47
48
49
50
51
52
53
54
#!/bin/bash
#
set -e
THIS_PATH=$(pwd)
CINDER_PATH=${THIS_PATH}/Cinder
exitWithError() {
echo "Error:" "$@" >&2
exit 1
}
checkRequiredTool() {
for tool in git make cmake ; do
command -v "${tool}" &> /dev/null || exitWithError "Missing required tool ${tool}"
done
}
cloneDependenciesIfNeeded() {
if [ ! -f "${CINDER_PATH}/CMakeLists.txt" ] ; then
echo "Cinder is not cloned yet, cloning now"
git clone --recursive https://github.com/oqu/Cinder.git \
|| exitWithError "Cannot clone Cinder"
fi
if [ ! -f "${CINDER_PATH}/blocks/Cinder-ImGui/cinderblock.xml" ] ; then
echo "Cinder-ImGui is not cloned yet, cloning now"
git clone --recursive https://github.com/paulhoux/Cinder-ImGui.git "${CINDER_PATH}/blocks/Cinder-ImGui" \
|| exitWithError "Cannot clone Cinder-ImGui"
fi
}
buildCinder() {
if [ ! -f "${CINDER_PATH}/build/CMakeCache.txt" ] ; then
echo "Cinder has not been configure, running cmake ..."
cmake -B "${CINDER_PATH}/build" -DCINDER_DISABLE_IMGUI=1 "${CINDER_PATH}" \
|| exitWithError "Cannot run CMake on Cinder"
fi
make -C "${CINDER_PATH}/build" -j4 || exitWithError "Error building Cinder"
}
build() {
if [ ! -f "${THIS_PATH}/build/CMakeCache.txt" ] ; then
echo "This project has not been configure, running cmake ..."
cmake -B "${THIS_PATH}/build" "${THIS_PATH}" \
|| exitWithError "Cannot run CMake on this project"
fi
make -C "${THIS_PATH}/build" -j4 || exitWithError "Error building this project"
}
checkRequiredTool
cloneDependenciesIfNeeded
buildCinder
build