Debian Codegraph @

test cases/frameworks/17 mpi/meson.build

raw ◀ ▶
1 Debian patch touch this file
1 project('mpi', 'c', 'cpp', default_options: ['b_asneeded=false'])
2
3 method = get_option('method')
4
•5 error('MESON_SKIP_TEST openmpi binaries do not work when run in pbuilder for some reason.')
6
7 cc = meson.get_compiler('c')
8 mpic = dependency('mpi', language : 'c', required : false, method : method)
9 if not mpic.found()
10 error('MESON_SKIP_TEST: MPI not found, skipping.')
11 endif
12 exec = executable('exec',
13 'main.c',
14 dependencies : [mpic])
15
16 test('MPI C', exec, timeout: 20)
17
18
19 # C++ MPI not supported by MS-MPI
20 cpp = meson.get_compiler('cpp')
21 mpicpp = dependency('mpi', language : 'cpp', required: false, method : method)
22 if not cpp.links('''
23 #include <mpi.h>
24 #include <stdio.h>
25 int main(int argc, char **argv) {MPI::Init(argc, argv);}
26 ''', dependencies: mpicpp, name: 'C++ MPI')
27 mpicpp = disabler()
28 endif
29 execpp = executable('execpp',
30 'main.cpp',
31 dependencies : [mpicpp])
32
33 test('MPI C++', execpp, timeout: 20)
34
35
36 if add_languages('fortran', required : false)
37 if method in ['auto', 'pkg-config']
38 # https://bugs.debian.org/1078026
39 fs = import('fs')
40 if fs.is_dir('/ci') and fs.exists('/usr/lib/x86_64-linux-gnu/pkgconfig/ompi-fort.pc')
41 if fs.hash('/usr/lib/x86_64-linux-gnu/pkgconfig/ompi-fort.pc', 'md5') == '0892a93630e3d3359c43c58d5a82efc0'
42 error('MESON_SKIP_TEST: openmpi pkgconfig file is broken on Debian/Ubuntu')
43 endif
44 endif
45 endif
46
47 fc = meson.get_compiler('fortran')
48 mpif = dependency('mpi', language : 'fortran', required: false, method : method)
49 if not fc.links('use mpi; end', dependencies: mpif, name: 'Fortran MPI')
50 mpif = disabler()
51 endif
52
53 exef = executable('exef',
54 'main.f90',
55 dependencies : mpif)
56
57 test('MPI Fortran', exef, timeout: 20)
58 endif
59
60
61 # Check we can apply a version constraint
62 if mpic.version() != 'unknown'
63 dependency('mpi', version: '>=@0@'.format(mpic.version()), method : method)
64 endif