1# This test is complementary to and extends "common/190 openmp" so that
2# we can examine more compilers and options than would be warranted in
3# the common test where C/C++ must also be handled.
4project('openmp', 'fortran',
5  meson_version: '>= 0.46')
6
7
8fc = meson.get_compiler('fortran')
9if fc.get_id() == 'gcc' and fc.version().version_compare('<4.2.0')
10  error('MESON_SKIP_TEST gcc is too old to support OpenMP.')
11endif
12if host_machine.system() == 'darwin'
13  error('MESON_SKIP_TEST macOS does not support OpenMP.')
14endif
15
16openmp = dependency('openmp')
17
18env = environment()
19env.set('OMP_NUM_THREADS', '2')
20
21exef = executable('exef',
22  'main.f90',
23  dependencies : [openmp])
24test('OpenMP Fortran', exef, env : env)
25
26openmp_f = dependency('openmp', language : 'fortran')
27exe_f = executable('exe_f',
28  'main.f90',
29  dependencies : [openmp_f])
30test('OpenMP Fortran-specific', exe_f, env : env)
31
32
33# Check we can apply a version constraint
34dependency('openmp', version: '>=@0@'.format(openmp.version()))
35