-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·661 lines (632 loc) · 21.4 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
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
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
#!/bin/bash
set -e -x
echo "HOST_TRIPLE: ${HOST_TRIPLE}"
echo "LIBSBML_VERSION: ${LIBSBML_VERSION}"
echo "LIBEXPAT_VERSION: ${LIBEXPAT_VERSION}"
echo "SYMENGINE_VERSION: ${SYMENGINE_VERSION}"
echo "GMP_VERSION: ${GMP_VERSION}"
echo "MPFR_VERSION: ${MPFR_VERSION}"
echo "SPDLOG_VERSION: ${SPDLOG_VERSION}"
echo "LIBTIFF_VERSION: ${LIBTIFF_VERSION}"
echo "FMT_VERSION: ${FMT_VERSION}"
echo "TBB_VERSION: ${TBB_VERSION}"
echo "OPENCV_VERSION: ${OPENCV_VERSION}"
echo "CATCH2_VERSION: ${CATCH2_VERSION}"
echo "BENCHMARK_VERSION: ${BENCHMARK_VERSION}"
echo "CGAL_VERSION: ${CGAL_VERSION}"
echo "BOOST_VERSION: ${BOOST_VERSION}"
echo "BOOST_VERSION_: ${BOOST_VERSION_}"
echo "BOOST_INSTALL_PREFIX: ${BOOST_INSTALL_PREFIX}"
echo "BOOST_BOOTSTRAP_OPTIONS: ${BOOST_BOOTSTRAP_OPTIONS}"
echo "BOOST_B2_OPTIONS: ${BOOST_B2_OPTIONS}"
echo "QCUSTOMPLOT_VERSION: ${QCUSTOMPLOT_VERSION}"
echo "CEREAL_VERSION: ${CEREAL_VERSION}"
echo "PAGMO_VERSION: ${PAGMO_VERSION}"
echo "BZIP2_VERSION: ${BZIP2_VERSION}"
echo "ZIPPER_VERSION: ${ZIPPER_VERSION}"
echo "COMBINE_VERSION: ${COMBINE_VERSION}"
echo "FUNCTION2_VERSION: ${FUNCTION2_VERSION}"
echo "VTK_VERSION: ${VTK_VERSION}"
echo "SCOTCH_VERSION: ${SCOTCH_VERSION}"
NPROCS=4
echo "NPROCS: ${NPROCS}"
echo "PATH: ${PATH}"
echo "SUDO_CMD: ${SUDO_CMD}"
which g++
g++ --version
which make
make --version
which python
python --version
which cmake
cmake --version
# install function2 headers
git clone -b $FUNCTION2_VERSION --depth 1 https://github.com/Naios/function2.git
cd function2
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX"
${SUDO_CMD} ninja install
cd ../../
# build static version of bzip2
wget https://sourceware.org/pub/bzip2/bzip2-${BZIP2_VERSION}.tar.gz
tar xf bzip2-${BZIP2_VERSION}.tar.gz
cd bzip2-${BZIP2_VERSION}
# copy of existing cflags from Makefile with additional -fPIC
BZIP2_CFLAGS="-O2 -g -D_FILE_OFFSET_BITS=64 -fPIC"
# also specify CC if CC env var is set
if [ -z "$CC" ]; then make "CFLAGS=${BZIP2_CFLAGS}" -j${NPROCS}; else make CC=${CC} "CFLAGS=${BZIP2_CFLAGS}" -j${NPROCS}; fi
make install PREFIX="$INSTALL_PREFIX"
cd ../
# install Cereal headers
git clone -b $CEREAL_VERSION --depth 1 https://github.com/USCiLab/cereal.git
cd cereal
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DJUST_INSTALL_CEREAL=ON
${SUDO_CMD} ninja install
cd ../../
# build static version of QCustomPlot (using our own cmakelists)
wget https://www.qcustomplot.com/release/${QCUSTOMPLOT_VERSION}/QCustomPlot-source.tar.gz
tar xf QCustomPlot-source.tar.gz
cp qcustomplot-source/* qcustomplot/.
cd qcustomplot
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DZLIB_INCLUDE_DIR=${INSTALL_PREFIX}/include \
-DZLIB_LIBRARY_RELEASE=${INSTALL_PREFIX}/lib/libz.a \
-DWITH_QT6=ON
time ninja
${SUDO_CMD} ninja install
cd ../../
# build static version of boost serialization & install headers
wget https://archives.boost.io/release/${BOOST_VERSION}/source/boost_${BOOST_VERSION_}.tar.gz
tar xf boost_${BOOST_VERSION_}.tar.gz
cd boost_${BOOST_VERSION_}
./bootstrap.sh ${BOOST_BOOTSTRAP_OPTIONS} --prefix="${BOOST_INSTALL_PREFIX}" --with-libraries=serialization
${SUDO_CMD} ./b2 ${BOOST_B2_OPTIONS} link=static install
cd ..
# build static version of Google Benchmark library
git clone -b $BENCHMARK_VERSION --depth 1 https://github.com/google/benchmark.git
cd benchmark
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBENCHMARK_ENABLE_WERROR=OFF \
-DBENCHMARK_ENABLE_TESTING=OFF
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of Catch2 library
git clone -b $CATCH2_VERSION --depth 1 https://github.com/catchorg/Catch2.git
cd Catch2
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_SHARED_LIBS=OFF \
-DCATCH_INSTALL_DOCS=OFF \
-DCATCH_INSTALL_EXTRAS=ON
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of opencv library
git clone -b $OPENCV_VERSION --depth 1 https://github.com/opencv/opencv.git
cd opencv
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_opencv_apps=OFF \
-DBUILD_opencv_calib3d=OFF \
-DBUILD_opencv_core=ON \
-DBUILD_opencv_dnn=OFF \
-DBUILD_opencv_features2d=OFF \
-DBUILD_opencv_flann=OFF \
-DBUILD_opencv_gapi=OFF \
-DBUILD_opencv_highgui=OFF \
-DBUILD_opencv_imgcodecs=OFF \
-DBUILD_opencv_imgproc=ON \
-DBUILD_opencv_java_bindings_generator=OFF \
-DBUILD_opencv_js=OFF \
-DBUILD_opencv_ml=OFF \
-DBUILD_opencv_objdetect=OFF \
-DBUILD_opencv_photo=OFF \
-DBUILD_opencv_python_bindings_generator=OFF \
-DBUILD_opencv_python_tests=OFF \
-DBUILD_opencv_stitching=OFF \
-DBUILD_opencv_ts=OFF \
-DBUILD_opencv_video=OFF \
-DBUILD_opencv_videoio=OFF \
-DBUILD_opencv_world=OFF \
-DBUILD_CUDA_STUBS:BOOL=OFF \
-DBUILD_DOCS:BOOL=OFF \
-DBUILD_EXAMPLES:BOOL=OFF \
-DBUILD_FAT_JAVA_LIB:BOOL=OFF \
-DBUILD_IPP_IW:BOOL=OFF \
-DBUILD_ITT:BOOL=OFF \
-DBUILD_JASPER:BOOL=OFF \
-DBUILD_JAVA:BOOL=OFF \
-DBUILD_JPEG:BOOL=OFF \
-DBUILD_OPENEXR:BOOL=OFF \
-DBUILD_PACKAGE:BOOL=OFF \
-DBUILD_PERF_TESTS:BOOL=OFF \
-DBUILD_PNG:BOOL=OFF \
-DBUILD_PROTOBUF:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_TBB:BOOL=OFF \
-DBUILD_TESTS:BOOL=OFF \
-DBUILD_TIFF:BOOL=OFF \
-DBUILD_USE_SYMLINKS:BOOL=OFF \
-DBUILD_WEBP:BOOL=OFF \
-DBUILD_WITH_DEBUG_INFO:BOOL=OFF \
-DBUILD_WITH_DYNAMIC_IPP:BOOL=OFF \
-DBUILD_ZLIB:BOOL=OFF \
-DWITH_1394:BOOL=OFF \
-DWITH_ADE:BOOL=OFF \
-DWITH_ARAVIS:BOOL=OFF \
-DWITH_CLP:BOOL=OFF \
-DWITH_CUDA:BOOL=OFF \
-DWITH_EIGEN:BOOL=OFF \
-DWITH_FFMPEG:BOOL=OFF \
-DWITH_FREETYPE:BOOL=OFF \
-DWITH_GDAL:BOOL=OFF \
-DWITH_GDCM:BOOL=OFF \
-DWITH_GPHOTO2:BOOL=OFF \
-DWITH_GSTREAMER:BOOL=OFF \
-DWITH_GTK:BOOL=OFF \
-DWITH_GTK_2_X:BOOL=OFF \
-DWITH_HALIDE:BOOL=OFF \
-DWITH_HPX:BOOL=OFF \
-DWITH_IMGCODEC_HDR:BOOL=OFF \
-DWITH_IMGCODEC_PFM:BOOL=OFF \
-DWITH_IMGCODEC_PXM:BOOL=OFF \
-DWITH_IMGCODEC_SUNRASTER:BOOL=OFF \
-DWITH_INF_ENGINE:BOOL=OFF \
-DWITH_IPP:BOOL=OFF \
-DWITH_ITT:BOOL=OFF \
-DWITH_JASPER:BOOL=OFF \
-DWITH_JPEG:BOOL=OFF \
-DWITH_LAPACK:BOOL=OFF \
-DWITH_LIBREALSENSE:BOOL=OFF \
-DWITH_MFX:BOOL=OFF \
-DWITH_NGRAPH:BOOL=OFF \
-DWITH_OPENCL:BOOL=OFF \
-DWITH_OPENCLAMDBLAS:BOOL=OFF \
-DWITH_OPENCLAMDFFT:BOOL=OFF \
-DWITH_OPENCL_SVM:BOOL=OFF \
-DWITH_OPENEXR:BOOL=OFF \
-DWITH_OPENGL:BOOL=OFF \
-DWITH_OPENJPEG:BOOL=OFF \
-DWITH_OPENMP:BOOL=OFF \
-DWITH_OPENNI:BOOL=OFF \
-DWITH_OPENNI2:BOOL=OFF \
-DWITH_OPENVX:BOOL=OFF \
-DWITH_PLAIDML:BOOL=OFF \
-DWITH_PNG:BOOL=OFF \
-DWITH_PROTOBUF:BOOL=OFF \
-DWITH_PTHREADS_PF:BOOL=OFF \
-DWITH_PVAPI:BOOL=OFF \
-DWITH_QT:BOOL=OFF \
-DWITH_QUIRC:BOOL=OFF \
-DWITH_TBB:BOOL=OFF \
-DWITH_TIFF:BOOL=OFF \
-DWITH_V4L:BOOL=OFF \
-DWITH_VA:BOOL=OFF \
-DWITH_VA_INTEL:BOOL=OFF \
-DWITH_VTK:BOOL=OFF \
-DWITH_VULKAN:BOOL=OFF \
-DWITH_WEBP:BOOL=OFF \
-DWITH_XIMEA:BOOL=OFF \
-DWITH_XINE:BOOL=OFF \
-DZLIB_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DZLIB_LIBRARY_RELEASE=$INSTALL_PREFIX/lib/libz.a
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of oneTBB
git clone -b $TBB_VERSION --depth 1 https://github.com/oneapi-src/oneTBB.git
cd oneTBB
# patch for "c++.exe: fatal error: input file '/dev/null' is the same as output file" issue on windows due to cmake execute_process quoting command
# line 50 of https://github.com/uxlfoundation/oneTBB/commit/377e6c3b1719f8cc7b68f9d0939e652d7e3bf776#diff-08a9ef6921a1ae25a4447b8a4ff5740038771e549fb6f0ff69dafb35c342a8b8R5
# instead of calling c++ to get the binutils version we get it from CMAKE_CXX_COMPILER_LINKER_VERSION
# note: this works fine for us as we use binutils for linker and assembler, haven't checked if it also works if a different linker is used.
git apply --ignore-space-change --ignore-whitespace --verbose ../tbb.diff
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DTBB_ENABLE_IPO="$TBB_ENABLE_IPO" \
-DTBB_STRICT=OFF \
-DTBB_TEST=OFF
VERBOSE=1 time ninja tbb
#time make test
${SUDO_CMD} ninja install
cd ../../
# build static version of oneDPL
git clone -b $DPL_VERSION --depth 1 https://github.com/oneapi-src/oneDPL
cd oneDPL
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DONEDPL_BACKEND="tbb"
time ninja
${SUDO_CMD} ninja install
cd ../../
# build static version of pagmo
git clone -b $PAGMO_VERSION --depth 1 https://github.com/esa/pagmo2.git
cd pagmo2
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" \
-DPAGMO_BUILD_STATIC_LIBRARY=ON \
-DPAGMO_BUILD_TESTS=OFF
VERBOSE=1 time ninja
#time make test
${SUDO_CMD} ninja install
cd ../../
# build static version of expat xml library
git clone -b $LIBEXPAT_VERSION --depth 1 https://github.com/libexpat/libexpat.git
cd libexpat
mkdir build
cd build
cmake -GNinja ../expat \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DEXPAT_BUILD_DOCS=OFF \
-DEXPAT_BUILD_EXAMPLES=OFF \
-DEXPAT_BUILD_TOOLS=OFF \
-DEXPAT_SHARED_LIBS=OFF \
-DEXPAT_BUILD_TESTS:BOOL=OFF
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of libSBML including spatial extension
git clone -b $LIBSBML_VERSION --depth 1 https://github.com/sbmlteam/libsbml.git
cd libsbml
git status
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_PREFIX_PATH="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DENABLE_SPATIAL=ON \
-DWITH_CPP_NAMESPACE=ON \
-DWITH_THREADSAFE_PARSER=ON \
-DLIBSBML_SKIP_SHARED_LIBRARY=ON \
-DWITH_BZIP2=ON \
-DLIBBZ_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DLIBBZ_LIBRARY=$INSTALL_PREFIX/lib/libbz2.a \
-DWITH_ZLIB=ON \
-DLIBZ_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DLIBZ_LIBRARY=$INSTALL_PREFIX/lib/libz.a \
-DWITH_SWIG=OFF \
-DWITH_LIBXML=OFF \
-DWITH_EXPAT=ON \
-DEXPAT_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DEXPAT_LIBRARY=$INSTALL_PREFIX/lib/libexpat.a
time ninja
${SUDO_CMD} ninja install
cd ../../
# libCombine
git clone -b $COMBINE_VERSION --depth 1 https://github.com/sbmlteam/libCombine.git
cd libCombine
# get zipper submodule
git submodule update --init submodules/zipper
cd submodules/zipper
git checkout $ZIPPER_VERSION
cd ../../
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$BOOST_INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DLIBCOMBINE_SKIP_SHARED_LIBRARY=ON \
-DWITH_CPP_NAMESPACE=ON \
-DCMAKE_PREFIX_PATH="$BOOST_INSTALL_PREFIX;$BOOST_INSTALL_PREFIX/lib/cmake" \
-DEXTRA_LIBS="$BOOST_INSTALL_PREFIX/lib/libz.a;$BOOST_INSTALL_PREFIX/lib/libbz2.a;$BOOST_INSTALL_PREFIX/lib/libexpat.a" \
-DZLIB_INCLUDE_DIR=$BOOST_INSTALL_PREFIX/include \
-DZLIB_LIBRARY=$BOOST_INSTALL_PREFIX/lib/libz.a
time ninja
#ninja test
${SUDO_CMD} ninja install
cd ../../
# build static version of fmt
git clone -b $FMT_VERSION --depth 1 https://github.com/fmtlib/fmt.git
cd fmt
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_STANDARD=20 \
-DFMT_DOC=OFF \
-DFMT_TEST:BOOL=OFF
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of libTIFF
git clone -b $LIBTIFF_VERSION --depth 1 https://gitlab.com/libtiff/libtiff.git
cd libtiff
# apply patch to fix "CMath target not found error" when this installed libtiff is used
# (note libtiff cmake install is broken for all dependencies, so for now we just disable them all)
git apply --ignore-space-change --ignore-whitespace --verbose ../libtiff.diff
mkdir cmake-build
cd cmake-build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-Djpeg=OFF \
-Djpeg12=OFF \
-Djbig=OFF \
-Dlzma=OFF \
-Dlibdeflate=OFF \
-Dpixarlog=OFF \
-Dold-jpeg=OFF \
-Dzstd=OFF \
-Dmdi=OFF \
-Dwebp=OFF \
-Dzlib=OFF \
-DGLUT_INCLUDE_DIR=GLUT_INCLUDE_DIR-NOTFOUND \
-DOPENGL_INCLUDE_DIR=OPENGL_INCLUDE_DIR-NOTFOUND
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of spdlog
git clone -b $SPDLOG_VERSION --depth 1 https://github.com/gabime/spdlog.git
cd spdlog
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_STANDARD=20 \
-DSPDLOG_BUILD_TESTS=OFF \
-DSPDLOG_BUILD_EXAMPLE=OFF \
-DSPDLOG_FMT_EXTERNAL=ON \
-DSPDLOG_NO_THREAD_ID=ON \
-DSPDLOG_NO_ATOMIC_LEVELS=ON \
-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# build static version of gmp
# temporary workaround for gmp blacklisting github ips:
# wget https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.xz
wget https://github.com/spatial-model-editor/spatial-model-editor.github.io/releases/download/1.0.0/gmp-${GMP_VERSION}.tar.xz
# workaround for msys2 (`tar xf file.tar.xz` hangs): https://github.com/msys2/MSYS2-packages/issues/1548
xz -dc gmp-${GMP_VERSION}.tar.xz | tar -x --file=-
cd gmp-${GMP_VERSION}
./configure \
--prefix=$INSTALL_PREFIX \
--disable-shared \
--host=${HOST_TRIPLE} \
--enable-static \
--with-pic \
--enable-cxx
time make -j$NPROCS
#time make check
${SUDO_CMD} make install
cd ..
# build static version of mpfr
wget https://www.mpfr.org/mpfr-${MPFR_VERSION}/mpfr-${MPFR_VERSION}.tar.xz
# workaround for msys2 (`tar xf file.tar.xz` hangs): https://github.com/msys2/MSYS2-packages/issues/1548
xz -dc mpfr-${MPFR_VERSION}.tar.xz | tar -x --file=-
cd mpfr-${MPFR_VERSION}
./configure \
--prefix=$INSTALL_PREFIX \
--disable-shared \
--host=${HOST_TRIPLE} \
--enable-static \
--with-pic \
--with-gmp-lib=$INSTALL_PREFIX/lib \
--with-gmp-include=$INSTALL_PREFIX/include
time make -j$NPROCS
#time make check
${SUDO_CMD} make install
cd ..
# install CGAL (should just be copying headers)
git clone -b $CGAL_VERSION --depth 1 https://github.com/CGAL/cgal.git
cd cgal
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DWITH_CGAL_ImageIO=OFF \
-DWITH_CGAL_Qt5=OFF
${SUDO_CMD} ninja install
cd ../../
# build static version of symengine
git clone -b $SYMENGINE_VERSION --depth 1 https://github.com/symengine/symengine.git
cd symengine
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_BENCHMARKS=OFF \
-DGMP_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DGMP_LIBRARY=$INSTALL_PREFIX/lib/libgmp.a \
-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX \
-DWITH_LLVM=ON \
-DWITH_COTIRE=OFF \
-DWITH_SYSTEM_CEREAL=ON \
-DWITH_SYMENGINE_THREAD_SAFE=ON \
-DBUILD_TESTS=OFF
time ninja
#time make test
${SUDO_CMD} ninja install
cd ../../
# build minimal static version of VTK including GUISupportQt and RenderingQt modules
git clone -b $VTK_VERSION --depth 1 https://github.com/Kitware/VTK.git
cd VTK
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DVTK_GROUP_ENABLE_StandAlone=DONT_WANT \
-DVTK_GROUP_ENABLE_Rendering=YES \
-DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingQt=YES \
-DVTK_MODULE_USE_EXTERNAL_VTK_expat=ON \
-DEXPAT_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DEXPAT_LIBRARY=$INSTALL_PREFIX/lib/libexpat.a \
-DVTK_MODULE_USE_EXTERNAL_VTK_fmt=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_tiff=ON \
-DTIFF_INCLUDE_DIR=${INSTALL_PREFIX}/include \
-DTIFF_LIBRARY_RELEASE=${INSTALL_PREFIX}/lib/libtiff.a \
-DVTK_MODULE_USE_EXTERNAL_VTK_zlib=ON \
-DZLIB_INCLUDE_DIR=${INSTALL_PREFIX}/include \
-DZLIB_LIBRARY_RELEASE=${INSTALL_PREFIX}/lib/libz.a \
-DVTK_MODULE_USE_EXTERNAL_VTK_freetype=ON \
-DVTK_LEGACY_REMOVE=ON \
-DVTK_USE_FUTURE_CONST=ON \
-DVTK_USE_FUTURE_BOOL=ON \
-DVTK_ENABLE_LOGGING=OFF \
-DVTK_USE_CUDA=OFF \
-DVTK_USE_MPI=OFF \
-DVTK_ENABLE_WRAPPING=OFF \
${VTK_OPTIONS}
time ninja
#make test
${SUDO_CMD} ninja install
cd ../../
# Scotch (includes METIS compatibility library)
git clone -b $SCOTCH_VERSION --depth 1 https://gitlab.inria.fr/scotch/scotch.git
cd scotch
mkdir build
cd build
cmake -GNinja .. \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET}" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_CXX_FLAGS="-fpic -fvisibility=hidden" \
-DCMAKE_PREFIX_PATH=$INSTALL_PREFIX \
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DBUILD_PTSCOTCH=OFF \
-DBUILD_LIBESMUMPS=OFF \
-DBUILD_FORTRAN=OFF \
-DUSE_LZMA=OFF \
-DUSE_ZLIB=ON \
-DZLIB_INCLUDE_DIR=${INSTALL_PREFIX}/include \
-DZLIB_LIBRARY_RELEASE=${INSTALL_PREFIX}/lib/libz.a \
-DUSE_BZ2=ON \
-DBZIP2_INCLUDE_DIR=$INSTALL_PREFIX/include \
-DBZIP2_LIBRARY_RELEASE=$INSTALL_PREFIX/lib/libbz2.a
time ninja
${SUDO_CMD} ninja install
cd ../../
ccache --show-stats
mkdir artefacts
cd artefacts
tar -zcvf sme_deps_common_${OS}.tgz $INSTALL_PREFIX/*