aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2019-01-04 15:29:27 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2019-01-06 19:24:05 +0200
commitaa840afb3ab5d5a7e05e5904e2380edff5876913 (patch)
tree665f7c9a529d9f49b6ccea69e3c1b6985b285080
parent90c9b868b20b11bb089fc5e0c634d5ed76fea0cb (diff)
downloadmeson-aa840afb3ab5d5a7e05e5904e2380edff5876913.zip
meson-aa840afb3ab5d5a7e05e5904e2380edff5876913.tar.gz
meson-aa840afb3ab5d5a7e05e5904e2380edff5876913.tar.bz2
Always flatten include_directories lists
-rw-r--r--mesonbuild/interpreter.py14
-rw-r--r--test cases/common/19 includedir/src/meson.build2
-rw-r--r--test cases/common/84 declare dep/entity/meson.build2
3 files changed, 8 insertions, 10 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index f849f3c..07af41d 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2209,7 +2209,7 @@ class Interpreter(InterpreterBase):
version = kwargs.get('version', self.project_version)
if not isinstance(version, str):
raise InterpreterException('Version must be a string.')
- incs = self.entries_to_incdirs(extract_as_list(kwargs, 'include_directories', unholder=True))
+ incs = self.extract_incdirs(kwargs)
libs = extract_as_list(kwargs, 'link_with', unholder=True)
libs_whole = extract_as_list(kwargs, 'link_whole', unholder=True)
sources = extract_as_list(kwargs, 'sources')
@@ -3698,15 +3698,14 @@ This will become a hard error in the future.''' % kwargs['input'])
self.build.data.append(build.Data([cfile], idir, install_mode))
return mesonlib.File.from_built_file(self.subdir, output)
- def entries_to_incdirs(self, prospectives):
- if not isinstance(prospectives, list):
- return self.entries_to_incdirs([prospectives])[0]
+ def extract_incdirs(self, kwargs):
+ prospectives = listify(kwargs.get('include_directories', []), unholder=True)
result = []
for p in prospectives:
- if isinstance(p, (IncludeDirsHolder, build.IncludeDirs)):
+ if isinstance(p, build.IncludeDirs):
result.append(p)
elif isinstance(p, str):
- result.append(self.build_incdir_object([p]))
+ result.append(self.build_incdir_object([p]).held_object)
else:
raise InterpreterException('Include directory objects can only be created from strings or include directories.')
return result
@@ -4072,8 +4071,7 @@ Try setting b_lundef to false instead.'''.format(self.coredata.base_options['b_s
# passed to library() when default_library == 'static'.
kwargs = {k: v for k, v in kwargs.items() if k in targetclass.known_kwargs}
- if 'include_directories' in kwargs:
- kwargs['include_directories'] = self.entries_to_incdirs(kwargs['include_directories'])
+ kwargs['include_directories'] = self.extract_incdirs(kwargs)
target = targetclass(name, self.subdir, self.subproject, is_cross, sources, objs, self.environment, kwargs)
if is_cross:
diff --git a/test cases/common/19 includedir/src/meson.build b/test cases/common/19 includedir/src/meson.build
index 20d9db1..30d2e0c 100644
--- a/test cases/common/19 includedir/src/meson.build
+++ b/test cases/common/19 includedir/src/meson.build
@@ -1,5 +1,5 @@
exe = executable('prog', 'prog.c', 'func.c', include_directories : inc)
test('inc test', exe)
-exe2 = executable('prog2', 'prog.c', 'func.c', include_directories : '../include')
+exe2 = executable('prog2', 'prog.c', 'func.c', include_directories : [['../include']])
test('inc test 2', exe2)
diff --git a/test cases/common/84 declare dep/entity/meson.build b/test cases/common/84 declare dep/entity/meson.build
index 5feb1b9..469ecd3 100644
--- a/test cases/common/84 declare dep/entity/meson.build
+++ b/test cases/common/84 declare dep/entity/meson.build
@@ -1,7 +1,7 @@
entity_lib = static_library('entity', 'entity1.c')
entity_dep = declare_dependency(link_with : [[entity_lib]],
- include_directories : '.',
+ include_directories : [['.']],
sources : 'entity2.c',
compile_args : ['-DUSING_ENT=1'],
version : '1.2.3',