forked from IfcOpenShell/IfcOpenShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-deps.sh
More file actions
executable file
·86 lines (71 loc) · 3.54 KB
/
build-deps.sh
File metadata and controls
executable file
·86 lines (71 loc) · 3.54 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
###############################################################################
# #
# This file is part of IfcOpenShell. #
# #
# IfcOpenShell is free software: you can redistribute it and/or modify #
# it under the terms of the Lesser GNU General Public License as published by #
# the Free Software Foundation, either version 3.0 of the License, or #
# (at your option) any later version. #
# #
# IfcOpenShell is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# Lesser GNU General Public License for more details. #
# #
# You should have received a copy of the Lesser GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
###############################################################################
###############################################################################
# #
# This script installs and builds IfcOpenShell's dependencies using MSYS2 #
# #
# Note that this script is currently a very bare-bones implementation #
# #
###############################################################################
set -e
# Set defaults for missing empty environment variables
if [ -z "$IFCOS_NUM_BUILD_PROCS" ]; then
IFCOS_NUM_BUILD_PROCS=$(expr $(sysctl -n hw.ncpu 2> /dev/null || cat /proc/cpuinfo | grep processor | wc -l) + 1)
fi
BUILD_DIR=build-msys
SCRIPT_DIR=`pwd "$0"`
DEPS_DIR="$SCRIPT_DIR/../deps"
[ -d $DEPS_DIR ] || mkdir -p $DEPS_DIR
INSTALL_DIR="$SCRIPT_DIR/../deps-msys-installed"
pacman --noconfirm -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-boost make swig
export PATH=/mingw64/bin/:$PATH
function git_clone_or_pull {
[ -d $2 ] || git clone $1 $2
pushd $2
git pull
popd
}
function git_clone_and_checkout_revision {
[ -d $2 ] || git clone $1 $2
pushd $2
git checkout $3
popd
}
# Use a fixed revision in order to prevent introducing breaking changes
git_clone_and_checkout_revision https://github.com/KhronosGroup/OpenCOLLADA.git "$DEPS_DIR/OpenCOLLADA" \
064a60b65c2c31b94f013820856bc84fb1937cc6
pushd "$DEPS_DIR/OpenCOLLADA"
[ -d $BUILD_DIR ] || mkdir -p $BUILD_DIR
pushd $BUILD_DIR
cmake .. -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR/OpenCOLLADA"
make -j$IFCOS_NUM_BUILD_PROCS
make install
popd
git_clone_or_pull https://github.com/tpaviot/oce.git "$DEPS_DIR/oce"
git_clone_or_pull https://github.com/QbProg/oce-win-bundle.git "$DEPS_DIR/oce/oce-win-bundle"
pushd "$DEPS_DIR/oce"
[ -d $BUILD_DIR ] || mkdir -p $BUILD_DIR
pushd $BUILD_DIR
# -DOCE_BUILD_SHARED_LIB=0
cmake .. -G "MSYS Makefiles" -DOCE_INSTALL_PREFIX="$INSTALL_DIR/oce" -DOCE_TESTING=0
make -j$IFCOS_NUM_BUILD_PROCS
make install
popd
popd
echo IfcOpenShell dependencies installed and built