forked from CIMM-ORG/SWMM5plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_vars.sh
More file actions
executable file
·87 lines (73 loc) · 1.86 KB
/
build_vars.sh
File metadata and controls
executable file
·87 lines (73 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh
num_processors=1
compile_fortran="true"
compile_swmmc="true"
download_swmmc="true" # brh20211209 allows skip of download (dangerous!)
# Check flags
while [ ! $# -eq 0 ]
do
case "$1" in
--swmmc | -s) # Compile SWMM C only
compile_fortran="false" ;;
--fortran | -f) # Compile SWMM5+ only
compile_swmmc="false" ;;
--processors | -n)
num_processors="$2" ;;
--clean | -c)
clean="true" ;;
--existing_swmm | -z) # compile existing SWMM C (no download) brh2021209
download_swmmc="false" ;;
esac
shift
done
# Check OS
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=linux;;
Darwin*) machine=mac;;
CYGWIN*) machine=cygwin;;
MINGW*) machine=mingw;;
*) machine="UNKNOWN:${unameOut}"
esac
# --------------------------------------------------------------------------------------
# Set number of processors
if grep "export FOR_COARRAY_NUM_IMAGES" ~/.bashrc
then
sed -i "s/export FOR_COARRAY_NUM_IMAGES=[0-9]*/export FOR_COARRAY_NUM_IMAGES=$num_processors/g" ~/.bashrc
else
echo "export FOR_COARRAY_NUM_IMAGES=$num_processors" >> ~/.bashrc
fi
source ~/.bashrc
# --------------------------------------------------------------------------------------
# Directories
SWMM5PLUS_DIR=$PWD
INSTALLATION_LOG="$SWMM5PLUS_DIR/installation_log.txt"
# Installation log
if [[ -f $INSTALLATION_LOG ]]
then
rm $INSTALLATION_LOG
fi
INIT_DIR='initialization'
API_DIR='interface'
UTIL_DIR='utility'
DEF_DIR='definitions'
DDIR="$SWMM5PLUS_DIR/dependencies"
GEO_DIR='geometry'
TL_DIR='timeloop'
FIN_DIR='finalization'
TEST_DIR='tests'
OUT_DIR='output'
if [[ -f $TEST_DIR/main.f08 ]]
then
MAIN_DIR=$TEST_DIR
else
MAIN_DIR='main'
fi
if [[ ! -d $TEST_DIR ]]
then
mkdir $TEST_DIR
fi
# Compiler vars
PROGRAM=SWMM
# Dependencies source code
JSON_DIR="$DDIR/json-fortran"