diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index b0fa5f5b8..3d7581127 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1087,6 +1087,9 @@ class Compiler: def openmp_flags(self): raise EnvironmentException('Language %s does not support OpenMP flags.' % self.get_display_language()) + def openmp_link_flags(self): + return self.openmp_flags() + def language_stdlib_only_link_flags(self): return [] diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index d0004cef8..4dfd8b438 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -208,6 +208,9 @@ class VisualStudioLikeCompiler(metaclass=abc.ABCMeta): def openmp_flags(self) -> T.List[str]: return ['/openmp'] + def openmp_link_flags(self) -> T.List[str]: + return [] + # FIXME, no idea what these should be. def thread_flags(self, env: 'Environment') -> T.List[str]: return [] diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 04dee0641..5160fba1d 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -97,7 +97,8 @@ class OpenMPDependency(ExternalDependency): for name in header_names: if self.clib_compiler.has_header(name, '', self.env, dependencies=[self], disable_cache=True)[0]: self.is_found = True - self.compile_args = self.link_args = self.clib_compiler.openmp_flags() + self.compile_args = self.clib_compiler.openmp_flags() + self.link_args = self.clib_compiler.openmp_link_flags() break if not self.is_found: mlog.log(mlog.yellow('WARNING:'), 'OpenMP found but omp.h missing.')