-
Notifications
You must be signed in to change notification settings - Fork 0
/
GWComponent.pro
383 lines (285 loc) · 9.94 KB
/
GWComponent.pro
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
#Author Caleb Amoa Buahin
#Email caleb.buahin@gmail.com
#Date 2018
#License GNU Lesser General Public License (see <http: //www.gnu.org/licenses/> for details).
#The GWComponent is a stream surface transient storage zone temperature and solute transport model.
TEMPLATE = lib
VERSION = 1.0.0
TARGET = GWComponent
QT -= gui
QT += testlib
DEFINES += GWCOMPONENT_LIBRARY
DEFINES += USE_OPENMP
DEFINES += USE_MPI
DEFINES += USE_CVODE
DEFINES += USE_NETCDF
DEFINES += USE_CHPC
#Compile as library or executable
contains(DEFINES,GWCOMPONENT_LIBRARY){
TEMPLATE = lib
message("Compiling GWComponent as library")
} else {
TEMPLATE = app
CONFIG-=app_bundle
message("Compiling GWComponent as application")
}
CONFIG += c++11
CONFIG += debug_and_release
CONFIG += optimize_full
PRECOMPILED_HEADER = ./include/stdafx.h
INCLUDEPATH += .\
./include \
./../HydroCouple/include \
./../HydroCoupleSDK/include \
./../ODESolver/include
HEADERS += ./include/stdafx.h\
./include/gwcomponent_global.h \
./include/gwcomponent.h \
./include/gwcomponentinfo.h \
./include/variable.h \
./include/test/gwcomponenttest.h \
./include/gwmodel.h \
./include/element.h \
./include/elementjunction.h \
./include/iboundarycondition.h \
./include/edgebc.h \
./include/elementcellsourcebc.h \
./include/channelbc.h \
./include/elementinput.h \
./include/elementoutput.h \
./include/elementcell.h \
./include/elementcelladvupwind.h
SOURCES +=./src/stdafx.cpp \
./src/gwcomponent.cpp \
./src/gwcomponentinfo.cpp \
./src/main.cpp \
./src/test/gwcomponenttest.cpp \
./src/gwmodel.cpp \
./src/gwmodelio.cpp \
./src/gwcompute.cpp \
./src/elementjunction.cpp \
./src/element.cpp \
./src/elementcell.cpp \
./src/edgebc.cpp \
./src/elementcellsourcebc.cpp \
./src/channelbc.cpp \
./src/elementinput.cpp \
./src/elementoutput.cpp
macx{
INCLUDEPATH += /usr/local \
/usr/local/include
contains(DEFINES, USE_CVODE){
message("CVODE enabled")
LIBS += -L/usr/local/lib -lsundials_cvode
}
contains(DEFINES, USE_NETCDF){
message("NetCDF enabled")
LIBS += -L/usr/local/lib -lnetcdf-cxx4
}
contains(DEFINES,USE_OPENMP){
QMAKE_CC = /usr/local/opt/llvm/bin/clang
QMAKE_CXX = /usr/local/opt/llvm/bin/clang++
QMAKE_LINK = /usr/local/opt/llvm/bin/clang++
QMAKE_CFLAGS+= -fopenmp
QMAKE_LFLAGS+= -fopenmp
QMAKE_CXXFLAGS+= -fopenmp
INCLUDEPATH += /usr/local/opt/llvm/lib/clang/5.0.0/include
LIBS += -L /usr/local/opt/llvm/lib -lomp
message("OpenMP enabled")
} else {
message("OpenMP disabled")
}
contains(DEFINES,USE_MPI){
QMAKE_CC = /usr/local/bin/mpicc
QMAKE_CXX = /usr/local/bin/mpicxx
QMAKE_LINK = /usr/local/bin/mpicxx
LIBS += -L/usr/local/lib -lmpi
message("MPI enabled")
} else {
message("MPI disabled")
}
}
linux{
INCLUDEPATH += /usr/include \
../gdal/include
contains(DEFINES,USE_CHPC){
INCLUDEPATH += /uufs/chpc.utah.edu/sys/installdir/hdf5/1.8.17-c7/include \
/uufs/chpc.utah.edu/sys/installdir/netcdf-c/4.3.3.1/include \
/uufs/chpc.utah.edu/sys/installdir/netcdf-cxx/4.3.0-c7/include
LIBS += -L/uufs/chpc.utah.edu/sys/installdir/hdf5/1.8.17-c7/lib -l:libhdf5.so.10.2.0 \
-L/uufs/chpc.utah.edu/sys/installdir/netcdf-c/4.4.1/lib -l:libnetcdf.so.11.0.3 \
-L/uufs/chpc.utah.edu/sys/installdir/netcdf-cxx/4.3.0-c7/lib -l:libnetcdf_c++4.so.1.0.3
contains(DEFINES,USE_CVODE){
message("CVODE enabled")
INCLUDEPATH += ../sundials-3.1.1/instdir/include
LIBS += -L../sundials-3.1.1/instdir/lib -lsundials_cvode
}
message("Compiling on CHPC")
}
contains(DEFINES,USE_OPENMP){
QMAKE_CFLAGS += -fopenmp
QMAKE_LFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp
LIBS += -L/usr/lib/x86_64-linux-gnu -lgomp
message("OpenMP enabled")
} else {
message("OpenMP disabled")
}
contains(DEFINES,USE_MPI){
QMAKE_CC = mpicc
QMAKE_CXX = mpic++
QMAKE_LINK = mpic++
QMAKE_CFLAGS += $$system(/usr/local/bin/mpicc --showme:compile)
QMAKE_CXXFLAGS += $$system(/usr/local/bin/mpic++ --showme:compile)
QMAKE_LFLAGS += $$system(/usr/local/bin/mpic++ --showme:link)
LIBS += -L/usr/local/lib/ -lmpi
message("MPI enabled")
} else {
message("MPI disabled")
}
}
win32{
#Windows vspkg package manager installation path
VCPKGDIR = C:/vcpkg/installed/x64-windows
INCLUDEPATH += $${VCPKGDIR}/include \
$${VCPKGDIR}/include/gdal
CONFIG(debug, debug|release) {
LIBS += -L$${VCPKGDIR}/debug/lib -lgdald
} else {
LIBS += -L$${VCPKGDIR}/lib -lgdal
}
contains(DEFINES, USE_CVODE){
message("CVODE enabled")
INCLUDEPATH += $${VCPKGDIR}/include/cvode
CONFIG(release, debug|release) {
LIBS += -L$${VCPKGDIR}/lib -lsundials_cvode
} else {
LIBS += -L$${VCPKGDIR}/debug/lib -lsundials_cvode
}
}
contains(DEFINES, USE_NETCDF){
message("NetCDF enabled")
CONFIG(release, debug|release) {
LIBS += -L$${VCPKGDIR}/lib -lnetcdf \
-L$${VCPKGDIR}/lib -lnetcdf-cxx4
} else {
LIBS += -L$${VCPKGDIR}/debug/lib -lnetcdf \
-L$${VCPKGDIR}/debug/lib -lnetcdf-cxx4
}
}
contains(DEFINES,USE_OPENMP){
QMAKE_CFLAGS += -openmp
QMAKE_CXXFLAGS += -openmp
message("OpenMP enabled")
} else {
message("OpenMP disabled")
}
contains(DEFINES,USE_MPI){
message("MPI enabled")
CONFIG(debug, debug|release) {
LIBS += -L$${VCPKGDIR}/debug/lib -lmsmpi
} else {
LIBS += -L$${VCPKGDIR}/lib -lmsmpi
}
} else {
message("MPI disabled")
}
QMAKE_CXXFLAGS += /MP
QMAKE_LFLAGS += /incremental /debug:fastlink
}
CONFIG(debug, debug|release) {
win32 {
QMAKE_CXXFLAGS += /MDd /O2
}
macx {
QMAKE_CXXFLAGS += -O1
}
linux {
QMAKE_CXXFLAGS += -O3
}
DESTDIR = ./build/debug
OBJECTS_DIR = $$DESTDIR/.obj
MOC_DIR = $$DESTDIR/.moc
RCC_DIR = $$DESTDIR/.qrc
UI_DIR = $$DESTDIR/.ui
macx{
QMAKE_POST_LINK += "cp -a ./../HydroCoupleSDK/build/debug/*HydroCoupleSDK.* ./build/debug/ &&"
QMAKE_POST_LINK += "cp -a ./../ODESolver/build/debug/*ODESolver.* ./build/debug/";
LIBS += -L./../HydroCoupleSDK/build/debug -lHydroCoupleSDK \
-L./../ODESolver/build/debug -lODESolver
}
linux{
QMAKE_POST_LINK += "cp -a ./../HydroCoupleSDK/build/debug/*HydroCoupleSDK.* ./build/debug/ &&"
QMAKE_POST_LINK += "cp -a ./../ODESolver/build/debug/*ODESolver.* ./build/debug/";
LIBS += -L./../HydroCoupleSDK/build/debug -lHydroCoupleSDK \
-L./../ODESolver/build/debug -lODESolver
}
win32{
QMAKE_POST_LINK += "copy /B .\..\HydroCoupleSDK\build\debug\HydroCoupleSDK* .\build\debug &&"
QMAKE_POST_LINK += "copy /B .\..\ODESolver\build\debug\ODESolver* .\build\debug"
LIBS += -L./../HydroCoupleSDK/build/debug -lHydroCoupleSDK1 \
-L./../ODESolver/build/debug -lODESolver1
}
}
CONFIG(release, debug|release) {
win32 {
QMAKE_CXXFLAGS += /MD
}
RELEASE_EXTRAS = ./build/release
OBJECTS_DIR = $$RELEASE_EXTRAS/.obj
MOC_DIR = $$RELEASE_EXTRAS/.moc
RCC_DIR = $$RELEASE_EXTRAS/.qrc
UI_DIR = $$RELEASE_EXTRAS/.ui
macx{
LIBS += -L./../HydroCoupleSDK/lib/macx -lHydroCoupleSDK \
-L./../ODESolver/lib/macx -lODESolver
}
linux{
LIBS += -L./../HydroCoupleSDK/lib/linux -lHydroCoupleSDK \
-L./../ODESolver/lib/linux -lODESolver
}
win32{
LIBS += -L./../HydroCoupleSDK/lib/win32 -lHydroCoupleSDK1 \
-L./../ODESolver/lib/win32 -lODESolver1
}
contains(DEFINES,GWCOMPONENT_LIBRARY){
#MacOS
macx{
DESTDIR = lib/macx
QMAKE_POST_LINK += "cp -a ./../HydroCoupleSDK/lib/macx/*HydroCoupleSDK.* ./lib/macx/ &&"
QMAKE_POST_LINK += "cp -a ./../ODESolver/lib/macx/*ODESolver.* ./lib/macx/";
}
#Linux
linux{
DESTDIR = lib/linux
QMAKE_POST_LINK += "cp -a ./../HydroCoupleSDK/lib/linux/*HydroCoupleSDK.* ./lib/linux/ &&"
QMAKE_POST_LINK += "cp -a ./../ODESolver/lib/linux/*ODESolver.* ./lib/linux/";
}
#Windows
win32{
DESTDIR = lib/win32
QMAKE_POST_LINK += "copy /B .\..\HydroCoupleSDK\lib\win32\HydroCoupleSDK* .\lib\win32 &&"
QMAKE_POST_LINK += "copy /B .\..\ODESolver\lib\win32\ODESolver* .\lib\win32"
}
} else {
#MacOS
macx{
DESTDIR = bin/macx
QMAKE_POST_LINK += "cp -a ./../HydroCoupleSDK/lib/macx/*HydroCoupleSDK.* ./bin/macx/ &&"
QMAKE_POST_LINK += "cp -a ./../ODESolver/lib/macx/*ODESolver.* ./bin/macx/";
}
#Linux
linux{
DESTDIR = bin/linux
QMAKE_POST_LINK += "cp -a ./../HydroCoupleSDK/lib/linux/*HydroCoupleSDK.* ./bin/linux/ &&"
QMAKE_POST_LINK += "cp -a ./../ODESolver/lib/linux/*ODESolver.* ./bin/linux/";
}
#Windows
win32{
DESTDIR = bin/win32
QMAKE_POST_LINK += "copy /B .\..\HydroCoupleSDK\lib\win32\HydroCoupleSDK* .\bin\win32 &&"
QMAKE_POST_LINK += "copy /B .\..\ODESolver\lib\win32\ODESolver* .\bin\win32"
}
}
}
RESOURCES += resources/gwcomponent.qrc