From fbf42b9e558158fd99c0a90e358530c34e9c622b Mon Sep 17 00:00:00 2001 From: Ty Balduf <35307473+TyBalduf@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:35:46 -0400 Subject: [PATCH] Configure meson.build (#34) * Configure meson.build * Make OpenMP dependency explicit, so that symbols can be found during build. * Define Fortran compiler. `fc_id` was previously used, but never set. Signed-off-by: Ty Balduf * Recognize ifx (intel-llvm) --------- Signed-off-by: Ty Balduf --- meson.build | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/meson.build b/meson.build index d6241a9..c2cc809 100644 --- a/meson.build +++ b/meson.build @@ -25,7 +25,33 @@ project( ], ) +fc = meson.get_compiler('fortran') +fc_id = fc.get_id() + lib_deps = [] + +if get_option('openmp') + omp_dep = dependency('openmp', required: fc_id != 'intel' and fc_id != 'intel-llvm' and fc_id != 'nvidia_hpc') + if not omp_dep.found() + if fc_id == 'intel' or fc_id != 'intel-llvm' + message('Using -qopenmp to use OpenMP with Intel compilers') + omp_dep = declare_dependency( + compile_args: '-qopenmp', + link_args: '-qopenmp', + ) + else + message('Using -mp to use OpenMP with NVHPC compilers') + omp_dep = declare_dependency( + compile_args: '-mp', + link_args: '-mp', + ) + endif + endif + lib_deps += omp_dep +endif + +lib_deps += dependency('threads') + subdir('config') srcs = []