forked from FEST3D/FEST-3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·91 lines (88 loc) · 2.69 KB
/
install.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
#!/usr/bin/env bash
#unset -xo pipefail
OS="`uname`"
dir="`pwd`"/bin/FEST3D
echo $dir
case ${OS} in
'Linux')
OS='Linux'
PKG_MANAGER=$( command -v yum || command -v apt-get ) || echo "Neither yum nor apt-get found"
echo "Following package manager found: ${PKG_MANAGER}"
echo "Meeting dependencies"
apt=`command -v apt-get`
yum=`command -v yum`
if [ -n "$apt" ]; then
sudo apt-get update
sudo apt-get -y install gfortran mpich python3-dev python3-numpy
elif [ -n "$yum" ]; then
sudo yum check-update
sudo yum -y install gcc-gfortran mpich python3-devel
sudo python3 -m pip install --upgrade pip
python3 -m pip install --user numpy
pip install --user numpy --upgrade
else
echo "Err: no path to apt-get or yum" >&2;
exit 1;
fi
source ~/.bashrc
if [[ -z "${FEST3D}" ]]; then
echo 'FEST3D variable not set. Exporting FEST3D variable to .bashrc'
echo 'export FEST3D="'${dir}'"' >> ~/.bashrc
export FEST3D="${dir}"
elif [[ "${FEST3D}" == "${dir}" ]]; then
echo 'FEST3D env variable is set to: '${FEST3D}
else
echo 'export FEST3D="'${dir}'"' >> ~/.bashrc
export FEST3D="${dir}"
echo 'FEST3D variable is set, but to different binary path'
echo 'FEST3D env variable is being set to: '${FEST3D}
echo 'Please remove the old export line from ~/.bashrc'
fi
;;
'FreeBSD')
OS='FreeBSD'
echo "Install scirpt does not suport FreeBSD"
;;
'WindowsNT')
OS='Windows'
echo "Install scirpt does not suport Windows"
;;
'Darwin')
OS='Mac'
#gfortran is part of gcc
brew install gcc mpich numpy
if [[ -z "${FEST3D}" ]]; then
echo 'FEST3D variable not set. Exporting FEST3D variable to .bash_profile'
echo 'export FEST3D="'${dir}'"' >> ~/.bash_profile
export FEST3D="${dir}"
elif [[ "${FEST3D}" == "${dir}" ]]; then
echo 'FEST3D env variable is set to: '${FEST3D}
else
echo 'export FEST3D="'${dir}'"' >> ~/.bash_profile
export FEST3D="${dir}"
echo 'FEST3D variable is set, but to different binary path'
echo 'FEST3D env variable is being set to: '${FEST3D}
echo 'Please remove the old export line from ~/.bashrc'
fi
;;
'SunOS')
OS='Solaris'
;;
'AIX') ;;
*) ;;
esac
# create a build folder for the out-of-source build
mkdir -p build
# switch to build directory
cd build
# run cmake; here we assume that the project's
# top-level CMakeLists.txt is located at '..'
FC=mpif90 cmake ..
# once CMake has done its job we just build using make as usual
make
# if the project uses ctest we can run the tests like this
make test
cd ../tests/
make
python3 Test.py ausm muscl sst
cd ../