-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildBulletCMake.sh
executable file
·208 lines (194 loc) · 7.43 KB
/
buildBulletCMake.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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#! /bin/bash
# Script to build Bullet on a target system.
STARTDIR=$(pwd)
# The UNAME is either "Darwin" or otherwise. Note that env variable overrides
UNAME=${BULLETUNAME:-$(uname)}
# The MACH is either 'x86_64', 'aarch64', or assumed generic. Note env variable overrides.
MACH=${BULLETMACH:-$(uname -m)}
# Note that this sets BULLETDIR unless there is an environment variable of the same name
BULLETDIR=${BULLETDIR:-bullet3}
BUILDDIR=bullet-build
cd "${BULLETDIR}"
mkdir -p "${BUILDDIR}"
cd "${BUILDDIR}"
echo "=== Building Bullet in dir ${BULLETDIR} for uname ${UNAME} and arch ${MACH} into ${BUILDDIR}"
if [[ "$UNAME" == "Darwin" ]] ; then
echo "=== Running cmake for Darwin"
cmake .. -G "Unix Makefiles" \
-DBUILD_BULLET3=ON \
-DBUILD_EXTRAS=ON \
-DBUILD_INVERSE_DYNAMIC_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_EXTRA=OFF \
-DBUILD_OBJ2SDF_EXTRA=OFF \
-DBUILD_SERIALIZE_EXTRA=OFF \
-DBUILD_CONVEX_DECOMPOSITION_EXTRA=ON \
-DBUILD_HACD_EXTRA=ON \
-DBUILD_GIMPACTUTILS_EXTRA=OFF \
-DBUILD_CPU_DEMOS=OFF \
-DBUILD_BULLET2_DEMOS=OFF \
-DBUILD_ENET=OFF \
-DBUILD_PYBULLET=OFF \
-DBUILD_UNIT_TESTS=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DINSTALL_EXTRA_LIBS=ON \
-DINSTALL_LIBS=ON \
-DCMAKE_OSX_ARCHITECTURES="arm64; x86_64" \
-DCMAKE_CXX_FLAGS="-arch arm64 -arch x86_64" \
-DCMAKE_C_FLAGS="-arch arm64 -arch x86_64 -fPIC -O2" \
-DCMAKE_EXE_LINKER_FLAGS="-arch arm64 -arch x86_64" \
-DCMAKE_VERBOSE_MAKEFILE="on" \
-DCMAKE_BUILD_TYPE=Release
elif [[ "$UNAME" =~ "MINGW64*" ]] ; then
cmake .. -G "Visual Studio 17 2022" \
-DBUILD_BULLET3=ON \
-DBUILD_EXTRAS=ON \
-DBUILD_INVERSE_DYNAMIC_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_EXTRA=OFF \
-DBUILD_OBJ2SDF_EXTRA=OFF \
-DBUILD_SERIALIZE_EXTRA=OFF \
-DBUILD_CONVEX_DECOMPOSITION_EXTRA=ON \
-DBUILD_HACD_EXTRA=ON \
-DBUILD_GIMPACTUTILS_EXTRA=OFF \
-DBUILD_CPU_DEMOS=OFF \
-DBUILD_BULLET2_DEMOS=OFF \
-DBUILD_ENET=OFF \
-DBUILD_PYBULLET=OFF \
-DBUILD_UNIT_TESTS=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DINSTALL_EXTRA_LIBS=ON \
-DINSTALL_LIBS=ON \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_BUILD_TYPE=Release
else
if [[ "$MACH" == "x86_64" ]]
then
echo "=== Running cmake for arch $MACH"
cmake .. -G "Unix Makefiles" \
-DBUILD_BULLET3=ON \
-DBUILD_EXTRAS=ON \
-DBUILD_INVERSE_DYNAMIC_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_EXTRA=OFF \
-DBUILD_OBJ2SDF_EXTRA=OFF \
-DBUILD_SERIALIZE_EXTRA=OFF \
-DBUILD_CONVEX_DECOMPOSITION_EXTRA=ON \
-DBUILD_HACD_EXTRA=ON \
-DBUILD_GIMPACTUTILS_EXTRA=OFF \
-DBUILD_CPU_DEMOS=OFF \
-DBUILD_BULLET2_DEMOS=OFF \
-DBUILD_ENET=OFF \
-DBUILD_PYBULLET=OFF \
-DBUILD_UNIT_TESTS=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DINSTALL_EXTRA_LIBS=ON \
-DINSTALL_LIBS=ON \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_BUILD_TYPE=Release
elif [[ "$MACH" == "aarch64" ]]
then
echo "=== Running cmake for arch $MACH"
cmake .. -G "Unix Makefiles" \
-DBUILD_BULLET3=ON \
-DBUILD_EXTRAS=ON \
-DBUILD_INVERSE_DYNAMIC_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_EXTRA=OFF \
-DBUILD_OBJ2SDF_EXTRA=OFF \
-DBUILD_SERIALIZE_EXTRA=OFF \
-DBUILD_CONVEX_DECOMPOSITION_EXTRA=ON \
-DBUILD_HACD_EXTRA=ON \
-DBUILD_GIMPACTUTILS_EXTRA=OFF \
-DBUILD_CPU_DEMOS=OFF \
-DBUILD_BULLET2_DEMOS=OFF \
-DBUILD_ENET=OFF \
-DBUILD_PYBULLET=OFF \
-DBUILD_UNIT_TESTS=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DINSTALL_EXTRA_LIBS=ON \
-DINSTALL_LIBS=ON \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DCMAKE_CXX_FLAGS="-arch arm64" \
-DCMAKE_C_FLAGS="-arch arm64 -fPIC -O2" \
-DCMAKE_EXE_LINKER_FLAGS="-arch arm64" \
-DCMAKE_BUILD_TYPE=Release
else
echo "=== Running cmake for generic arch"
cmake .. -G "Unix Makefiles" \
-DBUILD_BULLET3=ON \
-DBUILD_EXTRAS=ON \
-DBUILD_INVERSE_DYNAMIC_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF \
-DBUILD_BULLET_ROBOTICS_EXTRA=OFF \
-DBUILD_OBJ2SDF_EXTRA=OFF \
-DBUILD_SERIALIZE_EXTRA=OFF \
-DBUILD_CONVEX_DECOMPOSITION_EXTRA=ON \
-DBUILD_HACD_EXTRA=ON \
-DBUILD_GIMPACTUTILS_EXTRA=OFF \
-DBUILD_CPU_DEMOS=OFF \
-DBUILD_BULLET2_DEMOS=OFF \
-DBUILD_ENET=OFF \
-DBUILD_PYBULLET=OFF \
-DBUILD_UNIT_TESTS=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DINSTALL_EXTRA_LIBS=ON \
-DINSTALL_LIBS=ON \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_BUILD_TYPE=Release
fi
fi
# DEBUG DEBUG
echo "=== $(pwd)"
ls -l
echo "=== END"
# END DEBUG DEBUG
if [[ -e Makefile ]] ; then
echo "=== Building Makefile"
make -j4
fi
if [[ -e "BULLET_PHYSICS.sln" ]] ; then
echo "=== Building BULLET_PHYSICS.sln"
dotnet build -c Release BULLET_PHYSICS.sln
fi
# make install
# As an alternative to installation, move the .a files in to a local directory
# Good as it doesn't require admin privilages
echo "=== Cleaning out any existing lib and include directories"
cd "$STARTDIR"
rm -rf lib
rm -rf include
echo "=== Moving .a files into ../lib"
cd "$STARTDIR"
mkdir -p lib
for afile in $(find "${BULLETDIR}/${BUILDDIR}" -name *.a) ; do
cp "$afile" lib
done
echo "=== Moving .h files into ../include"
cd "$STARTDIR"
mkdir -p include
cd "${BULLETDIR}/src"
for file in $(find . -name \*.h) ; do
xxxx="${STARTDIR}/include/$(dirname $file)"
mkdir -p "$xxxx"
cp "$file" "$xxxx"
done
# Move Bullet's VERSION file into lib/ so BulletSim can reference it
echo "=== Moving Bullet's VERSION file into ../lib"
cd "$STARTDIR"
mkdir -p lib
cp "${BULLETDIR}/VERSION" lib/
echo "=== Moving .h files from Extras into ../include"
cd "$STARTDIR"
cd "${BULLETDIR}/Extras"
for file in $(find . -name \*.h) ; do
xxxx="${STARTDIR}/include/$(dirname $file)"
mkdir -p "$xxxx"
cp "$file" "$xxxx"
done
echo "=== Moving .inl files from Extras into ../include"
for file in $(find . -name \*.inl) ; do
xxxx="${STARTDIR}/include/$(dirname $file)"
mkdir -p "$xxxx"
cp "$file" "$xxxx"
done