forked from su2code/SU2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
223 lines (179 loc) · 6.76 KB
/
meson.build
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
project('SU2', 'c', 'cpp',
version: '7.0.8 "Blackbird"',
license: 'LGPL2',
default_options: ['buildtype=release',
'warning_level=0',
'cpp_std=c++11'])
pymod = import('python')
python = pymod.find_installation()
su2_cpp_args = []
su2_deps = [declare_dependency(include_directories: 'externals/CLI11')]
default_warning_flags = []
if build_machine.system() != 'windows'
if meson.get_compiler('cpp').get_id() != 'intel'
default_warning_flags += ['-Wno-empty-body']
endif
default_warning_flags += ['-Wno-unused-parameter',
'-Wno-format-security',
'-Wno-deprecated-declarations',
'-Wno-non-virtual-dtor']
endif
# meson script path
script_path = meson.source_root() / 'meson_scripts'
# mpi flag
mpi = false
# If custom mpi mode is enabled, include and library pathes for MPI have to be set manually to env variables
if get_option('custom-mpi')
mpi_dep = []
mpi = true
# Otherwise they are automatically determined
else
mpi_dep = [dependency('mpi', language:'c', required : get_option('with-mpi')),
dependency('mpi', language:'cpp', required : get_option('with-mpi'))]
if mpi_dep[0].found() or mpi_dep[1].found()
mpi = true
endif
endif
# OpenMP
omp = get_option('with-omp')
if omp
omp_dep = dependency('openmp', language:'cpp')
endif
if get_option('enable-autodiff') or get_option('enable-directdiff')
codi_dep = [declare_dependency(include_directories: 'externals/codi/include')]
codi_rev_args = '-DCODI_REVERSE_TYPE'
codi_for_args = '-DCODI_FORWARD_TYPE'
endif
# add cgns library
if get_option('enable-cgns')
subdir('externals/cgns')
su2_deps += cgns_dep
su2_cpp_args += '-DHAVE_CGNS'
endif
# check for non-debug build
if get_option('buildtype')!='debug'
su2_cpp_args += '-DNDEBUG'
endif
# check for mixed precision floating point arithmetic
if get_option('enable-mixedprec')
su2_cpp_args += '-DUSE_MIXED_PRECISION'
endif
# check if MPI dependencies are found and add them
if mpi
# add MPI dependency
su2_deps += mpi_dep
su2_cpp_args += '-DHAVE_MPI'
# compile metis
subdir('externals/metis')
# add metis dependency
su2_deps += metis_dep
su2_cpp_args += '-DHAVE_METIS'
# compile parmetis
subdir('externals/parmetis')
# add parmetis dependency
su2_deps += parmetis_dep
su2_cpp_args += '-DHAVE_PARMETIS'
# add medi dependency
if get_option('enable-autodiff') or get_option('enable-directdiff')
codi_dep += declare_dependency(include_directories: ['externals/medi/include', 'externals/medi/src'])
endif
endif
if omp
# add OpenMP dependency
su2_deps += omp_dep
endif
if get_option('enable-tecio')
subdir('externals/tecio')
endif
# PaStiX
if get_option('enable-pastix')
assert(mpi,
'PaStiX support requires MPI')
assert(get_option('enable-mkl') or get_option('enable-openblas'),
'PaStiX support requires either mkl or openblas')
su2_cpp_args += '-DHAVE_PASTIX'
pastix_dep = dependency('pastix', required: false)
if not pastix_dep.found()
pastix_root = get_option('pastix_root')+'/install'
scotch_root = get_option('scotch_root')+'/lib'
pastix_dep = declare_dependency(include_directories: pastix_root,
link_args: [ '-L../'+pastix_root, '-L../'+scotch_root,
'-lpastix', '-lscotch', '-lptscotch', '-lptscotcherr',
'-lm', '-lrt', '-lpthread'])
endif
su2_deps += pastix_dep
endif
# blas-type dependencies
if get_option('enable-mkl')
su2_cpp_args += '-DHAVE_MKL'
# the following mkl name matches the linked libs in manual dependency
# see https://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-and-pkg-config-tool
# should probably switch to iomp if Intel OpenMP is used
mkl_dep = dependency('mkl-static-lp64-seq', required: false)
if not mkl_dep.found()
mkl_root = get_option('mkl_root')
mkl_dep = declare_dependency(include_directories: mkl_root+'/include', compile_args: '-m64',
link_args: ['-L'+mkl_root+'/lib/intel64','-lmkl_intel_lp64','-lmkl_sequential','-lmkl_core','-lpthread','-lm','-ldl'])
endif
su2_deps += mkl_dep
elif get_option('enable-openblas')
su2_cpp_args += '-DHAVE_BLAS'
su2_cpp_args += '-DHAVE_LAPACK'
blas_dep = dependency(get_option('blas-name'))
su2_deps += blas_dep
endif
extra_deps = get_option('extra-deps').split(',')
foreach dep : extra_deps
if dep != ''
su2_deps += dependency(dep)
endif
endforeach
catch2_dep = declare_dependency(include_directories: 'externals/catch2/')
# compile common library
subdir('Common/src')
# compile SU2_CFD executable
subdir('SU2_CFD/src')
# compile SU2_DOT executable
subdir('SU2_DOT/src')
# compile SU2_DEF executable
subdir('SU2_DEF/src')
# compile SU2_GEO executable
subdir('SU2_GEO/src')
# compile SU2_SOL executable
subdir('SU2_SOL/src')
# install python scripts
subdir('SU2_PY')
# unit tests
subdir('UnitTests')
if get_option('enable-pywrapper')
subdir('SU2_PY/pySU2')
endif
message('''-------------------------------------------------------------------------
| ___ _ _ ___ |
| / __| | | |_ ) Release 7.0.8 "Blackbird" |
| \__ \ |_| |/ / |
| |___/\___//___| Meson Configuration Summary |
| |
-------------------------------------------------------------------------
Option Value
---------------------
TecIO: @2@
CGNS: @3@
AD (reverse): @4@
AD (forward): @5@
Python Wrapper: @6@
Intel-MKL: @7@
OpenBlas: @8@
PaStiX: @9@
Mixed Float: @10@
Please be sure to add the $SU2_HOME and $SU2_RUN environment variables,
and update your $PATH (and $PYTHONPATH if applicable) with $SU2_RUN
Based on the input to this configuration, add these lines to your .bashrc file:
export SU2_RUN=@0@
export SU2_HOME=@1@
export PATH=$PATH:$SU2_RUN
export PYTHONPATH=$PYTHONPATH:$SU2_RUN
Use './ninja -C @11@ install' to compile and install SU2
'''.format(get_option('prefix')+'/bin', meson.source_root(), get_option('enable-tecio'), get_option('enable-cgns'),
get_option('enable-autodiff'), get_option('enable-directdiff'), get_option('enable-pywrapper'), get_option('enable-mkl'),
get_option('enable-openblas'), get_option('enable-pastix'), get_option('enable-mixedprec'), meson.build_root().split('/')[-1]))