-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall-dependencies.sh
executable file
·183 lines (148 loc) · 4.91 KB
/
install-dependencies.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
#!/bin/bash
# Installing dependencies needed to build on (k)ubuntu linux 20.04
# Check USE_THERMOFUN mode install dependecy
if [ "$(uname)" == "Darwin" ]; then
# Do under Mac OS X platform
#brew upgrade
#brew install cmake
EXTN=dylib
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
sudo apt-get update
EXTN=so
fi
threads=3
git status
USING_THERMOFUN_MODE=$1
BRANCH_TFUN=master
BRANCH_GEMS3K=master
# Temporarily uncomment rows for packages that need to be re-installed
#sudo rm -rf /usr/local/include/nlohmann
#sudo rm -rf /usr/local/include/eigen3/Eigen/Eigen
#sudo rm -rf /usr/local/include/pybind11
#sudo rm -rf /usr/local/include/spdlog
#sudo rm -f /usr/local/lib/libChemicalFun.$EXTN
#sudo rm -f /usr/local/lib/libThermoFun.$EXTN
#sudo rm -f /usr/local/lib/libGEMS3K.$EXTN
# spdlog
# if no spdlog installed in /usr/local/include/spdlog (copy only headers)
test -d /usr/local/include/spdlog || {
# Building spdlog library
mkdir -p ~/code && \
cd ~/code && \
git clone https://github.com/gabime/spdlog -b v1.11.0 && \
cd spdlog/include && \
sudo cp -r spdlog /usr/local/include
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
if [ "$USING_THERMOFUN_MODE" == "NO_THERMOFUN" ];
then
echo "Using without ThermoFun calculations"
else
# nlohmann/json
test -f /usr/local/include/nlohmann/json.hpp || {
# Building yaml-cpp library
mkdir -p ~/code && \
cd ~/code && \
git clone https://github.com/nlohmann/json.git && \
cd json && \
mkdir -p build && \
cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF -DJSON_MultipleHeaders=ON && \
make && \
sudo make install
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
# Eigen3 math library (added for building and installing xGEMS)
# if not installed in /usr/local/include/eigen3)
test -d /usr/local/include/eigen3/Eigen || {
# Building eigen library
mkdir -p ~/code && \
cd ~/code && \
git clone https://gitlab.com/libeigen/eigen.git -b 3.4.0 && \
cd eigen && \
mkdir -p build && \
cd build && \
cmake .. \
make && \
sudo make install
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
#Pybind11
test -d /usr/local/include/pybind11 || {
# Building yaml-cpp library
mkdir -p ~/code && \
cd ~/code && \
git clone https://github.com/pybind/pybind11.git && \
cd pybind11 && \
mkdir -p build && \
cd build && \
cmake .. -DPYBIND11_TEST=OFF && \
make && \
sudo make install
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
# ChemicalFun library
# if no ChemicalFun installed in /usr/local/lib/ (/usr/local/include/ChemicalFun)
test -f /usr/local/lib/libChemicalFun.$EXTN || {
# Building thermofun library
mkdir -p ~/code && \
cd ~/code && \
git clone https://bitbucket.org/gems4/chemicalfun.git -b $BRANCH_TFUN && \
cd chemicalfun && \
mkdir -p build && \
cd build && \
cmake .. -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=$BUILD_TYPE && \
make -j $threads && \
sudo make install
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
# ThermoFun library
# if no ThermoFun installed in /usr/local/lib/libThermoFun.a (/usr/local/include/ThermoFun)
test -f /usr/local/lib/libThermoFun.$EXTN || {
# Building thermofun library
mkdir -p ~/code && \
cd ~/code && \
# git clone https://bitbucket.org/gems4/thermofun.git -b $BRANCH_TFUN && \
git clone https://github.com/thermohub/thermofun.git -b $BRANCH_TFUN && \
cd thermofun && \
mkdir -p build && \
cd build && \
cmake .. -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=Release && \
make -j $threads && \
sudo make install
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
fi
# GEMS3K library
# if no GEMS3K installed in /usr/local/lib/libGEMS3K.so (/usr/local/include/GEMS3K)
test -f /usr/local/lib/libGEMS3K.$EXTN || {
# Building thermofun library
mkdir -p ~/code && \
cd ~/code && \
git clone https://github.com/gemshub/GEMS3K -b $BRANCH_GEMS3K && \
cd GEMS3K && \
mkdir -p build && \
cd build && \
cmake .. -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=Release && \
make -j $threads && \
sudo make install
# Removing generated build files
cd ~ && \
rm -rf ~/code
}
if [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
sudo ldconfig
fi
# on MacOS, this gives a syntax error