summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-04-25 15:33:53 -0700
committerEli Schwartz <eschwartz93@gmail.com>2024-06-26 16:15:47 -0400
commitd86e5c52f47829aec4845910a26b59566c32ad61 (patch)
treeecda09ff12099872493f90be8ed092ce73b7ecfb
parent87681980bc8f49d8f3dbbcb0db8944a487575e96 (diff)
downloadmeson-d86e5c52f47829aec4845910a26b59566c32ad61.tar.gz
dependencies/openmp: Set compile and link flags before testing
In case the OpenMP definition adds things like preprocessor directives or include paths, like when building on MacOS with OpenMP from Homebrew.
-rw-r--r--mesonbuild/dependencies/misc.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index e4da6976e..68c379233 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -104,9 +104,13 @@ class OpenMPDependency(SystemDependency):
self.compile_args = self.link_args = self.clib_compiler.openmp_flags(environment)
return
+ # Set these now so they're available for the following compiler checks
+ self.compile_args.extend(self.clib_compiler.openmp_flags(environment))
+ self.link_args.extend(self.clib_compiler.openmp_link_flags(environment))
+
try:
openmp_date = self.clib_compiler.get_define(
- '_OPENMP', '', self.env, self.clib_compiler.openmp_flags(environment), [self], disable_cache=True)[0]
+ '_OPENMP', '', self.env, [], [self], disable_cache=True)[0]
except mesonlib.EnvironmentException as e:
mlog.debug('OpenMP support not available in the compiler')
mlog.debug(e)
@@ -134,8 +138,6 @@ class OpenMPDependency(SystemDependency):
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.extend(self.clib_compiler.openmp_flags(environment))
- self.link_args.extend(self.clib_compiler.openmp_link_flags(environment))
break
if not self.is_found:
mlog.log(mlog.yellow('WARNING:'), 'OpenMP found but omp.h missing.')