forked from hirotakaster/pcl-superbuild
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakeFramework.sh
executable file
·488 lines (423 loc) · 22.5 KB
/
makeFramework.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
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
#!/bin/bash
#------------------------------------------------------------------------------
install=./CMakeExternals/Install
PACKAGENAME=pcl
PCL_VERSION=1.9
CONFIGURATION=Release
if [ ! -d $install ]; then
echo "Install directory not found. This script should be run from the top level build directory that contains CMakeExternals/Install."
exit 1
fi
#------------------------------------------------------------------------------
make_framework ()
{
###
# Variable setting
###
# device_folder = "ios-device"
# simulator_folder = "ios-simulator"
# pcl_device_libs=`find $install/pcl-${device_folder} $install/flann-${device_folder} $install/boost-${device_folder} -name *.a`
pcl_device_libs=`find $install/pcl-ios-device -name *.a`
boost_device_libs=`find $install/boost-ios-device -name *.a`
flann_device_libs=`find $install/flann-ios-device -name *.a`
# pcl_sim_libs=`find $install/pcl-${simulator_folder} $install/flann-${simulator_folder} $install/boost-${simulator_folder} -name *.a`
pcl_sim_libs=`find $install/pcl-ios-simulator -name *.a`
boost_sim_libs=`find $install/boost-ios-simulator -name *.a`
flann_sim_libs=`find $install/flann-ios-simulator -name *.a`
# args -> version
# version 1.9
pcl_header_dir=$install/pcl-ios-device/include/pcl-${PCL_VERSION}
boost_header_dir=$install/boost-ios-device/include
eigen_header_dir=$install/eigen
flann_header_dir=$install/flann-ios-device/include
qhull_header_dir=$install/qhull-ios-device/include
pcl_framework=$install/frameworks/${PACKAGENAME}.framework
mkdir -p $pcl_framework
rm -rf $pcl_framework/*
# Public Header
mkdir $pcl_framework/Headers
cp -R $pcl_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $boost_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $eigen_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $flann_header_dir/* $pcl_framework/Headers/ 2>&1
# mkdir $pcl_framework/Modules
# cp module.modulemap $pcl_framework/Modules/
libtool -static -o $pcl_framework/pcl_device $pcl_device_libs $boost_device_libs $flann_device_libs
libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs
#
# lipo -create $pcl_framework/pcl_device -output $pcl_framework/pcl
# lipo -create $pcl_framework/pcl_sim -output $pcl_framework/pcl
lipo -create $pcl_framework/pcl_device $pcl_framework/pcl_sim -output $pcl_framework/pcl
# remove tmp library files
rm $pcl_framework/pcl_*
}
#------------------------------------------------------------------------------
make_framework_device ()
{
# Xcode device Wrapper
###
# Variable setting
###
current_ios_device_framework=../iOSWrapper/build.ios/${CONFIGUTATION}-iphoneos/${PACKAGENAME}.framework
# Step 1. Build Device and Simulator versions complete
# common
pcl_device_libs=`find $install/pcl-ios-device -name *.a`
boost_device_libs=`find $install/boost-ios-device -name *.a`
flann_device_libs=`find $install/flann-ios-device -name *.a`
qhull_device_libs=`find $install/qhull-ios-device -name *.a`
# arm64
pcl_device_arm64_libs=`find $install/pcl-ios-device-arm64 -name *.a`
boost_device_arm64_libs=`find $install/boost-ios-device-arm64 -name *.a`
flann_device_arm64_libs=`find $install/flann-ios-device-arm64 -name *.a`
qhull_device_arm64_libs=`find $install/qhull-ios-device-arm64 -name *.a`
# armv7
pcl_device_armv7_libs=`find $install/pcl-ios-device-armv7 -name *.a`
boost_device_armv7_libs=`find $install/boost-ios-device-armv7 -name *.a`
flann_device_armv7_libs=`find $install/flann-ios-device-armv7 -name *.a`
qhull_device_armv7_libs=`find $install/qhull-ios-device-armv7 -name *.a`
# armv7s
pcl_device_armv7s_libs=`find $install/pcl-ios-device-armv7s -name *.a`
boost_device_armv7s_libs=`find $install/boost-ios-device-armv7s -name *.a`
flann_device_armv7s_libs=`find $install/flann-ios-device-armv7s -name *.a`
qhull_device_armv7s_libs=`find $install/qhull-ios-device-armv7s -name *.a`
# args -> version
# common
# version 1.8
pcl_header_dir=$install/pcl-ios-device/include/pcl-${PCL_VERSION}
boost_header_dir=$install/boost-ios-device/include
eigen_header_dir=$install/eigen
flann_header_dir=$install/flann-ios-device/include
qhull_header_dir=$install/qhull-ios-device/include
# ioswrapper_header_dir=$install/ios_device_wrapper/include
# arm64
pcl_arm64_header_dir=$install/pcl-ios-device-arm64/include/pcl-${PCL_VERSION}
boost_arm64_header_dir=$install/boost-ios-device-arm64/include
eigen_arm64_header_dir=$install/eigen
flann_arm64_header_dir=$install/flann-ios-device-arm64/include
qhull_arm64_header_dir=$install/qhull-ios-device-arm64/include
# ioswrapper_header_dir=$install/ios_device_wrapper/include
# Step 2. Copy the framework structure (from iphoneos build) to the device folder
pcl_framework=$install/frameworks-device/${PACKAGENAME}.framework
mkdir -p ${pcl_framework}
rm -rf $pcl_framework/*
cp -R "${current_ios_device_framework}" "${pcl_framework}/.."
# mkdir $pcl_framework/Headers
# common
cp -R $pcl_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $boost_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $eigen_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $flann_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $qhull_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $ioswrapper_header_dir/* $pcl_framework/Headers/
# arm64
cp -R $pcl_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $boost_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $eigen_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $flann_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $qhull_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
# mkdir $pcl_framework/Modules
cp ../iOSWrapper/module.modulemap $pcl_framework/
# combine libraries
# libtool -static -o $pcl_framework/pcl_device $pcl_device_libs $boost_device_libs $flann_device_libs $qhull_device_libs $current_pcl_ios_device_framework/pcl
libtool -static -o $pcl_framework/pcl_device $pcl_device_arm64_libs $boost_arm64_device_libs $flann_arm64_device_libs $qhull_arm64_device_libs $pcl_device_armv7_libs $boost_armv7_device_libs $flann_armv7_device_libs $qhull_armv7_device_libs $pcl_device_armv7s_libs $boost_armv7s_device_libs $flann_armv7s_device_libs $qhull_armv7s_device_libs $current_pcl_ios_device_framework/pcl
# combine Xcode generator frameworks and external build libraries
lipo -create -output $pcl_framework/pcl $pcl_framework/pcl_device
# remove tmp library files
rm -rf $pcl_framework/pcl_*
}
make_framework_simulator ()
{
# Xcode simulation Wrapper
###
# Variable setting
###
current_ios_sim_framework=../iOSWrapper/build.sim64/${CONFIGUTATION}-iphonesimulator/${PACKAGENAME}.framework
# current_ios_sim_i386_framework=../iOSWrapper/build.sim/${CONFIGUTATION}-iphonesimulator/${PACKAGENAME}.framework
pcl_sim_libs=`find $install/pcl-ios-simulator -name *.a`
boost_sim_libs=`find $install/boost-ios-simulator -name *.a`
flann_sim_libs=`find $install/flann-ios-simulator -name *.a`
qhull_sim_libs=`find $install/qhull-ios-simulator -name *.a`
# x86_64
# pcl_sim_x86_64_libs=`find $install/pcl-ios-simulator-x86-64 -name *.a`
# boost_sim_x86_64_libs=`find $install/boost-ios-simulator-x86-64 -name *.a`
# flann_sim_x86_64_libs=`find $install/flann-ios-simulator-x86-64 -name *.a`
# qhull_sim_x86_64_libs=`find $install/qhull-ios-simulator-x86-64 -name *.a`
# i386
# pcl_sim_i386_libs=`find $install/pcl-ios-simulator-i386 -name *.a`
# boost_sim_i386_libs=`find $install/boost-ios-simulator-i386 -name *.a`
# flann_sim_i386_libs=`find $install/flann-ios-simulator-i386 -name *.a`
# qhull_sim_i386_libs=`find $install/qhull-ios-simulator-i386 -name *.a`
# args -> version
# version 1.8
pcl_header_dir=$install/pcl-ios-simulator/include/pcl-${PCL_VERSION}
boost_header_dir=$install/boost-ios-simulator/include
eigen_header_dir=$install/eigen
flann_header_dir=$install/flann-ios-simulator/include
qhull_header_dir=$install/qhull-ios-simulator/include
# ioswrapper_header_dir=$install/ioswrapper-ios-simulator/include
# Step 3. Copy the framework structure (from iphoneos-simulator build) to the device folder
pcl_framework=$install/frameworks-simulator/${PACKAGENAME}.framework
mkdir -p ${pcl_framework}
rm -rf $pcl_framework/*
cp -R "${current_ios_sim_framework}" "${pcl_framework}/.."
# Public Header
# mkdir $pcl_framework/Headers
cp -R $pcl_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $boost_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $eigen_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $flann_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $qhull_header_dir/* $pcl_framework/Headers/ 2>&1
# mkdir $pcl_framework/Modules
# cp module.modulemap $pcl_framework/Modules/
cp ../iOSWrapper/module.modulemap $pcl_framework/
# debug libs
# ranlib $boost_sim_libs
# ranlib $flann_sim_libs
# ranlib $qhull_sim_libs
# ranlib $pcl_sim_libs
# combine libraries
# libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs $qhull_sim_libs $pcl_sim_i386_libs $boost_sim_i386_libs $flann_sim_i386_libs $qhull_sim_i386_libs $current_ios_sim_framework/pcl $current_ios_sim_i386_framework/pcl
libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs $qhull_sim_libs $current_ios_sim_framework/pcl
# combine Xcode generator frameworks and external build libraries
lipo -create -output $pcl_framework/pcl $pcl_framework/pcl_sim
# remove tmp library files
rm -rf $pcl_framework/pcl_*
}
make_framework_universal ()
{
# Xcode device/simulation Wrapper framework path
###
# Variable setting
###
current_ios_device_framework=../iOSWrapper/build.ios/${CONFIGUTATION}-iphoneos/${PACKAGENAME}.framework
current_ios_sim_framework=../iOSWrapper/build.sim64/${CONFIGUTATION}-iphonesimulator/${PACKAGENAME}.framework
# current_ios_sim_i386_framework=../iOSWrapper/build.sim/${CONFIGUTATION}-iphonesimulator/${PACKAGENAME}.framework
# device_folder = "ios-device"
# simulator_folder = "ios-simulator"
# pcl_device_libs=`find $install/pcl-${device_folder} $install/flann-${device_folder} $install/boost-${device_folder} -name *.a`
# all device arch(not use)
# pcl_device_libs=`find $install/pcl-ios-device -name *.a`
# boost_device_libs=`find $install/boost-ios-device -name *.a`
# flann_device_libs=`find $install/flann-ios-device -name *.a`
# qhull_device_libs=`find $install/qhull-ios-device -name *.a`
# arm64
pcl_device_arm64_libs=`find $install/pcl-ios-device-arm64 -name *.a`
boost_device_arm64_libs=`find $install/boost-ios-device-arm64 -name *.a`
flann_device_arm64_libs=`find $install/flann-ios-device-arm64 -name *.a`
qhull_device_arm64_libs=`find $install/qhull-ios-device-arm64 -name *.a`
# armv7
pcl_device_armv7_libs=`find $install/pcl-ios-device-armv7 -name *.a`
boost_device_armv7_libs=`find $install/boost-ios-device-armv7 -name *.a`
flann_device_armv7_libs=`find $install/flann-ios-device-armv7 -name *.a`
qhull_device_armv7_libs=`find $install/qhull-ios-device-armv7 -name *.a`
# armv7s
pcl_device_armv7s_libs=`find $install/pcl-ios-device-armv7s -name *.a`
boost_device_armv7s_libs=`find $install/boost-ios-device-armv7s -name *.a`
flann_device_armv7s_libs=`find $install/flann-ios-device-armv7s -name *.a`
qhull_device_armv7s_libs=`find $install/qhull-ios-device-armv7s -name *.a`
# pcl_sim_libs=`find $install/pcl-${simulator_folder} $install/flann-${simulator_folder} $install/boost-${simulator_folder} -name *.a`
pcl_sim_libs=`find $install/pcl-ios-simulator -name *.a`
boost_sim_libs=`find $install/boost-ios-simulator -name *.a`
flann_sim_libs=`find $install/flann-ios-simulator -name *.a`
qhull_sim_libs=`find $install/qhull-ios-simulator -name *.a`
# x86_64
# pcl_sim_x86_64_libs=`find $install/pcl-ios-simulator-x86-64 -name *.a`
# boost_sim_x86_64_libs=`find $install/boost-ios-simulator-x86-64 -name *.a`
# flann_sim_x86_64_libs=`find $install/flann-ios-simulator-x86-64 -name *.a`
# qhull_sim_x86_64_libs=`find $install/qhull-ios-simulator-x86-64 -name *.a`
# i386
# pcl_sim_i386_libs=`find $install/pcl-ios-simulator-i386 -name *.a`
# boost_sim_i386_libs=`find $install/boost-ios-simulator-i386 -name *.a`
# flann_sim_i386_libs=`find $install/flann-ios-simulator-i386 -name *.a`
# qhull_sim_i386_libs=`find $install/qhull-ios-simulator-i386 -name *.a`
# args -> version
# version 1.7
# pcl_header_dir=$install/pcl-${device_folder}/include/pcl-1.7
# version 1.8
# common
# version ${PCL_VERSION}
pcl_header_dir=$install/pcl-ios-device/include/pcl-${PCL_VERSION}
boost_header_dir=$install/boost-ios-device/include
eigen_header_dir=$install/eigen
flann_header_dir=$install/flann-ios-device/include
qhull_header_dir=$install/qhull-ios-device/include
# arm64
pcl_arm64_header_dir=$install/pcl-ios-device-arm64/include/pcl-${PCL_VERSION}
boost_arm64_header_dir=$install/boost-ios-device-arm64/include
eigen_arm64_header_dir=$install/eigen
flann_arm64_header_dir=$install/flann-ios-device-arm64/include
qhull_arm64_header_dir=$install/qhull-ios-device-arm64/include
###
# Create Framework Directory
###
pcl_framework=$install/frameworks-universal/${PACKAGENAME}.framework
mkdir -p ${pcl_framework}
rm -rf $pcl_framework/*
###
# Create Framework
###
cp -R "${current_ios_device_framework}" "${pcl_framework}/.."
cp -R "${current_ios_sim_framework}" "${pcl_framework}/.."
mkdir $pcl_framework/Headers
# cp -R $pcl_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $boost_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $eigen_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $flann_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $qhull_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $pcl_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $boost_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $eigen_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $flann_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $qhull_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
# mkdir $pcl_framework/Modules
# cp module.modulemap $pcl_framework/Modules/
cp ../iOSWrapper/module.modulemap $pcl_framework/
# debug libs
# ranlib $boost_sim_libs
# ranlib $flann_sim_libs
# ranlib $qhull_sim_libs
# ranlib $pcl_sim_libs
# combine libraries
# libtool -static -o $pcl_framework/pcl_device $pcl_device_libs $boost_device_libs $flann_device_libs $qhull_device_libs $current_ios_device_framework/pcl
# device
libtool -static -o $pcl_framework/pcl_device $pcl_device_arm64_libs $boost_arm64_device_libs $flann_arm64_device_libs $qhull_arm64_device_libs $pcl_device_armv7_libs $boost_armv7_device_libs $flann_armv7_device_libs $qhull_armv7_device_libs $pcl_device_armv7s_libs $boost_armv7s_device_libs $flann_armv7s_device_libs $qhull_armv7s_device_libs $current_ios_device_framework/pcl
# simulator
libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs $qhull_sim_libs $pcl_sim_i386_libs $boost_sim_i386_libs $flann_sim_i386_libs $qhull_sim_i386_libs $current_ios_sim_framework/pcl
# libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs $qhull_sim_libs $current_ios_sim_framework/pcl
# combine Xcode generator frameworks and external build libraries
lipo -create -output $pcl_framework/pcl $pcl_framework/pcl_device $pcl_framework/pcl_sim
# remove tmp library files
rm -rf $pcl_framework/pcl_*
}
make_framework_universal2 ()
{
# framework tree style
###
# Variable setting
###
# Xcode device/simulation Wrapper framework path
current_ios_device_framework=../iOSWrapper/build.ios/${CONFIGUTATION}-iphoneos/${PACKAGENAME}.framework
current_ios_sim_framework=../iOSWrapper/build.sim64/${CONFIGUTATION}-iphonesimulator/${PACKAGENAME}.framework
# current_ios_sim_i386_framework=../iOSWrapper/build.sim/${CONFIGUTATION}-iphonesimulator/${PACKAGENAME}.framework
FRAMEWORK_VERSION="A"
# device_folder = "ios-device"
# simulator_folder = "ios-simulator"
# pcl_device_libs=`find $install/pcl-${device_folder} $install/flann-${device_folder} $install/boost-${device_folder} -name *.a`
# all device arch(not use)
# pcl_device_libs=`find $install/pcl-ios-device -name *.a`
# boost_device_libs=`find $install/boost-ios-device -name *.a`
# flann_device_libs=`find $install/flann-ios-device -name *.a`
# qhull_device_libs=`find $install/qhull-ios-device -name *.a`
# arm64
pcl_device_arm64_libs=`find $install/pcl-ios-device-arm64 -name *.a`
boost_device_arm64_libs=`find $install/boost-ios-device-arm64 -name *.a`
flann_device_arm64_libs=`find $install/flann-ios-device-arm64 -name *.a`
qhull_device_arm64_libs=`find $install/qhull-ios-device-arm64 -name *.a`
# armv7
pcl_device_armv7_libs=`find $install/pcl-ios-device-armv7 -name *.a`
boost_device_armv7_libs=`find $install/boost-ios-device-armv7 -name *.a`
flann_device_armv7_libs=`find $install/flann-ios-device-armv7 -name *.a`
qhull_device_armv7_libs=`find $install/qhull-ios-device-armv7 -name *.a`
# armv7s
pcl_device_armv7s_libs=`find $install/pcl-ios-device-armv7s -name *.a`
boost_device_armv7s_libs=`find $install/boost-ios-device-armv7s -name *.a`
flann_device_armv7s_libs=`find $install/flann-ios-device-armv7s -name *.a`
qhull_device_armv7s_libs=`find $install/qhull-ios-device-armv7s -name *.a`
# pcl_sim_libs=`find $install/pcl-${simulator_folder} $install/flann-${simulator_folder} $install/boost-${simulator_folder} -name *.a`
pcl_sim_libs=`find $install/pcl-ios-simulator -name *.a`
boost_sim_libs=`find $install/boost-ios-simulator -name *.a`
flann_sim_libs=`find $install/flann-ios-simulator -name *.a`
qhull_sim_libs=`find $install/qhull-ios-simulator -name *.a`
# x86_64
# pcl_sim_x86_64_libs=`find $install/pcl-ios-simulator-x86-64 -name *.a`
# boost_sim_x86_64_libs=`find $install/boost-ios-simulator-x86-64 -name *.a`
# flann_sim_x86_64_libs=`find $install/flann-ios-simulator-x86-64 -name *.a`
# qhull_sim_x86_64_libs=`find $install/qhull-ios-simulator-x86-64 -name *.a`
# i386
# pcl_sim_i386_libs=`find $install/pcl-ios-simulator-i386 -name *.a`
# boost_sim_i386_libs=`find $install/boost-ios-simulator-i386 -name *.a`
# flann_sim_i386_libs=`find $install/flann-ios-simulator-i386 -name *.a`
# qhull_sim_i386_libs=`find $install/qhull-ios-simulator-i386 -name *.a`
# args -> version
# version 1.7
# pcl_header_dir=$install/pcl-${device_folder}/include/pcl-1.7
# version 1.8
# common
pcl_header_dir=$install/pcl-ios-device/include/pcl-${PCL_VERSION}
boost_header_dir=$install/boost-ios-device/include
eigen_header_dir=$install/eigen
flann_header_dir=$install/flann-ios-device/include
qhull_header_dir=$install/qhull-ios-device/include
# arm64
pcl_arm64_header_dir=$install/pcl-ios-device-arm64/include/pcl-${PCL_VERSION}
boost_arm64_header_dir=$install/boost-ios-device-arm64/include
eigen_arm64_header_dir=$install/eigen
flann_arm64_header_dir=$install/flann-ios-device-arm64/include
qhull_arm64_header_dir=$install/qhull-ios-device-arm64/include
# Create Framework Directory
pcl_framework=$install/frameworks-universal/${PACKAGENAME}.framework
mkdir -p ${pcl_framework}
rm -rf $pcl_framework/*
mkdir -p ${pcl_framework}/Versions
mkdir -p ${pcl_framework}/Versions/${FRAMEWORK_VERSION}
mkdir -p ${pcl_framework}/Versions/${FRAMEWORK_VERSION}/Resources
mkdir -p ${pcl_framework}/Versions/${FRAMEWORK_VERSION}/Headers
ln -s ${FRAMEWORK_VERSION} ${pcl_framework}/Versions/Current
ln -s Versions/Current/Headers ${pcl_framework}/Headers
ln -s Versions/Current/Resources ${pcl_framework}/Resources
ln -s Versions/Current/${FRAMEWORK_NAME} ${pcl_framework}/pcl
# Create Framework
# cp -R "${current_ios_device_framework}" "${pcl_framework}/.."
# cp -R "${current_ios_sim_framework}" "${pcl_framework}/.."
cp -R "${current_ios_device_framework}/*.hpp" "${pcl_framework}/Headers/"
cp -R "${current_ios_device_framework}/*.h" "${pcl_framework}/Headers/"
cp -R "${current_ios_device_framework}/*.plist" "${pcl_framework}/Resources/"
cp -R "${current_ios_sim_framework}/*.hpp" "${pcl_framework}/Headers/"
cp -R "${current_ios_sim_framework}/*.h" "${pcl_framework}/Headers/"
cp -R "${current_ios_sim_framework}/*.plist" "${pcl_framework}/Resources/"
# Public Header
mkdir $pcl_framework/Headers
# cp -R $pcl_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $boost_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $eigen_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $flann_header_dir/* $pcl_framework/Headers/ 2>&1
# cp -R $qhull_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $pcl_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $boost_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $eigen_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $flann_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
cp -R $qhull_arm64_header_dir/* $pcl_framework/Headers/ 2>&1
# mkdir $pcl_framework/Modules
# cp module.modulemap $pcl_framework/Modules/
cp ../iOSWrapper/module.modulemap $pcl_framework/
cp ../iOSWrapper/vertex.h $pcl_framework/Headers/
# debug libs
# ranlib $boost_sim_libs
# ranlib $flann_sim_libs
# ranlib $qhull_sim_libs
# ranlib $pcl_sim_libs
# combine libraries
# libtool -static -o $pcl_framework/pcl_device $pcl_device_libs $boost_device_libs $flann_device_libs $qhull_device_libs $current_ios_device_framework/pcl
# device
libtool -static -o $pcl_framework/pcl_device $pcl_device_arm64_libs $boost_arm64_device_libs $flann_arm64_device_libs $qhull_arm64_device_libs $pcl_device_armv7_libs $boost_armv7_device_libs $flann_armv7_device_libs $qhull_armv7_device_libs $pcl_device_armv7s_libs $boost_armv7s_device_libs $flann_armv7s_device_libs $qhull_armv7s_device_libs $current_ios_device_framework/pcl
# simulator
# libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs $qhull_sim_libs $pcl_sim_i386_libs $boost_sim_i386_libs $flann_sim_i386_libs $qhull_sim_i386_libs $current_ios_sim_framework/pcl $current_ios_sim_i386_framework/pcl
libtool -static -o $pcl_framework/pcl_sim $pcl_sim_libs $boost_sim_libs $flann_sim_libs $qhull_sim_libs $current_ios_sim_framework/pcl
# combine Xcode generator frameworks and external build libraries
lipo -create -output $pcl_framework/Versions/Current/pcl $pcl_framework/pcl_device $pcl_framework/pcl_sim
# remove tmp library files
rm -rf $pcl_framework/pcl_*
}
#------------------------------------------------------------------------------
if [ "$1" == "pcl" ]; then
make_framework
elif [ "$1" == "universal" ]; then
make_framework_universal
elif [ "$1" == "device" ]; then
make_framework_device
elif [ "$1" == "simulator" ]; then
make_framework_simulator
else
echo "Usage: $0 universal/device/simulator"
exit 1
fi