Skip to content

Commit 7aeb01e

Browse files
Juan F. Esteban MüllerJuan F. Esteban Müller
authored andcommitted
adding automatic enabling MPI support if library is present
1 parent 1fc1bc0 commit 7aeb01e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/meson.build

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ base = meson.current_source_dir() + '/core'
1313
dependencies = []
1414

1515
dependencies += dependency('fftw3', version: '>= 3.0.0', required: true)
16-
dependencies += dependency('mpich', version: '>= 4.0.0', required: true)
16+
17+
# Detecting if MPICH is installed and enabling support if present
18+
mpi_dependency = dependency('mpich', version: '>= 4.0.0', required: false)
19+
20+
if mpi_dependency.found()
21+
cpp_args = ['-fPIC', '-std=c++11', '-DUSE_MPI=1']
22+
dependencies += mpi_dependency
23+
else
24+
cpp_args = ['-fPIC', '-std=c++11']
25+
endif
1726

1827
sources = files([
1928
'linac/wrap_linacmodule.cc',
@@ -245,20 +254,18 @@ inc = include_directories([
245254
core_lib = library('core',
246255
sources: sources,
247256
include_directories: inc,
248-
cpp_args: ['-fPIC', '-std=c++11', '-DUSE_MPI=1'],
257+
cpp_args: cpp_args,
249258
override_options: ['b_lundef=false'],
250259
dependencies: dependencies,
251260
install: true,
252-
253261
)
254262

255263
core_dep = declare_dependency(link_with : core_lib)
256264

257-
258265
python.extension_module('orbit_mpi',
259266
sources: [base + '/mpi_init.cc'],
260267
include_directories: inc,
261-
cpp_args: ['-fPIC', '-std=c++11'],
268+
cpp_args: cpp_args,
262269
dependencies: [core_dep],
263270
install: true,
264271
subdir: 'orbit/core',

0 commit comments

Comments
 (0)