aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/compilers.py8
-rw-r--r--mesonbuild/compilers/fortran.py8
-rw-r--r--mesonbuild/compilers/mixins/clang.py2
-rw-r--r--mesonbuild/compilers/mixins/elbrus.py4
-rw-r--r--mesonbuild/compilers/mixins/gnu.py4
-rw-r--r--mesonbuild/compilers/mixins/intel.py7
-rw-r--r--mesonbuild/compilers/mixins/pgi.py2
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py4
-rw-r--r--mesonbuild/dependencies/misc.py10
-rw-r--r--mesonbuild/linkers/linkers.py2
10 files changed, 27 insertions, 24 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index c03f1fd..08a596c 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright 2012-2022 The Meson development team
-# Copyright © 2023 Intel Corporation
+# Copyright © 2023-2024 Intel Corporation
from __future__ import annotations
@@ -936,11 +936,11 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
def thread_link_flags(self, env: 'Environment') -> T.List[str]:
return self.linker.thread_flags(env)
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
raise EnvironmentException('Language %s does not support OpenMP flags.' % self.get_display_language())
- def openmp_link_flags(self) -> T.List[str]:
- return self.openmp_flags()
+ def openmp_link_flags(self, env: Environment) -> T.List[str]:
+ return self.openmp_flags(env)
def language_stdlib_only_link_flags(self, env: 'Environment') -> T.List[str]:
return []
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index ad266e9..3e33238 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -256,7 +256,7 @@ class SunFortranCompiler(FortranCompiler):
def get_module_outdir_args(self, path: str) -> T.List[str]:
return ['-moddir=' + path]
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-xopenmp']
@@ -381,7 +381,7 @@ class PathScaleFortranCompiler(FortranCompiler):
'3': default_warn_args,
'everything': default_warn_args}
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-mp']
@@ -482,7 +482,7 @@ class Open64FortranCompiler(FortranCompiler):
'3': default_warn_args,
'everything': default_warn_args}
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-mp']
@@ -525,5 +525,5 @@ class NAGFortranCompiler(FortranCompiler):
def get_std_exe_link_args(self) -> T.List[str]:
return self.get_always_args()
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-openmp']
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py
index e9e83f2..a799e06 100644
--- a/mesonbuild/compilers/mixins/clang.py
+++ b/mesonbuild/compilers/mixins/clang.py
@@ -123,7 +123,7 @@ class ClangCompiler(GnuLikeCompiler):
return super().has_function(funcname, prefix, env, extra_args=extra_args,
dependencies=dependencies)
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
if mesonlib.version_compare(self.version, '>=3.8.0'):
return ['-fopenmp']
elif mesonlib.version_compare(self.version, '>=3.7.0'):
diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py
index 10df3de..71cf722 100644
--- a/mesonbuild/compilers/mixins/elbrus.py
+++ b/mesonbuild/compilers/mixins/elbrus.py
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: Apache-2.0
-# Copyright © 2023 Intel Corporation
+# Copyright © 2023-2024 Intel Corporation
from __future__ import annotations
@@ -89,5 +89,5 @@ class ElbrusCompiler(GnuLikeCompiler):
args.append('-std=' + std)
return args
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-fopenmp']
diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py
index 587b0cc..4a9eb88 100644
--- a/mesonbuild/compilers/mixins/gnu.py
+++ b/mesonbuild/compilers/mixins/gnu.py
@@ -402,7 +402,7 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta):
return gnulike_default_include_dirs(tuple(self.get_exelist(ccache=False)), self.language).copy()
@abc.abstractmethod
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
pass
def gnu_symbol_visibility_args(self, vistype: str) -> T.List[str]:
@@ -585,7 +585,7 @@ class GnuCompiler(GnuLikeCompiler):
def get_pch_suffix(self) -> str:
return 'gch'
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-fopenmp']
def has_arguments(self, args: T.List[str], env: 'Environment', code: str,
diff --git a/mesonbuild/compilers/mixins/intel.py b/mesonbuild/compilers/mixins/intel.py
index d38a42e..902cc74 100644
--- a/mesonbuild/compilers/mixins/intel.py
+++ b/mesonbuild/compilers/mixins/intel.py
@@ -19,6 +19,9 @@ from ..compilers import CompileCheckMode
from .gnu import GnuLikeCompiler
from .visualstudio import VisualStudioLikeCompiler
+if T.TYPE_CHECKING:
+ from ...environment import Environment
+
# XXX: avoid circular dependencies
# TODO: this belongs in a posix compiler class
# NOTE: the default Intel optimization is -O2, unlike GNU which defaults to -O0.
@@ -78,7 +81,7 @@ class IntelGnuLikeCompiler(GnuLikeCompiler):
def get_pch_name(self, name: str) -> str:
return os.path.basename(name) + '.' + self.get_pch_suffix()
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
if mesonlib.version_compare(self.version, '>=15.0.0'):
return ['-qopenmp']
else:
@@ -154,7 +157,7 @@ class IntelVisualStudioLikeCompiler(VisualStudioLikeCompiler):
version = int(v1 + v2)
return self._calculate_toolset_version(version)
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['/Qopenmp']
def get_debug_args(self, is_debug: bool) -> T.List[str]:
diff --git a/mesonbuild/compilers/mixins/pgi.py b/mesonbuild/compilers/mixins/pgi.py
index 0d8245a..71ad81f 100644
--- a/mesonbuild/compilers/mixins/pgi.py
+++ b/mesonbuild/compilers/mixins/pgi.py
@@ -51,7 +51,7 @@ class PGICompiler(Compiler):
return ['-fPIC']
return []
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['-mp']
def get_optimization_args(self, optimization_level: str) -> T.List[str]:
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index 4e2ce09..abcedc7 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -204,10 +204,10 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
objname = os.path.splitext(source)[0] + '.obj'
return objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname]
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return ['/openmp']
- def openmp_link_flags(self) -> T.List[str]:
+ def openmp_link_flags(self, env: Environment) -> T.List[str]:
return []
# FIXME, no idea what these should be.
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 72c7cf0..e4da697 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -95,18 +95,18 @@ class OpenMPDependency(SystemDependency):
# No macro defined for OpenMP, but OpenMP 3.1 is supported.
self.version = '3.1'
self.is_found = True
- self.compile_args = self.link_args = self.clib_compiler.openmp_flags()
+ self.compile_args = self.link_args = self.clib_compiler.openmp_flags(environment)
return
if self.clib_compiler.get_id() == 'pgi':
# through at least PGI 19.4, there is no macro defined for OpenMP, but OpenMP 3.1 is supported.
self.version = '3.1'
self.is_found = True
- self.compile_args = self.link_args = self.clib_compiler.openmp_flags()
+ self.compile_args = self.link_args = self.clib_compiler.openmp_flags(environment)
return
try:
openmp_date = self.clib_compiler.get_define(
- '_OPENMP', '', self.env, self.clib_compiler.openmp_flags(), [self], disable_cache=True)[0]
+ '_OPENMP', '', self.env, self.clib_compiler.openmp_flags(environment), [self], disable_cache=True)[0]
except mesonlib.EnvironmentException as e:
mlog.debug('OpenMP support not available in the compiler')
mlog.debug(e)
@@ -134,8 +134,8 @@ 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())
- self.link_args.extend(self.clib_compiler.openmp_link_flags())
+ 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.')
diff --git a/mesonbuild/linkers/linkers.py b/mesonbuild/linkers/linkers.py
index 7507f5a..f5e8080 100644
--- a/mesonbuild/linkers/linkers.py
+++ b/mesonbuild/linkers/linkers.py
@@ -62,7 +62,7 @@ class StaticLinker:
def thread_link_flags(self, env: 'Environment') -> T.List[str]:
return []
- def openmp_flags(self) -> T.List[str]:
+ def openmp_flags(self, env: Environment) -> T.List[str]:
return []
def get_option_link_args(self, options: 'KeyedOptionDictType') -> T.List[str]: