forked from NOAA-OWP/t-route
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compiler.sh
executable file
·114 lines (103 loc) · 3.09 KB
/
compiler.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
#TODO add options for clean/noclean, make/nomake, cython/nocython
#TODO include instuctions on blowing away entire package for fresh install e.g. rm -r ~/venvs/mesh/lib/python3.6/site-packages/troute/*
#set root folder of github repo (should be named t-route)
REPOROOT=`pwd`
#For each build step, you can set these to true to make it build
#or set it to anything else (or unset) to skip that step
build_mc_kernel=true
build_diffusive_tulane_kernel=true
build_reservoir_kernel=true
build_framework=true
build_routing=true
build_config=true
build_nwm=true
if [ -z "$F90" ]
then
export F90="gfortran"
echo "using F90=${F90}"
fi
if [ -z "$CC" ]
then
export CC="gcc"
echo "using CC=${CC}"
fi
#preserve old/default behavior of installing packages with -e
E="-e"
if [ "$1" == 'no-e' ]
then
E=""
fi
#if you have custom static library paths, uncomment below and export them
#export LIBRARY_PATH=<paths>:$LIBRARY_PATH
#if you have custom dynamic library paths, uncomment below and export them
#export LD_LIBRARY_PATHS=<paths>:$LD_LIBRARY_PATHS
if [ -z "$NETCDF" ]
then
export NETCDFINC=/usr/include/openmpi-x86_64/
# set alternative NETCDF variable include path, for example for WSL
# (Windows Subsystems for Linux).
#
# EXAMPLE USAGE: export NETCDFALTERNATIVE=$HOME/.conda/envs/py39/include/
# (before ./compiler.sh)
if [ -n "$NETCDFALTERNATIVE" ]
then
echo "using alternative NETCDF inc ${NETCDFALTERNATIVE}"
export NETCDFINC=$NETCDFALTERNATIVE
fi
else
export NETCDFINC="${NETCDF}"
fi
echo "using NETCDFINC=${NETCDFINC}"
if [[ "$build_mc_kernel" == true ]]; then
#building reach and resevoir kernel files .o
cd $REPOROOT/src/kernel/muskingum/
make clean
make || exit
make install || exit
fi
if [[ "$build_diffusive_tulane_kernel" == true ]]; then
#building reach and resevoir kernel files .o
cd $REPOROOT/src/kernel/diffusive/
make clean
make diffusive.o
make pydiffusive.o
make install || exit
fi
if [[ "$build_reservoir_kernel" == true ]]; then
cd $REPOROOT/src/kernel/reservoir/
make clean
#make NETCDFINC=`nc-config --includedir` || exit
#make binding_lp.a
#make install_lp || exit
make
make install_lp || exit
make install_rfc || exit
fi
if [[ "$build_framework" == true ]]; then
#creates troute package
cd $REPOROOT/src/troute-network
rm -rf build
##python setup.py --use-cython install
##python setup.py --use-cython develop
CC=${CC} python setup.py build_ext --inplace --use-cython || exit
pip install $E . || exit
fi
if [[ "$build_routing" == true ]]; then
#updates troute package with the execution script
cd $REPOROOT/src/troute-routing
rm -rf build
#python setup.py --use-cython install
#python setup.py --use-cython develop
CC=${CC} python setup.py build_ext --inplace --use-cython || exit
pip install $E . || exit
fi
if [[ "$build_config" == true ]]; then
#updates troute package with the execution script
cd $REPOROOT/src/troute-config
pip install $E . || exit
fi
if [[ "$build_nwm" == true ]]; then
#updates troute package with the execution script
cd $REPOROOT/src/troute-nwm
pip install $E . || exit
fi