forked from amanzi/amanzi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·2135 lines (1736 loc) · 62.3 KB
/
bootstrap.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
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# ############################################################################ #
# #
# Amanzi Boost Script #
# #
# Script that builds Amanzi from scratch #
# #
# ############################################################################ #
# ---------------------------------------------------------------------------- #
# Initialization
# ---------------------------------------------------------------------------- #
# Logic parameters
TRUE=1
FALSE=0
# System information
system_name=`uname`
system_arch=`uname -m`
# Test script controls
print_exit=${FALSE}
# Known compiler lists
known_c_compilers="gcc icc clang"
known_cxx_compilers="g++ icpc clang++"
known_fortran_compilers="gfortran ifort"
# Directory information
start_directory=$PWD
amanzi_source_dir=$(cd $(dirname "$0")/;pwd)
ats_source_dir="${amanzi_source_dir}/src/physics/ats"
# ASCEM Web address
ascem_protocol=https
ascem_site='github.com/amanzi'
ascem_tpl_site="${ascem_site}/amanzi-tpls"
# Default root build and install prefix
dflt_build_prefix=`pwd`
dflt_install_prefix=`pwd`
# Source and build directories
amanzi_build_dir="${dflt_build_prefix}/build/amanzi"
amanzi_install_prefix="${dflt_install_prefix}/install/amanzi"
# Git
git_binary=`which git`
# CURL
curl_binary=`which curl`
# CMake
cmake_binary=`which cmake`
ctest_binary=`which ctest`
cmake_version=3.17.0
cmake_url=https://cmake.org/files/v3.17
cmake_archive_file=cmake-${cmake_version}.tar.gz
# Build configuration
parallel_jobs=2
build_type=Release
trilinos_build_type=Release
tpls_build_type=Release
dbc=${TRUE}
# Compiler definitions
build_c_compiler=
build_cxx_compiler=
build_fort_compiler=
# Compiler flags
build_c_flags=
build_cxx_flags=
build_fort_flags=
build_link_flags=
# Accelerators
epetra=${TRUE}
tpetra=${FALSE}
cuda=${FALSE}
openmp=${FALSE}
# MPI installation
tools_mpi=openmpi
mpi_root_dir=
mpi_exec_args=
# TPL (Third Party Libraries)
# BLAS / LAPACK
blas_dir=
blas_vendor=
lapack_dir=
# python for regression tests
python_exec=
# Debugging options for CMake configuration phase
debug_find_blas=$FALSE
# Spack
Spack=$FALSE
Spack_binary=`which spack`
build_Spack=$FALSE
# xSDK installation (optional)
xsdk=$FALSE #default is to not use
xsdk_root_dir=
# Enable/Disable Downloads
external_downloads=$TRUE
# Tools build parameters
tools_build_dir=${dflt_build_prefix}/build/tools
tools_download_dir=${tools_build_dir}/Downloads
tools_install_prefix=${dflt_install_prefix}/install/tools
# Point to a configuration file
tpl_config_file=
# TPL build parameters
tpl_build_dir=${dflt_build_prefix}/build/tpls
tpl_download_dir=${tpl_build_dir}/Downloads
tpl_install_prefix=${dflt_install_prefix}/install/tpls
# build stages (TPLs, TPLs + Amanzi, TPLs + Amanzi + UserGuide)
build_tpls=$TRUE
build_amanzi=$TRUE
build_user_guide=$FALSE
# Color output display
no_color=$FALSE
# Amanzi build configuration
# -- components
structured=$TRUE
unstructured=$TRUE
geochemistry=$TRUE
amanzi_physics=${TRUE}
ats_physics=${FALSE}
clm=${FALSE}
# -- mesh frameworks
# stk framewotk was deprecated and removed
mesh_mstk=$TRUE
mesh_moab=$FALSE
# -- tools
amanzi_branch=
ats_branch=
ats_tests_branch=
ats_dev=${FALSE}
ccse_tools=${FALSE}
spacedim=2
test_suite=$FALSE
reg_tests=$FALSE
build_stage_1=${FALSE}
build_stage_2=${FALSE}
dry_run=${FALSE}
# -- tpls
alquimia=${FALSE}
hypre=${TRUE}
superlu=${TRUE}
netcdf4=${TRUE}
petsc=${FALSE}
crunchtope=${FALSE}
pflotran=${FALSE}
shared=${FALSE}
silo=${FALSE}
ecosim=${FALSE}
# -- arch sets machine-specific variables
amanzi_arch=
prefer_static=${TRUE}
exec_static=${FALSE}
arch_tpl_opts=
arch_amanzi_opts=
# ---------------------------------------------------------------------------- #
# Functions: basic messages and exit functions
# ---------------------------------------------------------------------------- #
function exit_now()
{
exit $1
}
function status_message()
{
local GREEN='32m'
if [ "${no_color}" -eq "${TRUE}" ]; then
echo "[`date`] $1"
else
echo -e "[`date`]\033[$GREEN $1\033[m"
fi
}
function error_message()
{
local RED='31m'
if [ "${no_color}" -eq "${TRUE}" ]; then
echo "Amanzi Bootstrap ERROR: $1" 1>&2
else
echo -e "Amanzi Bootstrap ERROR:\033[$RED $1\033[m" 1>&2
fi
}
function warning_message()
{
local PINK='35m'
if [ "${no_color}" -eq "${TRUE}" ]; then
echo "Amanzi Bootstrap Warning: $1" 1>&2
else
echo -e "Amanzi Bootstrap Warning:\033[$PINK $1\033[m" 1>&2
fi
}
function fatal_message()
{
error_message $1
exit_now 10
}
# ---------------------------------------------------------------------------- #
# Functions: utilities
# ---------------------------------------------------------------------------- #
function make_fullpath()
{
if echo $1 | grep "^\/" > /dev/null 2> /dev/null; then
echo $1
else
echo "$start_directory/$1"
fi
}
function mkdir_now()
{
echo "making $1"
if [ ! -e $1 ]; then
mkdir -p $1
fi
}
function download_file()
{
url=$1
file=$2
output=$3
curl_opts=
if [ ! -z "${output}" ]; then
if [ -d "${output}" ]; then
curl_opts="--output $output/$file"
else
curl_opts="--output $output"
fi
else
curl_opts="--remote-name"
fi
# Problems with self-signed certificate from cmake
# curl_opts="--insecure ${curl_opts}"
cmd="${curl_binary} ${curl_opts} $url/$file"
echo $cmd
${curl_binary} $curl_opts $url/$file
status=$?
if [ "${status}" -ne "0" ]; then
error_message "${curl_binary} returned $status"
error_message "Failed to download $file from $url"
exit_now $status
fi
}
# ---------------------------------------------------------------------------- #
# Functions: command line functions
# ---------------------------------------------------------------------------- #
function set_feature()
{
feature=$1
action=$2
if echo $action | grep "disable" > /dev/null 2>/dev/null; then
eval "${feature}=$FALSE"
fi
if echo $action | grep "enable" > /dev/null 2>/dev/null; then
eval "${feature}=$TRUE"
fi
}
function parse_feature()
{
feature_opt=$1
if echo ${feature_opt} | grep "^--disable-" > /dev/null 2> /dev/null; then
echo ${feature_opt} | sed "s/^--disable-//"
fi
if echo ${feature_opt} | grep "^--enable-" > /dev/null 2> /dev/null; then
echo ${feature_opt} | sed "s/^--enable-//"
fi
}
function parse_option_with_equal()
{
a=$1
opt_name=$2
if echo $a | grep "^--${opt_name}=" > /dev/null 2> /dev/null; then
echo $a | sed "s/^--${opt_name}=//"
fi
}
function print_help()
{
echo '
Usage: '"$0"' [options]
Options: [defaults in brackets after descriptions]
Configuration:
--help print this message
--parallel=n build in parallel, where n is
number of maximum make jobs ['"${parallel_jobs}"']
--no-color deactivate color-coded status output ['"${no_color}"']
--tpl-config-file=FILE define a CMake TPL configuration file. If this
option is selected, '"$0"' will NOT build the TPLs.
--opt build optimized TPLs and Amanzi binaries. This the default
configuration.
--relwithdebinfo build optimized TPLs and Amanzi binaries with debug info
(for profiling)
--debug build debug Amanzi libraried and binaries.
--debug_tpls build debug TPLs libraries and binaries.
--branch=BRANCH build TPLs and Amanzi found in BRANCH ['"${amanzi_branch}"']
--branch_ats=BRANCH build ATS found in BRANCH ['"${ats_branch}"']
--branch_ats_tests=BRAN build ATS found in BRANCH ['"${ats_tests_branch}"']
--ats_dev prevent cloning remote repository when building ATS ['"${ats_devs}"']
--spacedim=DIM dimension of structured build (DIM=2 or 3) ['"${spacedim}"']
--dry_run show the configuration commands (but do not execute them) ['"${dry_run}"']
--arch define the architecture for the build (Summit|NERSC|Chicoma)
Build features:
Each feature listed here can be enabled/disabled with --[enable|disable]-[feature]
Value in brackets indicates default setting.
structured build structured AMR mesh capability ['"${structured}"']
ccse_tools build structured AMR tools for post processing and tecplot ['"${ccse_tools}"']
unstructured build unstructured mesh capability ['"${unstructured}"']
mesh_mstk build the MSTK Mesh Toolkit ['"${mesh_mstk}"']
mesh_moab build the MOAB Mesh Toolkit ['"${mesh_moab}"']
hypre build the HYPRE solver APIs ['"${hypre}"']
superlu build the SuperLU solver ['"${superlu}"']
petsc build the PETSc solver APIs ['"${petsc}"']
geochemistry build all geochemistry packages (pflotran, crunchtope, alquimia) ['"${geochemistry}"']
pflotran build the PFlotran geochemistry backend ['"${pflotran}"']
crunchtope build the CrunchTope geochemistry backend ['"${crunchtope}"']
alquimia build the Alquimia geochemistry solver APIs ['"${alquimia}"']
amanzi_physics build Amanzi native physics package ['"${amanzi_physics}"']
ats_physics build ATS physics package (currently mutually exclusive) ['"${ats_physics}"']
clm build CLM library for surface processes (currently only ATS) ['"${clm}"']
dbc design-by-contract. Extra (potentially time-consuming) error-checking
intended for developers ['"${dbc}"']
test_suite run Amanzi Test Suite before installing ['"${test_suite}"']
reg_tests build regression tests into Amanzi or ATS Test Suite ['"${reg_tests}"']
shared build Amanzi and tpls using shared libraries ['"${shared}"']
external_downloads allow TPL tar balls or git repos to be downloaded directly from
external sites ['"${external_downloads}"']
Spack build TPLs using the Spack package manager when appropriate ['"${Spack}"']
xsdk build TPLs available in xSDK first, then supplement with additional
individual TPL builds ['"${xsdk}"']
epetra build Amanzi using the Epetra stack of TPLs ['"${epetra}"']
tpetra build Amanzi using the Tpetra/Kokkos stack of TPLs ['"${tpetra}"']
NOTE: enabling both builds TPLs that are compatible with both Amanzi
variants, but will error prior to building Amanzi.
cuda build with Cuda support, currently used by Kokkos and Hypre ['"${cuda}"']
openmp build with OpenMP support, currently used by Kokkos and Hypre ['"${openmp}"']
Note that this option may conflict with structured, so use of --enable-openmp
may require the use of --disable-structured.
build_amanzi build TPLs and Amanzi ['"${build_amanzi}"']
build_user_guide build TPLs, Amanzi, and UserGuide ['"${build_user_guide}"']
Tool definitions:
--with-c-compiler=FILE FILE is the C compiler
--with-cxx-compiler=FILE FILE is the C++ compiler
--with-fort-compiler=FILE FILE is the Fortran compiler
--with-c-flags=STRING STRING is additional C compiler flags
--with-cxx-flags=STRING STRING is additional C++ compiler flags
--with-fort-flags=STRING STRING is additional Fortran compiler flags
--with-link-flags=STRING STRING is additional linker flags
--with-cmake[=FILE] FILE is the CMake binary ['"${cmake_binary}"'] without FILE builds CMake
--with-ctest=FILE FILE is the CTest binary ['"${ctest_binary}"'], ignored if --with-cmake is set
--with-git=FILE FILE is the git binary ['"${git_binary}"']
--with-curl=FILE FILE is the CURL binary ['"${curl_binary}"']
--with-mpi=DIR use MPI installed in DIR ['"${mpi_root_dir}"'].
Will search for MPI compiler wrappers under this directory. It this
option is missing, OpenMPI will be built using the provided compiler.
--with-xsdk=DIR use libraries already available in xSDK installation in lieu of
downloading and installing them individually. ['"${xsdk_root_dir}"']
--with-python=FILE FILE is the python executable, must be python3 and include numpy and h5py, for
use with ATS regression testing.
System/Vendor Supported Third Party Libraries (TPLs):
Bootstrap builds community supported TPLs, however, some TPLs have vendor or compiler optimized versions
and are provided on the system. Some of these libraries may be in nonstandard locations.
--with-blas=DIR Search for the BLAS libraries only in DIR
[default is blank so CMake searches in system directories]
--blas-vendor=VENDOR Specify the vendor (usually the system name) for the BLAS and LAPACK libraries
[default All] is implicit in findBLAS.cmake and will search all supported names.
To focus the search and simplify debegging, specify a VENDOR name. Supported
VENDOR names include, Generic, OpenBLAS, CRAYSCI, Apple, FLAME, and NAS.
--with-lapack=DIR Search for the LAPACK libraries only in DIR
[default is blank so CMake searches in system directories]
--debug_find_blas Turn on additional CMake messages to help resolve system configuration
problems that cause the automatic search mechanism to fail [default: '"${debug_find_blas}"']
Directories and file names:
--prefix=PREFIX install ALL files in tree rooted at PREFIX
['"${dflt_install_prefix}"']
--amanzi-install-prefix=DIR install Amanzi in tree rooted at DIR
['"${amanzi_install_prefix}"']
--amanzi-build-dir=DIR build Amanzi in DIR
['"${amanzi_build_dir}"']
--tpl-install-prefix=DIR install Amanzi TPLs in tree rooted at DIR
['"${tpl_install_prefix}"']
--tpl-build-dir=DIR build Amanzi TPLs in DIR
['"${tpl_build_dir}"']
--tpl-download-dir=DIR direct downloads of Amanzi TPLs to DIR
['"${tpl_download_dir}"']
--tools-install-prefix=DIR install Amanzi tools in tree rooted at DIR
['"${tools_install_prefix}"']. The list of tools includes
currently OpenMPI and MPICH.
--tools-build-dir=DIR build Amanzi tools in DIR
['"${tools_build_dir}"']
--tools-download-dir=DIR direct downloads of Amanzi tools to DIR
['"${tools_download_dir}"']
--tools-mpi=NAME implementation of the Message Passing Interface (MPI)
standard. NAME is either openmpi (default) or mpich.
Example with pre-existing MPI installation that builds dynamic libraries
and executables for external packages (TPLs) and then for Amanzi:
./bootstrap.sh --tpl-install-prefix=$HOME/TPLs-0.96.3-clang-9.0.0-ompi-3.1.4
--with-mpi=/opt/local
--parallel=8
--enable-shared
--enable-alquimia --enable-pflotran --enable-crunchtope
--enable-petsc
Example that builds first OpenMPI, then TPLs, and finally Amanzi. It uses
OSX C and C++ compilers and Fortran compiler from MacPorts:
./bootstrap.sh --tpl-install-prefix=$HOME/TPLs-0.96.3-clang-9.0.0-ompi-3.1.4
--with-c-compiler=/usr/bin/clang
--with-cxx-compiler=/usr/bin/clang++
--with-fort-compiler=/opt/local/bin/gfortran-mp-6
--parallel=8
--enable-alquimia --enable-pflotran --enable-crunchtope
--enable-petsc
--tools-mpi=openmpi
Example that uses the system MPI, provides a path (/usr/local/lib) and
turns on debugging to find BLAS and LAPACK libraries, builds the TPLs
(with geochemistry libraries enabled), and finally Amanzi:
./bootstrap.sh --tpl-install-prefix=$HOME/TPLs-0.98.0-gcc-9.3.0-openmpi-4.0.3
--with-mpi=/usr
--with-blas=/usr/local/lib
--with-lapack=/usr/local/lib
--debug_find_blas
--parallel=8
--enable-geochemistry
Example that builds a set of TPLs that can support main-branch
development (Epetra), tpetra-branch development (Tpetra) and
structured builds. Note that optionally, the --enable-cuda or
--enable-openmp flags could be added (though note that --enable-openmp
currently requires --disable-structured).
./bootstrap.sh --tpl-install-prefix=$HOME/TPLs-0.98.0-gcc-9.3.0-openmpi-4.0.3
--with-mpi=/usr
--enable-epetra
--enable-tpetra
--enable-geochemistry
--disable-structured
--enable-openmp
'
}
function print_variable_values
{
echo '
List of computed and ADJUSTED parameters
========================================
Compilers and Flags:
build_c_compiler = '"${build_c_compiler}"'
build_cxx_compiler = '"${build_cxx_compiler}"'
build_fort_compiler = '"${build_fort_compiler}"'
build_c_flags = '"${build_c_flags}"'
build_cxx_flags = '"${build_cxx_flags}"'
build_fort_flags = '"${build_fort_flags}"'
build_link_flags = '"${build_link_flags}"'
mpi_root_dir = '"${mpi_root_dir}"'
Build configuration:
build_type = '"${build_type}"'
dbc = '"${dbc}"'
build_stage_1 = '"${build_stage_1}"'
build_stage_2 = '"${build_stage_2}"'
parallel = '"${parallel_jobs}"'
shared = '"${shared}"'
static_libs_prefer = '"${prefer_static}"'
static_executables = '"${exec_static}"'
trilinos_build_type = '"${trilinos_build_type}"'
tpls_build_type = '"${tpls_build_type}"'
tpl_config_file = '"${tpl_config_file}"'
blas_dir = '"${blas_dir}"'
lapack_dir = '"${lapack_dir}"'
blas_vendor = '"${blas_vendor}"'
debug_find_blas = '"${debug_find_blas}"'
amanzi_arch = '"${amanzi_arch}"'
Amanzi Components:
structured = '"${structured}"'
spacedim = '"${spacedim}"'
unstructured = '"${unstructured}"'
amanzi_physics = '"${amanzi_physics}"'
ats_physics = '"${ats_physics}"'
clm = '"${clm}"'
geochemistry = '"${geochemistry}"'
Amanzi TPLs:
alquimia = '"${alquimia}"'
crunchtope = '"${crunchtope}"'
ecosim = '"${ecosim}"'
mesh_mstk = '"${mesh_mstk}"'
mesh_moab = '"${mesh_moab}"'
netcdf4 = '"${netcdf4}"'
hypre = '"${hypre}"'
superlu = '"${superlu}"'
petsc = '"${petsc}"'
epetra = '"${epetra}"'
tpetra = '"${tpetra}"'
cuda = '"${cuda}"'
openmp = '"${openmp}"'
pflotran = '"${pflotran}"'
silo = '"${silo}"'
Spack = '"${Spack}"'
xsdk = '"${xsdk}"'
external_downloads = '"${external_downloads}"'
Tools and Tests:
ccse_tools = '"${ccse_tools}"'
cmake_binary = '"${cmake_binary}"'
ctest_binary = '"${ctest_binary}"'
curl_binary = '"${curl_binary}"'
git_binary = '"${git_binary}"'
Spack_binary = '"${Spack_binary}"'
reg_tests = '"${reg_tests}"'
test_suite = '"${test_suite}"'
tools_mpi = '"${tools_mpi}"'
python_exec = '"${python_exec}"'
Directories:
prefix = '"${prefix}"'
amanzi_install_prefix = '"${amanzi_install_prefix}"'
amanzi_build_dir = '"${amanzi_build_dir}"'
tpl_install_prefix = '"${tpl_install_prefix}"'
tpl_build_dir = '"${tpl_build_dir}"'
tpl_download_dir = '"${tpl_download_dir}"'
tools_install_prefix = '"${tools_install_prefix}"'
tools_build_dir = '"${tools_build_dir}"'
tools_download_dir = '"${tpl_download_dir}"'
'
}
function parse_argv()
{
echo '
List of INPUT parameters
========================'
argv=( "$@" )
last=$(( ${#argv[@]} - 1 ))
i=0
while [ $i -le ${last} ]
do
opt=${argv[$i]}
echo "opt: $opt"
case ${opt} in
-h|--h|--help)
print_help
exit_now 0
;;
--prefix=*)
tmp=`parse_option_with_equal "${opt}" 'prefix'`
prefix=`make_fullpath ${tmp}`
;;
--arch=*)
amanzi_arch=`parse_option_with_equal "${opt}" 'arch'`
;;
--parallel=[0-9]*)
parallel_jobs=`parse_option_with_equal "${opt}" 'parallel'`
;;
--opt)
build_type=Release
;;
--opt_tpls)
tpls_build_type=Release
;;
--opt_trilinos)
trilinos_build_type=Release
;;
--relwithdebinfo)
build_type=RelWithDebInfo
;;
--relwithdebinfo_tpls)
tpls_build_type=RelWithDebInfo
;;
--relwithdebinfo_trilinos)
trilinos_build_type=RelWithDebInfo
;;
--debug)
build_type=Debug
;;
--debug_tpls)
tpls_build_type=Debug
;;
--debug_trilinos)
trilinos_build_type=Debug
;;
--debug_find_blas)
debug_find_blas=${TRUE}
;;
--dry_run)
dry_run=${TRUE}
;;
--disable-*)
feature=`parse_feature "${opt}"`
set_feature ${feature} 'disable'
;;
--enable-*)
feature=`parse_feature "${opt}"`
set_feature ${feature} 'enable'
;;
--no-color)
no_color=${TRUE}
;;
--branch=*)
amanzi_branch=`parse_option_with_equal "${opt}" 'branch'`
;;
--branch_ats=*)
ats_branch=`parse_option_with_equal "${opt}" 'branch_ats'`
;;
--branch_ats_tests=*)
ats_tests_branch=`parse_option_with_equal "${opt}" 'branch_ats_tests'`
;;
--ats_dev)
ats_dev=${TRUE}
;;
--spacedim=*)
spacedim=`parse_option_with_equal "${opt}" 'spacedim'`
;;
--with-c-compiler=*)
tmp=`parse_option_with_equal "${opt}" 'with-c-compiler'`
build_c_compiler=`make_fullpath $tmp`
;;
--with-c-flags=*)
build_c_flags=`parse_option_with_equal "${opt}" 'with-c-flags'`
;;
--with-cxx-compiler=*)
tmp=`parse_option_with_equal "${opt}" 'with-cxx-compiler'`
build_cxx_compiler=`make_fullpath $tmp`
;;
--with-cxx-flags=*)
build_cxx_flags=`parse_option_with_equal "${opt}" 'with-cxx-flags'`
;;
--with-fort-compiler=*)
tmp=`parse_option_with_equal "${opt}" 'with-fort-compiler'`
build_fort_compiler=`make_fullpath $tmp`
;;
--with-fort-flags=*)
build_fort_flags=`parse_option_with_equal "${opt}" 'with-fort-flags'`
;;
--with-link-flags=*)
build_link_flags=`parse_option_with_equal "${opt}" 'with-link-flags'`
;;
--with-cmake=*)
tmp=`parse_option_with_equal "${opt}" 'with-cmake'`
cmake_binary=`make_fullpath $tmp`
;;
--with-ctest=*)
tmp=`parse_option_with_equal "${opt}" 'with-ctest'`
ctest_binary=`make_fullpath $tmp`
;;
--with-cmake)
cmake_binary=
;;
--with-git=*)
tmp=`parse_option_with_equal "${opt}" 'with-git'`
git_binary=`make_fullpath $tmp`
;;
--with-curl=*)
tmp=`parse_option_with_equal "${opt}" 'with-curl'`
curl_binary=`make_fullpath $tmp`
;;
--with-mpi=*)
tmp=`parse_option_with_equal "${opt}" 'with-mpi'`
mpi_root_dir=$tmp
;;
--with-python=*)
tmp=`parse_option_with_equal "${opt}" 'with-python'`
python_exec=$tmp
;;
--with-xsdk=*)
tmp=`parse_option_with_equal "${opt}" 'with-xsdk'`
xsdk_root_dir=`make_fullpath $tmp`
XSDK=TRUE
;;
--with-blas=*)
tmp=`parse_option_with_equal "${opt}" 'with-blas'`
blas_dir=$tmp
;;
--blas-vendor=*)
tmp=`parse_option_with_equal "${opt}" 'blas-vendor'`
blas_vendor=$tmp
;;
--with-lapack=*)
tmp=`parse_option_with_equal "${opt}" 'with-lapack'`
lapack_dir=$tmp
;;
--amanzi-build-dir=*)
tmp=`parse_option_with_equal "${opt}" 'amanzi-build-dir'`
amanzi_build_dir=`make_fullpath $tmp`
;;
--amanzi-install-prefix=*)
tmp=`parse_option_with_equal "${opt}" 'amanzi-install-prefix'`
amanzi_install_prefix=`make_fullpath $tmp`
;;
--tpl-install-prefix=*)
tmp=`parse_option_with_equal "${opt}" 'tpl-install-prefix'`
tpl_install_prefix=`make_fullpath $tmp`
;;
--tpl-build-dir=*)
tmp=`parse_option_with_equal "${opt}" 'tpl-build-dir'`
tpl_build_dir=`make_fullpath $tmp`
;;
--tpl-download-dir=*)
tmp=`parse_option_with_equal "${opt}" 'tpl-download-dir'`
tpl_download_dir=`make_fullpath $tmp`
;;
--tpl-config-file=*)
tmp=`parse_option_with_equal "${opt}" 'tpl-config-file'`
tpl_config_file=`make_fullpath $tmp`
;;
--build_user_guide)
build_user_guide=${TRUE}
;;
--tools-install-prefix=*)
tmp=`parse_option_with_equal "${opt}" 'tools-install-prefix'`
tools_install_prefix=`make_fullpath $tmp`
;;
--tools-build-dir=*)
tmp=`parse_option_with_equal "${opt}" 'tools-build-dir'`
tools_build_dir=`make_fullpath $tmp`
;;
--tools-download-dir=*)
tmp=`parse_option_with_equal "${opt}" 'tools-download-dir'`
tools_download_dir=`make_fullpath $tmp`
;;
--tools-mpi=*)
tools_mpi=`parse_option_with_equal "${opt}" 'tools-mpi'`
;;
--print)
print_exit=${TRUE}
;;
*)
error_message "'${opt}' is an unknown option or an option missing a value"
exit_now 20
;;
esac
i=$[$i+1]
done
# TPLs CMake option is "disable_external_downloads"
if [ "${external_downloads}" -eq "${TRUE}" ]; then
disable_external_downloads=${FALSE}
else
disable_external_downloads=${TRUE}
fi
# ---------------------------------------------------------------------------- #
# Enforce implicit TPL dependencies
# ---------------------------------------------------------------------------- #
if [ "${build_user_guide}" -eq "${TRUE}" ]; then
build_amanzi=${TRUE}
fi
if [ "${unstructured}" -eq "${FALSE}" ]; then
mesh_mstk=${FALSE}
mesh_moab=${FALSE}
stk_mesh=${FALSE}
else
if [ "${epetra}" -eq "${FALSE}" ]; then
warning_message "Disabling all of 'geochemistry' as it is not yet supported when disabling 'epetra'"
geochemistry=${FALSE}
alquimia=${FALSE}
pflotran=${FALSE}
crunchtope=${FALSE}
petsc=${FALSE}
if [ "${hypre}" -eq "${FALSE}" ]; then
warning_message "Disabling 'superlu' as it is not used when disabling 'epetra' and 'hypre'"
superlu=${FALSE}
fi
if [ "${tpetra}" -eq "${FALSE}" ]; then
error_message "One of 'epetra' or 'tpetra' must be enabled"
exit_now 30
fi
fi
fi
if [ "${structured}" -eq "${TRUE}" ]; then
if [ "${petsc}" -eq "${FALSE}" ]; then
petsc=${TRUE}
warning_message "Enabling 'petsc' as required by 'structured'"
fi
fi
# check compatibility of geochemistry options
# -- for the moment, either all of geochemistry is on or none of it is on...
# -- this should get fixed to allow either PFLOTRAN or CRUNCHTOPE and not BOTH!
if [ "${alquimia}" -eq "${TRUE}" ]; then
geochemistry=${TRUE}
fi
if [ "${pflotran}" -eq "${TRUE}" ]; then
geochemistry=${TRUE}
fi
if [ "${crunchtope}" -eq "${TRUE}" ]; then
geochemistry=${TRUE}
fi
# -- once this is fixed, the above can get removed
if [ "${geochemistry}" -eq "${TRUE}" ]; then
petsc=${geochemistry}
alquimia=${geochemistry}
pflotran=${geochemistry}
crunchtope=${geochemistry}
fi
if [ "${geochemistry}" -eq "${FALSE}" ]; then
if [ "${pflotran}" -eq "${TRUE}" ]; then
if [ "${petsc}" -eq "${FALSE}" ]; then
petsc=${TRUE}
warning_message "Enabling 'petsc' as required by 'pflotran'"
fi
if [ "${alquimia}" -eq "${FALSE}" ]; then
alquimia=${TRUE}
warning_message "Enabling 'alquimia' as required by 'pflotran'"
fi
fi
if [ "${crunchtope}" -eq "${TRUE}" ]; then
if [ "${alquimia}" -eq "${FALSE}" ]; then
alquimia=${TRUE}
warning_message "Enabling 'alquimia' as required by 'crunchtope'"
fi
fi
fi
# superlu required by petsc and hypre
if [ "${petsc}" -eq "${TRUE}" ]; then
if [ "${superlu}" -eq "${FALSE}" ]; then
warning_message "Enabling 'superlu' as required by 'petsc'"
superlu=${TRUE}
fi
fi
if [ "${hypre}" -eq "${TRUE}" ]; then
if [ "${superlu}" -eq "${FALSE}" ]; then
warning_message "Enabling 'superlu' as required by 'hypre'"
superlu=${TRUE}
fi
fi
# BLAS
if [ ! -z "${blas_dir}" ]; then
blas_opts=-DTPL_BLAS_DIR:FILEPATH=${blas_dir}
fi
# BLAS Vendor (Generic, All, Apple, etc.)
if [ ! -z "${blas_vendor}" ]; then
blas_vendor_opts=-DTPL_BLAS_VENDOR:STRING=${blas_vendor}
fi
# Debug FindBLAS.cmake
if [ "${debug_find_blas}" -eq "${TRUE}" ]; then
debug_find_blas_tmp=-DTPL_DEBUG_FIND_BLAS:BOOL=${TRUE}
else
debug_find_blas_tmp=-DTPL_DEBUG_FIND_BLAS:BOOL=${FALSE}
fi
# LAPACK
if [ ! -z "${lapack_dir}" ]; then
lapack_opts=-DTPL_LAPACK_DIR:FILEPATH=${lapack_dir}
fi