Debian Codegraph @

test cases/frameworks/17 mpi/meson.build

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