-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-cmd.sh
More file actions
executable file
·251 lines (207 loc) · 9.33 KB
/
Copy pathbuild-cmd.sh
File metadata and controls
executable file
·251 lines (207 loc) · 9.33 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
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#!/usr/bin/env bash
# turn on verbose debugging output for parabuild logs.
exec 4>&1; export BASH_XTRACEFD=4; set -x
# make errors fatal
set -e
# complain about unset env variables
set -u
if [ -z "$AUTOBUILD" ] ; then
exit 1
fi
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]] ; then
autobuild="$(cygpath -u $AUTOBUILD)"
else
autobuild="$AUTOBUILD"
fi
#execute build from top-level checkout
cd "$(dirname "$0")"
top="$(pwd)"
stage="$top/stage"
# load autobuild provided shell functions and variables
source_environment_tempfile="$stage/source_environment.sh"
"$autobuild" source_environment > "$source_environment_tempfile"
. "$source_environment_tempfile"
# remove_cxxstd apply_patch
source "$(dirname "$AUTOBUILD_VARIABLES_FILE")/functions"
[ -f "$stage"/packages/include/minizip-ng/zip.h ] || \
{ echo "You haven't yet run autobuild install." 1>&2 ; exit 1; }
# Use msbuild.exe instead of devenv.com
build_sln() {
local solution=$1
local config=$2
local proj="${3:-}"
local toolset="${AUTOBUILD_WIN_VSTOOLSET:-v143}"
# e.g. config = "Release|$AUTOBUILD_WIN_VSPLATFORM" per devenv.com convention
local -a confparts
IFS="|" read -ra confparts <<< "$config"
msbuild.exe \
"$(cygpath -w "$solution")" \
${proj:+-t:"$proj"} \
-p:Configuration="${confparts[0]}" \
-p:Platform="${confparts[1]}" \
-p:PlatformToolset=$toolset
}
# There are two version numbers mixed up in the code below: the collada
# version (e.g. 1.4, upstream from colladadom?) and the dom version (e.g. 2.3,
# the version number we associate with this package). Get versions from
# Makefile.
# e.g. colladaVersion := 1.4
collada_version="$(sed -n -E 's/^ *colladaVersion *:= *([0-9]+\.[0-9]+) *$/\1/p' \
"$top/Makefile")"
# remove embedded dots
collada_shortver="${collada_version//.}"
# e.g.
# domMajorVersion := 2
# domMinorVersion := 3
dom_major="$(sed -n -E 's/^ *domMajorVersion *:= *([0-9]+) *$/\1/p' "$top/Makefile")"
dom_minor="$(sed -n -E 's/^ *domMinorVersion *:= *([0-9]+) *$/\1/p' "$top/Makefile")"
dom_version="$dom_major.$dom_minor"
dom_shortver="$dom_major$dom_minor"
case "$AUTOBUILD_PLATFORM" in
windows*)
case "$AUTOBUILD_VSVER" in
"120")
versub="vc12-${collada_version}"
;;
"150")
versub="vc14-${collada_version}"
;;
"160"|"170")
versub="vc142-${collada_version}"
;;
*)
echo "Unknown AUTOBUILD_VSVER='$AUTOBUILD_VSVER'" 1>&2 ; exit 1
;;
esac
projdir="projects/$versub"
for arch in sse avx2 arm64 ; do
platform_target="x64"
proj_suffix=""
if [[ "$arch" == "avx2" ]]; then
proj_suffix="_avx2"
elif [[ "$arch" == "arm64" ]]; then
platform_target="ARM64"
fi
build_sln "$projdir/dom.sln" "Debug$proj_suffix|$platform_target" dom
build_sln "$projdir/dom.sln" "Debug$proj_suffix|$platform_target" dom-static
build_sln "$projdir/dom.sln" "Debug$proj_suffix|$platform_target" domTest
# conditionally run unit tests
if [[ "${DISABLE_UNIT_TESTS:-0}" == "0" && "$arch" != "arm64" ]]; then
if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then
"build/$versub/domTest.exe" -all
else
# 64 bit exe ends up in different location to 32 bit hard coded
# path to data directory - source code suggests it looks in a dir
# called domTestData first so we make one
mkdir -p "$projdir/$platform_target/Debug$proj_suffix/domTestData"
cp "test/${collada_version}/data"/* "$projdir/$platform_target/Debug$proj_suffix/domTestData/"
"$projdir/$platform_target/Debug$proj_suffix/domTest.exe" -all
fi
fi
# stage the good bits
mkdir -p "$stage"/lib/$arch/debug
libname="libcollada${collada_shortver}dom${dom_shortver}-sd.lib"
if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then cp -a "build/$versub/$libname" "$stage"/lib/$arch/debug/
else cp -a "$projdir/$platform_target/Debug$proj_suffix/$libname" "$stage"/lib/$arch/debug/
fi
build_sln "$projdir/dom.sln" "Release$proj_suffix|$platform_target" dom
build_sln "$projdir/dom.sln" "Release$proj_suffix|$platform_target" dom-static
build_sln "$projdir/dom.sln" "Release$proj_suffix|$platform_target" domTest
# conditionally run unit tests
if [[ "${DISABLE_UNIT_TESTS:-0}" == "0" && "$arch" != "arm64" ]]; then
if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then
"build/$versub/domTest.exe" -all
else
# 64 bit exe ends up in different location to 32 bit hard coded
# path to data directory - source code suggests it looks in a dir
# called domTestData first so we make one
mkdir -p "$projdir/$platform_target/Release$proj_suffix/domTestData"
cp "test/${collada_version}/data"/* "$projdir/$platform_target/Release$proj_suffix/domTestData/"
"$projdir/$platform_target/Release$proj_suffix/domTest.exe" -all
fi
fi
# stage the good bits
mkdir -p "$stage"/lib/$arch/release
libname="libcollada${collada_shortver}dom${dom_shortver}-s.lib"
if [ "$AUTOBUILD_ADDRSIZE" = 32 ]
then cp -a "build/$versub/$libname" "$stage"/lib/$arch/release/
else cp -a "$projdir/$platform_target/Release/$libname" "$stage"/lib/$arch/release/
fi
done
;;
darwin*)
# Darwin build environment at Linden is also pre-polluted like Linux
# and that affects colladadom builds. Here are some of the env vars
# to look out for:
#
# AUTOBUILD GROUPS LD_LIBRARY_PATH SIGN
# arch branch build_* changeset
# helper here prefix release
# repo root run_tests suffix
export MACOSX_DEPLOYMENT_TARGET="$LL_BUILD_DARWIN_DEPLOY_TARGET"
opts="${TARGET_OPTS:--arch arm64 -arch x86_64 $LL_BUILD_RELEASE}"
nproc=$(sysctl -n hw.physicalcpu)
libdir="$top/stage"
mkdir -p "$libdir"/lib/release
# Without the -Wno-etc flag, incredible spam is produced
make \
conf=release \
-j$nproc \
CFLAGS="$opts" \
CXXFLAGS="$opts -Wno-unused-local-typedef" \
LDFLAGS="-Wl,-headerpad_max_install_names" \
arch="x86_64 arm64" \
printCommands=yes \
printMessages=yes
# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
"build/mac-${collada_version}/domTest" -all
fi
# install_name_tool -id "@executable_path/../Resources/libcollada${collada_shortver}dom-d.dylib" "build/mac-${collada_version}-d/libcollada${collada_shortver}dom-d.dylib"
# install_name_tool -id "@executable_path/../Resources/libcollada${collada_shortver}dom.dylib" "build/mac-${collada_version}/libcollada${collada_shortver}dom.dylib"
cp -a "build/mac-${collada_version}/libcollada${collada_shortver}dom.a" "$libdir"/lib/release/
;;
linux64)
# Default target per --address-size
opts="${TARGET_OPTS:--m$AUTOBUILD_ADDRSIZE $LL_BUILD_RELEASE}"
# Handle any deliberate platform targeting
if [ -z "${TARGET_CPPFLAGS:-}" ]; then
# Remove sysroot contamination from build environment
unset CPPFLAGS
else
# Incorporate special pre-processing flags
export CPPFLAGS="$TARGET_CPPFLAGS"
fi
libdir="$top/stage"
for arch in sse avx2 ; do
# Default target per autobuild build --address-size
opts="${TARGET_OPTS:--m$AUTOBUILD_ADDRSIZE $LL_BUILD_RELEASE}"
if [[ "$arch" == "avx2" ]]; then
opts="$(replace_switch -march=x86-64-v2 -march=x86-64-v3 $opts)"
fi
plainopts="$(remove_cxxstd $opts)"
make clean arch="$arch" # Hide 'arch' env var
make -j$AUTOBUILD_CPU_COUNT \
conf=release \
LDFLAGS="$opts" \
CFLAGS="$plainopts" \
CXXFLAGS="$opts" \
arch="$arch"
# conditionally run unit tests
if [ "${DISABLE_UNIT_TESTS:-0}" = "0" ]; then
"build/linux-${collada_version}/domTest" -all
fi
mkdir -p "$libdir"/lib/$arch/release
cp -a "build/linux-${collada_version}/libcollada${collada_shortver}dom.a" "$libdir"/lib/$arch/release/
done
;;
esac
mkdir -p stage/include/collada
cp -a include/* stage/include/collada
mkdir -p stage/LICENSES
cp -a license.txt stage/LICENSES/collada.txt
## mkdir -p stage/LICENSES/collada-other
cp -a license/tinyxml-license.txt stage/LICENSES/tinyxml.txt