-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathbuild.sh
executable file
·612 lines (538 loc) · 22.1 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
#!/bin/bash
bak=~+
#flags
flag_pause_on_end=true
CMAKE_EXTRA_ARGS=""
MAKE_EXTRA_ARGS="-r"
MAKE_CPUS_COUNT=4
CMAKE_GENERATOR="Unix Makefiles"
flag_debugThisScript=false
flag_debugDependencies=false
flag_pack_src=false
flag_pack_src_gz=false
flag_cmake_it_ninja=false
flag_cmake_deploy=false
flag_cmake_static_qt=false
flag_debug_build=false
flag_portable=false
for var in "$@"
do
case "$var" in
lupdate)
#dummy
;;
lrelease)
#dummy
;;
--help)
echo ""
printf "=== \e[44mBuild script for PGE Project for UNIX-Like operating\e[0m ===\n"
echo ""
if [[ "$(which cmake)" == "" ]]; then
printf " \E[0;4;41;37mIMPORTANT!: CMake is not installed! CMake is required to build this project.\E[0m\n\n"
fi
printf "\E[4mSYNTAX:\E[0m\n"
echo ""
printf " $0 \e[90m[<arg1>] [<arg2>] [<arg2>] ...\e[0m\n"
echo ""
printf "\E[4mAVAILABLE ARGUMENTS:\E[0m\n"
echo ""
echo "--- Actions ---"
printf " \E[1;4mlupdate\E[0m - Update the translations\n"
printf " \E[1;4mclean\E[0m - Remove all object files and caches to build from scratch\n"
printf " \E[1;4mupdate-submodules\E[0m- Pull all submodules up to their latest states\n"
printf " \E[1;4mrepair-submodules\E[0m- Repair invalid or broken submodules\n"
printf " \E[1;4misvalid\E[0m - Show validation state of dependencies\n"
printf " \E[1;4m--help\E[0m - Print this manual\n"
printf " \E[1;4mldoc\E[0m - Make lua documentation\n"
if [[ ! -f ../LDoc/ldoc.lua ]]; then
printf " \E[0;4;41;37m<LDoc repository is not clonned! Clone it into parent folder!>\E[0m\n"
elif [[ ! -f ./build-pge-cmake-release/bin/luajit-2.1.0-beta3 ]]; then
printf " \E[0;4;44;37m<To use LDoc you need to build the project first!>\E[0m\n"
fi
printf " \E[1;4mpack-src\E[0m - Create the source code archive\n"
printf " (git-archive-all is required!)\n"
if [[ "$(which git-archive-all)" == "" ]]; then
printf " \E[0;4;41;37m<git-archive-all is not installed!>\E[0m\n"
fi
echo ""
echo "--- Flags ---"
printf " \E[1;4mno-pause\E[0m - Don't pause script on completion'\n"
printf " \E[1;4msilent-make\E[0m - Don't print build commands for each building file\n"
printf " \E[1;4mdebug\E[0m - Run build in debug configuration'\n"
printf " \E[1;4mninja\E[0m - Use Ninja build system (CMake only build)'\n"
if [[ "$(which ninja)" == "" ]]; then
printf " \E[0;4;41;37m<ninja is not installed!>\E[0m\n"
fi
printf " \E[1;4mdeploy\E[0m - Automatically run a deploymed'\n"
printf " \E[1;4muse-ccache\E[0m - Use the CCache to speed-up build process\n"
if [[ "$(which ccache)" == "" ]]; then
printf " \E[0;4;41;37m<ccache is not installed!>\E[0m"
fi
printf "\n"
echo ""
echo "--- Compile options ---"
printf " \E[1;4msystem-png\E[0m - Prefer to use libPNG and ZLib from system\n"
printf " \E[1;4msystem-libs\E[0m - Prefer to use most of libraries from system\n"
printf " \E[1;4mqt-png\E[0m - Prefer to use libPNG and ZLib from the static Qt toolchain\n"
if [[ "$OSTYPE" == "darwin"* ]]; then
printf " \E[1;4mmac-universal\E[0m - Attempt to build the universal build for ARM64 and x86_64\n"
fi
printf "\n"
echo ""
echo "--- Deployment options ---"
printf " \E[1;4mportable\E[0m - Deploy a portable installation that will don't store\n"
printf " settings, logs, and game saves in system or home directory.\n"
if [[ "$OSTYPE" == "darwin"* ]]; then
printf " \E[0;4;44;37m<Not supported on macOS, this option will take no effect>\E[0m\n"
fi
printf "\n"
echo ""
echo "--- Disable building of components ---"
printf " \E[1;4mnoqt\E[0m - Skip building of components are using Qt\n"
printf " \E[1;4mnoeditor\E[0m - Skip building of PGE Editor compoment (Qt5)\n"
printf " \E[1;4mnoengine\E[0m - Skip building of PGE Engine compoment (SDL2)\n"
printf " \E[1;4mnocalibrator\E[0m - Skip building of Playable Character Calibrator (Qt5)\n"
printf " \E[1;4mnomaintainer\E[0m - Skip building of PGE Maintainer compoment (Qt5)\n"
printf " \E[1;4mnomanager\E[0m - Skip building of PGE Manager compoment (Qt5)\n"
printf " \E[1;4mnomusicplayer\E[0m - Skip building of PGE MusPlay compoment (Qt5)\n"
printf " \E[1;4mnogifs2png\E[0m - Skip building of GIFs2PNG compoment (STL)\n"
printf " \E[1;4mnopng2gifs\E[0m - Skip building of PNG2GIFs compoment (STL)\n"
printf " \E[1;4mnolazyfixtool\E[0m - Skip building of LazyFixTool compoment (STL)\n"
echo ""
echo "--- Special ---"
printf " \E[1;4mdebug-script\E[0m - Show some extra information to debug this script\n"
echo ""
echo "--- For fun ---"
printf " \E[1;4mcolors\E[0m - Prints various blocks of different color\n"
printf " with showing their codes\n"
printf " \E[1;4mcool\E[0m - Prints some strings inside the lines\n"
printf " (test of printLine command)\n"
echo ""
#printf "==== \e[43mIMPORTANT!\e[0m ====\n"
#echo "This script is designed for Linux and macOS operating systems."
#echo "If you trying to start it under Windows, it will automatically start"
#echo "the build.bat script instead of this."
#echo "===================="
#echo ""
exit 1
;;
no-pause)
flag_pause_on_end=false
;;
silent-make)
MAKE_EXTRA_ARGS="${MAKE_EXTRA_ARGS} -s"
;;
pack-src)
flag_pack_src=true
;;
gz)
flag_pack_src_gz=true
;;
cmake-it)
# dummy
;;
qmake-it)
echo "QMake support has been removed! Please use CMake build instead!"
exit 1;
;;
ninja)
CMAKE_GENERATOR="Ninja"
flag_cmake_it_ninja=true
MAKE_EXTRA_ARGS=""
;;
deploy)
flag_cmake_deploy=true
;;
portable)
flag_portable=true
;;
static-qt)
flag_cmake_static_qt=true
;;
colors)
for((i=0;i<=1;i++))
do
printf "="
for((j=0;j<=7;j++))
do
printf "\E[${i};3${j};4${j}m"
printf "[${i};3${j};4${j}]"
printf "\E[0;00m "
done
printf "=\n"
done
exit 0
;;
ldoc)
# FIXME: 1) Autodetect luajit executible. 2) Don't rely on canonical paths, add LDoc as the submodule
cd Engine/doc
LUAJIT_BIN="../../build-pge-cmake-release/bin/luajit"
if [[ -f "../../build-pge-cmake-release/bin/luajit" ]]; then
LUAJIT_BIN="../../build-pge-cmake-release/bin/luajit"
elif [[ -f "../../build-pge-cmake-release/bin/luajit.exe" ]]; then
LUAJIT_BIN="../../build-pge-cmake-release/bin/luajit.exe"
elif [[ -f "../../build-pge-cmake-release/bin/luajit-2.1.0-beta3" ]]; then
LUAJIT_BIN="../../build-pge-cmake-release/bin/luajit-2.1.0-beta3"
fi
${LUAJIT_BIN} ../../../LDoc/ldoc.lua .
cd ../..
printf "\n==== Done! ====\n\n"
exit 0;
;;
use-ccache)
# FIXME: Implement this option for CMake case
# if [[ "$OSTYPE" == "linux-gnu" ]]; then
# QMAKE_EXTRA_ARGS="$QMAKE_EXTRA_ARGS -spec linux-g++ CONFIG+=useccache"
# else
# QMAKE_EXTRA_ARGS="$QMAKE_EXTRA_ARGS CONFIG+=useccache"
# fi
;;
clean)
echo "======== Remove all cached object files and automatically generated Makefiles ========"
if [[ -d ./${BinDir}/_build_x32 ]]; then
echo "removing ${BinDir}/_build_x32 ..."
rm -Rf ./${BinDir}/_build_x32
fi
if [[ -d ./${BinDir}/_build_x64 ]]; then
echo "removing ${BinDir}/_build_x64 ..."
rm -Rf ./${BinDir}/_build_x64
fi
if [[ -d ./build-pge-cmake-release/ ]]; then
echo "removing build-pge-cmake-release/ ..."
cd ./build-pge-cmake-release/
find . -not -path "./bin*" -delete
cd ..
fi
if [[ -d ./build-pge-cmake-debug/ ]]; then
echo "removing build-pge-cmake-debug/ ..."
cd ./build-pge-cmake-debug/
find . -not -path "./bin*" -delete
cd ..
fi
echo 'removing Dependencies build cache ...'
if [[ -d $PWD/_Libs/_sources/_build_cache ]];
then
echo "Deleting $PWD/_Libs/_sources/_build_cache..."
rm -Rf $PWD/_Libs/_sources/_build_cache
fi
echo "==== Clear! ===="
exit 0;
;;
update-submodules)
PATH=${PATH}:$PWD/_common
git submodule foreach submodule-update.sh
# EXTRA update Java files of Android project
printf "\n\n"
echo "Synchronize SDL Java headers..."
rm -vf Engine/android-project/moondust/src/main/java/org/libsdl/app/*.java
cp -v _Libs/AudioCodecs/SDL2/android-java-files/*.java Engine/android-project/moondust/src/main/java/org/libsdl/app
exit 0
;;
repair-submodules)
PATH=${PATH}:$PWD/_common
echo "=== Cleaning-up old state..."
git submodule foreach 'pwd; rm -Rf * .git*;'
echo "=== Fetching new submodules..."
git submodule init
git submodule update
echo ""
git submodule foreach submodule-update.sh
echo ""
echo "==== Fixed! ===="
exit 0;
;;
# Enable debugging of this script by showing states of internal variables with pauses
debug-script)
flag_debugThisScript=true
;;
debug)
flag_debug_build=true
;;
test)
flag_debugDependencies=true
;;
system-png)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DUSE_SYSTEM_LIBPNG=ON"
;;
qt-png)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DUSE_QT_LIBPNG=ON"
;;
system-libs)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DUSE_SYSTEM_LIBC=ON -DUSE_SYSTEM_LIBFREETYPE=ON -DUSE_SYSTEM_LIBPNG=ON -DUSE_SYSTEM_LIBJPEG=ON -DUSE_SYSTEM_SDL2=ON -DUSE_SYSTEM_SQLITE=ON -DPGE_STATIC_SDLMIXER=OFF -DUSE_SHARED_FREEIMAGE=ON"
;;
noqt)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_ENABLE_QT=OFF"
;;
mac-universal)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} \"-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64\""
;;
# Disable building of some components
noeditor)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_EDITOR=OFF"
;;
noengine)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_ENGINE=OFF"
;;
nocalibrator)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_PLAYERCALIBRATOR=OFF"
;;
nogifs2png)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_GIFS2PNG=OFF"
;;
nopng2gifs)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_PNG2GIFS=OFF"
;;
nolazyfixtool)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_LAZYFIXTOOL=OFF"
;;
nomanager)
# WIP
# CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_MANAGER=OFF"
;;
nomaintainer)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_MAINTAINER=OFF"
;;
nomusicplayer)
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} -DPGE_BUILD_MUSICPLAYER=OFF"
;;
*)
echo "--------------------------------------------------------------------"
echo "Invalid argument '$var', please type '$0 --help' to get the usage."
echo "--------------------------------------------------------------------"
exit 1;
;;
esac
done
#=============Detect directory that contains script=====================
SOURCE="${BASH_SOURCE[0]}"
while [[ -h "${SOURCE}" ]]; do # resolve $SOURCE until the file is no longer a symlink
SCRDIR="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
SOURCE="$(readlink "${SOURCE}")"
[[ ${SOURCE} != /* ]] && SOURCE="${DIR}/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
SCRDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
#=======================================================================
echo ${SCRDIR}
cd ${SCRDIR}
source ./_common/functions.sh
#=======================================================================
if [[ -f "${SCRDIR}/_paths.sh" ]]
then
source "${SCRDIR}/_paths.sh"
else
echo ""
echo "_paths.sh is not exist! Run \"generate_paths.sh\" first!"
errorofbuild
fi
if [[ "$PGE_OSX_TARGET" != "" ]]; then
CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS} \"-DPGE_OSX_TARGET=$PGE_OSX_TARGET\""
fi
PATH=${QT_PATH}:$PATH
LD_LIBRARY_PATH=${QT_LIB_PATH}:${LD_LIBRARY_PATH}
MAKE_CPUS_COUNT=$(getCpusCount)
if ${flag_debugThisScript}; then
echo "MAKE_EXTRA_ARGS = ${MAKE_EXTRA_ARGS}"
echo "MAKE_CPUS_COUNT = ${MAKE_CPUS_COUNT}"
pause
fi
# Check input arguments again
for var in "$@"
do
case "$var" in
cool)
printLine "Yeah!" "\E[0;42;37m" "\E[0;34m"
printLine "This must be cool!" "\E[0;42;36m" "\E[0;35m"
printLine "Really?" "\E[0;42;35m" "\E[0;31m"
printLine "You are cool!?" "\E[0;42;34m" "\E[0;32m"
printLine "Yeah!" "\E[0;42;33m" "\E[0;36m"
exit 0
;;
lupdate)
echo ""
echo "Running translation refreshing...";
LANGS_LIST="bg bs de en es fr hu he-il id it ja ko nl nb-no pl pt-br pt-pt ru ro sv sr tr uk zh"
printLine "Common Qt modules" "\E[0;42;37m" "\E[0;34m"
cd _common/qt-modules
find . \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%P\n" > _lupdate_temp_list.tmp
for lang in ${LANGS_LIST}; do
${QT_PATH}/lupdate -no-obsolete @_lupdate_temp_list.tmp -ts languages/moondust_$lang.ts -I .
done
rm _lupdate_temp_list.tmp
cd ../..
printLine "Editor" "\E[0;42;37m" "\E[0;34m"
cd Editor
find . \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%P\n" > _lupdate_temp_list.tmp
# find ../_common/ \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%p\n" >> _lupdate_temp_list.tmp
for lang in ${LANGS_LIST}; do
${QT_PATH}/lupdate -no-obsolete @_lupdate_temp_list.tmp -ts languages/editor_$lang.ts -I .
done
rm _lupdate_temp_list.tmp
cd ..
printLine "Maintainer" "\E[0;42;37m" "\E[0;34m"
cd Maintainer
find . \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%P\n" > _lupdate_temp_list.tmp
# find ../_common/ \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%p\n" >> _lupdate_temp_list.tmp
# sed -i '/_common\/data_functions/d' _lupdate_temp_list.tmp
for lang in ${LANGS_LIST}; do
${QT_PATH}/lupdate @_lupdate_temp_list.tmp -ts languages/maintainer_$lang.ts -I .
done
rm _lupdate_temp_list.tmp
cd ..
printLine "PlayableCalibrator" "\E[0;42;37m" "\E[0;34m"
cd PlayableCalibrator
find . \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%P\n" > _lupdate_temp_list.tmp
# find ../_common/ \( -name "*.h" -o -name "*.cpp" -o -name "*.ui" -o -name "*.hpp" \) -printf "%p\n" >> _lupdate_temp_list.tmp
# sed -i '/_common\/data_functions/d' _lupdate_temp_list.tmp
for lang in ${LANGS_LIST}; do
${QT_PATH}/lupdate @_lupdate_temp_list.tmp -ts languages/calibrator_$lang.ts -I .
done
rm _lupdate_temp_list.tmp
cd ..
printLine "Engine" "\E[0;42;37m" "\E[0;34m"
cd Engine
find . \( -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) -printf "%P\n" > _lupdate_temp_list.tmp
for lang in ${LANGS_LIST}; do
${QT_PATH}/lupdate @_lupdate_temp_list.tmp -ts languages/engine_$lang.ts -I .
done
rm _lupdate_temp_list.tmp
cd ..
printLine "Done!" "\E[0;42;37m" "\E[0;32m"
exit 0;
;;
lrelease)
echo ""
echo "-- This action is deprecated! --";
echo "Translations will be compiled automatically while build process is going";
echo "...Do nothing since this option is now useless...";
exit 0;
;;
esac
done
# ===== Source code packer =====
if ${flag_pack_src} ; then
if [[ ! -d bin-archives ]]; then
mkdir bin-archives
fi
if ${flag_pack_src_gz} ; then
ARFORMAT=gz
else
ARFORMAT=bz2
fi
echo "Packing source code..."
git archive-all -v --force-submodules bin-archives/pge-project-full-src.tar.${ARFORMAT}
checkState
printLine "Packed!" "\E[0;42;37m" "\E[0;32m"
cd ${bak}
if ${flag_pause_on_end} ; then
pause
fi
exit 0;
fi
# ===== Build project =====
if ${flag_debug_build} ; then
echo "==DEBUG BUILD!=="
BUILD_DIR_SUFFUX="-debug"
CONFIG_QMAKE="CONFIG-=release CONFIG+=debug"
CONFIG_CMAKE="Debug"
else
echo "==RELEASE BUILD!=="
BUILD_DIR_SUFFUX="-release"
CONFIG_QMAKE="CONFIG+=release CONFIG-=debug"
CONFIG_CMAKE="Release"
fi
# ===== Building through CMake =====
if [[ "$(which cmake)" == "" ]]; then
printf " \E[0;4;41;37mFATAL ERROR!: CMake is not installed! CMake is required to build this project.\E[0m\n\n"
exit 1
fi
deployTarget="create_tar"
if [[ "$OSTYPE" == "darwin"* ]]; then
deployTarget="create_dmg"
elif [[ "$OSTYPE" == "msys"* ]]; then
deployTarget="create_zip"
fi
BUILD_DIR="${SCRDIR}/build-pge-cmake${BUILD_DIR_SUFFUX}"
INSTALL_DIR="${SCRDIR}/bin-cmake${BUILD_DIR_SUFFUX}"
if [[ ! -d "${BUILD_DIR}" ]]; then
mkdir -p "${BUILD_DIR}"
fi
cd "${BUILD_DIR}"
CMAKE_STATIC_QT=""
if ${flag_cmake_static_qt}; then
CMAKE_STATIC_QT="-DPGE_ENABLE_STATIC_QT=ON"
if [[ ! -z "${QT_PREFIX_ROOT}" ]]; then
CMAKE_STATIC_QT="${CMAKE_STATIC_QT} -DMOONDUST_STATIC_QT_ROOT=${QT_PREFIX_ROOT}"
fi
fi
if [[ -z "${QT_PREFIX_ROOT}" ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
QT_PREFIX_ROOT=$(osx_realpath "${QT_PATH}/../")
elif [[ -f /usr/bin/realpath ]]; then
QT_PREFIX_ROOT=$(realpath "${QT_PATH}/../")
else
QT_PREFIX_ROOT=$(readlink -f -- "${QT_PATH}/../")
fi
fi
if [[ "$OSTYPE" == "msys"* ]]; then
if ! $flag_cmake_it_ninja ; then
CMAKE_GENERATOR="MSYS Makefiles"
fi
export CC="gcc"
export CXX="g++"
fi
#=======================================================================
cmake \
-G "${CMAKE_GENERATOR}" \
-DCMAKE_PREFIX_PATH=${QT_PREFIX_ROOT} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=${CONFIG_CMAKE} \
-DPGE_INSTALL_DIRECTORY="PGE_Project" \
"${SCRDIR}" \
${CMAKE_STATIC_QT} \
${CMAKE_EXTRA_ARGS}
# -DQT_QMAKE_EXECUTABLE="$QMake"
checkState
#=======================================================================
echo "Building (${MAKE_CPUS_COUNT} parallel jobs)..."
TIME_STARTED=$(date +%s)
cmake --build . --target all -- ${MAKE_EXTRA_ARGS} -j ${MAKE_CPUS_COUNT}
checkState
TIME_ENDED=$(date +%s)
TIME_PASSED=$(($TIME_ENDED-$TIME_STARTED))
#=======================================================================
# copy data and configs into the build directory
echo "Installing..."
cmake --build . --target install
checkState
if ${flag_cmake_deploy} ; then
echo "Deploying..."
cmake --build . --target put_online_help
checkState
if [[ ${flag_portable} == true && "$OSTYPE" != "darwin"* ]]; then
cmake --build . --target enable_portable
checkState
fi
if [[ "$OSTYPE" == "msys"* ]]; then
cmake --build . --target windeploy
checkState
fi
cmake --build . --target $deployTarget
checkState
if [[ "$OSTYPE" == "msys"* ]]; then # run extra tasks for Windows
cmake --build . --target create_zip_tools
checkState
cmake --build . --target create_zip_install
checkState
fi
fi
cd "${SCRDIR}"
#=======================================================================
echo ""
show_time ${TIME_PASSED}
printLine "BUILT!" "\E[0;42;37m" "\E[0;32m"
cd ${bak}
if ${flag_pause_on_end} ; then
pause
fi
exit 0;