aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/d.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-02-25 15:49:58 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-25 19:42:15 +0200
commitea3b54d40252fcb87eb1852223f125398b1edbdf (patch)
tree7611d792ab044f5acc0d03c7df164827b0b3469c /mesonbuild/compilers/d.py
parent8a68dc0179bc63303a8ef8c4a339cc01ca406084 (diff)
downloadmeson-ea3b54d40252fcb87eb1852223f125398b1edbdf.zip
meson-ea3b54d40252fcb87eb1852223f125398b1edbdf.tar.gz
meson-ea3b54d40252fcb87eb1852223f125398b1edbdf.tar.bz2
Use include_directories for D impdirs.
Change the code to store D properties as plain data. Only convert them to compiler flags in the backend. This also means we can fully parse D arguments without needing to know the compiler being used.
Diffstat (limited to 'mesonbuild/compilers/d.py')
-rw-r--r--mesonbuild/compilers/d.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index 3320736..474e1bd 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -93,7 +93,7 @@ class DCompiler(Compiler):
# FIXME: Make this work for Windows, MacOS and cross-compiling
return get_gcc_soname_args(GCC_STANDARD, prefix, shlib_name, suffix, path, soversion, is_shared_module)
- def get_feature_args(self, kwargs):
+ def get_feature_args(self, kwargs, build_to_src):
res = []
if 'unittest' in kwargs:
unittest = kwargs.pop('unittest')
@@ -122,8 +122,16 @@ class DCompiler(Compiler):
import_dir_arg = d_feature_args[self.id]['import_dir']
if not import_dir_arg:
raise EnvironmentException('D compiler %s does not support the "string import directories" feature.' % self.name_string())
- for d in import_dirs:
- res.append('{0}{1}'.format(import_dir_arg, d))
+ for idir_obj in import_dirs:
+ basedir = idir_obj.get_curdir()
+ for idir in idir_obj.get_incdirs():
+ # Avoid superfluous '/.' at the end of paths when d is '.'
+ if idir not in ('', '.'):
+ expdir = os.path.join(basedir, idir)
+ else:
+ expdir = basedir
+ srctreedir = os.path.join(build_to_src, expdir)
+ res.append('{0}{1}'.format(import_dir_arg, srctreedir))
if kwargs:
raise EnvironmentException('Unknown D compiler feature(s) selected: %s' % ', '.join(kwargs.keys()))