aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r--mesonbuild/compilers/compilers.py10
-rw-r--r--mesonbuild/compilers/cs.py7
-rw-r--r--mesonbuild/compilers/d.py13
3 files changed, 27 insertions, 3 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index af76ea4..a8a7cd1 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -34,7 +34,7 @@ if T.TYPE_CHECKING:
from ..coredata import OptionDictType, KeyedOptionDictType
from ..envconfig import MachineInfo
from ..environment import Environment
- from ..linkers import DynamicLinker # noqa: F401
+ from ..linkers import DynamicLinker, RSPFileSyntax
from ..dependencies import Dependency
CompilerType = T.TypeVar('CompilerType', bound=Compiler)
@@ -1217,6 +1217,14 @@ class Compiler(metaclass=abc.ABCMeta):
def get_prelink_args(self, prelink_name: str, obj_list: T.List[str]) -> T.List[str]:
raise EnvironmentException(f'{self.id} does not know how to do prelinking.')
+ def rsp_file_syntax(self) -> 'RSPFileSyntax':
+ """The format of the RSP file that this compiler supports.
+
+ If `self.can_linker_accept_rsp()` returns True, then this needs to
+ be implemented
+ """
+ return self.linker.rsp_file_syntax()
+
def get_global_options(lang: str,
comp: T.Type[Compiler],
diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py
index ba65d07..218942c 100644
--- a/mesonbuild/compilers/cs.py
+++ b/mesonbuild/compilers/cs.py
@@ -17,6 +17,7 @@ import textwrap
import typing as T
from ..mesonlib import EnvironmentException
+from ..linkers import RSPFileSyntax
from .compilers import Compiler, MachineChoice, mono_buildtype_args
from .mixins.islinker import BasicLinkerIsCompilerMixin
@@ -125,6 +126,9 @@ class MonoCompiler(CsCompiler):
super().__init__(exelist, version, for_machine, info, 'mono',
runner='mono')
+ def rsp_file_syntax(self) -> 'RSPFileSyntax':
+ return RSPFileSyntax.GCC
+
class VisualStudioCsCompiler(CsCompiler):
def __init__(self, exelist: T.List[str], version: str, for_machine: MachineChoice,
@@ -141,3 +145,6 @@ class VisualStudioCsCompiler(CsCompiler):
tmp.append(flag)
res = tmp
return res
+
+ def rsp_file_syntax(self) -> 'RSPFileSyntax':
+ return RSPFileSyntax.MSVC
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index 92d54e9..d032809 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -18,7 +18,7 @@ import subprocess
import typing as T
from ..mesonlib import (
- EnvironmentException, MachineChoice, version_compare, OptionKey,
+ EnvironmentException, MachineChoice, version_compare, OptionKey, is_windows
)
from ..arglist import CompilerArgs
@@ -36,7 +36,7 @@ if T.TYPE_CHECKING:
from ..dependencies import Dependency, ExternalProgram
from ..envconfig import MachineInfo
from ..environment import Environment
- from ..linkers import DynamicLinker
+ from ..linkers import DynamicLinker, RSPFileSyntax
else:
CompilerMixinBase = object
@@ -780,6 +780,12 @@ class LLVMDCompiler(DmdLikeCompilerMixin, DCompiler):
def get_disable_assert_args(self) -> T.List[str]:
return ['--release']
+ def rsp_file_syntax(self) -> 'RSPFileSyntax':
+ # We use `mesonlib.is_windows` here because we want to konw what the
+ # build machine is, not the host machine. This really means whe whould
+ # have the Environment not the MachineInfo in the compiler.
+ return RSPFileSyntax.MSVC if is_windows() else RSPFileSyntax.GCC
+
class DmdDCompiler(DmdLikeCompilerMixin, DCompiler):
@@ -860,3 +866,6 @@ class DmdDCompiler(DmdLikeCompilerMixin, DCompiler):
def get_disable_assert_args(self) -> T.List[str]:
return ['-release']
+
+ def rsp_file_syntax(self) -> 'RSPFileSyntax':
+ return RSPFileSyntax.MSVC