Add 'compiles' and 'has_multi_arguments' for dlang.

pull/1828/head
Mike Wey 8 years ago
parent e985d930af
commit 19da02a5d8
  1. 37
      mesonbuild/compilers.py
  2. 0
      test cases/d/8 has multi arguments/installed_files.txt
  3. 6
      test cases/d/8 has multi arguments/meson.build

@ -1914,6 +1914,43 @@ class DCompiler(Compiler):
paths = paths + ':' + padding
return ['-L-rpath={}'.format(paths)]
def _get_compiler_check_args(self, env, extra_args, dependencies, mode='compile'):
if extra_args is None:
extra_args = []
elif isinstance(extra_args, str):
extra_args = [extra_args]
if dependencies is None:
dependencies = []
elif not isinstance(dependencies, list):
dependencies = [dependencies]
# Collect compiler arguments
args = CompilerArgs(self)
for d in dependencies:
# Add compile flags needed by dependencies
args += d.get_compile_args()
if mode == 'link':
# Add link flags needed to find dependencies
args += d.get_link_args()
if mode == 'compile':
# Add DFLAGS from the env
args += env.coredata.external_args[self.language]
elif mode == 'link':
# Add LDFLAGS from the env
args += env.coredata.external_link_args[self.language]
# extra_args must override all other arguments, so we add them last
args += extra_args
return args
def compiles(self, code, env, extra_args=None, dependencies=None, mode='compile'):
args = self._get_compiler_check_args(env, extra_args, dependencies, mode)
with self.compile(code, args, mode) as p:
return p.returncode == 0
def has_multi_arguments(self, args, env):
return self.compiles('int i;\n', env, extra_args=args)
@classmethod
def translate_args_to_nongnu(cls, args):
dcargs = []

@ -0,0 +1,6 @@
project('D has arguments test', 'd')
compiler = meson.get_compiler('d')
compiler.compiles('int i;')
compiler.has_argument('-I.')
Loading…
Cancel
Save