| 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. |
| 4 |
project('openmp', 'fortran', |
| 5 |
meson_version: '>= 0.46') |
| 6 |
|
| 7 |
|
| 8 |
fc = meson.get_compiler('fortran') |
| 9 |
if fc.get_id() == 'gcc' and fc.version().version_compare('<4.2.0') |
| 10 |
error('MESON_SKIP_TEST gcc is too old to support OpenMP.') |
| 11 |
endif |
| 12 |
if host_machine.system() == 'darwin' |
| 13 |
error('MESON_SKIP_TEST macOS does not support OpenMP.') |
| 14 |
endif |
| 15 |
|
| 16 |
openmp = dependency('openmp') |
| 17 |
|
| 18 |
env = environment() |
| 19 |
env.set('OMP_NUM_THREADS', '2') |
| 20 |
|
| 21 |
exef = executable('exef', |
| 22 |
'main.f90', |
| 23 |
dependencies : [openmp]) |
| 24 |
test('OpenMP Fortran', exef, env : env) |
| 25 |
|
| 26 |
openmp_f = dependency('openmp', language : 'fortran') |
| 27 |
exe_f = executable('exe_f', |
| 28 |
'main.f90', |
| 29 |
dependencies : [openmp_f]) |
| 30 |
test('OpenMP Fortran-specific', exe_f, env : env) |
| 31 |
|
| 32 |
|
| 33 |
# Check we can apply a version constraint |
| 34 |
dependency('openmp', version: '>=@0@'.format(openmp.version())) |