aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/c.py3
-rw-r--r--mesonbuild/compilers/compilers.py14
-rw-r--r--mesonbuild/interpreter.py7
3 files changed, 24 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py
index a6ae4af..9b24e85 100644
--- a/mesonbuild/compilers/c.py
+++ b/mesonbuild/compilers/c.py
@@ -1543,6 +1543,9 @@ class VisualStudioCCompiler(CCompiler):
# false without compiling anything
return name in ['dllimport', 'dllexport']
+ def get_argument_syntax(self):
+ return 'msvc'
+
class ArmCCompiler(ArmCompiler, CCompiler):
def __init__(self, exelist, version, compiler_type, is_cross, exe_wrapper=None, **kwargs):
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 8adacef..a038abf 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1214,6 +1214,17 @@ class Compiler:
m = 'Language {} does not support position-independent executable'
raise EnvironmentException(m.format(self.get_display_language()))
+ def get_argument_syntax(self):
+ """Returns the argument family type.
+
+ Compilers fall into families if they try to emulate the command line
+ interface of another compiler. For example, clang is in the GCC family
+ since it accepts most of the same arguments as GCC. ICL (ICC on
+ windows) is in the MSVC family since it accepts most of the same
+ arguments as MSVC.
+ """
+ return 'other'
+
@enum.unique
class CompilerType(enum.Enum):
@@ -1449,6 +1460,9 @@ class GnuLikeCompiler(abc.ABC):
# For other targets, discard the .def file.
return []
+ def get_argument_syntax(self):
+ return 'gcc'
+
class GnuCompiler(GnuLikeCompiler):
"""
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e724e6a..c2cfe5c 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -935,6 +935,7 @@ class CompilerHolder(InterpreterObject):
'first_supported_link_argument': self.first_supported_link_argument_method,
'unittest_args': self.unittest_args_method,
'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method,
+ 'get_argument_syntax': self.get_argument_syntax_method,
})
def _dep_msg(self, deps, endl):
@@ -1532,6 +1533,12 @@ class CompilerHolder(InterpreterObject):
args = mesonlib.stringlistify(args)
return [a for a in args if self.has_func_attribute_method(a, kwargs)]
+ @FeatureNew('compiler.get_argument_syntax_method', '0.49.0')
+ @noPosargs
+ @noKwargs
+ def get_argument_syntax_method(self, args, kwargs):
+ return self.compiler.get_argument_syntax()
+
ModuleState = namedtuple('ModuleState', [
'build_to_src', 'subproject', 'subdir', 'current_lineno', 'environment',