diff options
author | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
---|---|---|
committer | Angelos Mouzakitis <a.mouzakitis@virtualopensystems.com> | 2023-10-10 14:33:42 +0000 |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /meson/test cases/frameworks/17 mpi/meson.build | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'meson/test cases/frameworks/17 mpi/meson.build')
-rw-r--r-- | meson/test cases/frameworks/17 mpi/meson.build | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/meson/test cases/frameworks/17 mpi/meson.build b/meson/test cases/frameworks/17 mpi/meson.build new file mode 100644 index 000000000..d1d899155 --- /dev/null +++ b/meson/test cases/frameworks/17 mpi/meson.build @@ -0,0 +1,52 @@ +project('mpi', 'c', 'cpp', default_options: ['b_asneeded=false']) + +method = get_option('method') + +cc = meson.get_compiler('c') +mpic = dependency('mpi', language : 'c', required : false, method : method) +if not mpic.found() + error('MESON_SKIP_TEST: MPI not found, skipping.') +endif +exec = executable('exec', + 'main.c', + dependencies : [mpic]) + +test('MPI C', exec, timeout: 20) + + +# C++ MPI not supported by MS-MPI +cpp = meson.get_compiler('cpp') +mpicpp = dependency('mpi', language : 'cpp', required: false, method : method) +if not cpp.links(''' +#include <mpi.h> +#include <stdio.h> +int main(int argc, char **argv) {MPI::Init(argc, argv);} +''', dependencies: mpicpp, name: 'C++ MPI') + mpicpp = disabler() +endif +execpp = executable('execpp', + 'main.cpp', + dependencies : [mpicpp]) + +test('MPI C++', execpp, timeout: 20) + + +if add_languages('fortran', required : false) + fc = meson.get_compiler('fortran') + mpif = dependency('mpi', language : 'fortran', required: false, method : method) + if not fc.links('use mpi; end', dependencies: mpif, name: 'Fortran MPI') + mpif = disabler() + endif + + exef = executable('exef', + 'main.f90', + dependencies : mpif) + + test('MPI Fortran', exef, timeout: 20) +endif + + +# Check we can apply a version constraint +if mpic.version() != 'unknown' + dependency('mpi', version: '>=@0@'.format(mpic.version()), method : method) +endif |