From 2bb58c909fd80cc8ce053b5f1b6565bd28a416d2 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 21 Jan 2017 12:05:38 +0530 Subject: Use CompilerArgs for generation of compile commands At the same time, also fix the order in which compile arguments are added. Detailed comments have been added concerning the priority and order of the arguments. Also adds a unit test and an integration test for the same. --- mesonbuild/build.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index a9f08c3..e5d2284 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -585,14 +585,16 @@ class BuildTarget(Target): for i in self.link_depends: if not isinstance(i, str): raise InvalidArguments('Link_depends arguments must be strings.') - inclist = kwargs.get('include_directories', []) - if not isinstance(inclist, list): - inclist = [inclist] - self.add_include_dirs(inclist) deplist = kwargs.get('dependencies', []) if not isinstance(deplist, list): deplist = [deplist] self.add_deps(deplist) + # Target-specific include dirs must be added after include dirs from + # internal deps (added inside self.add_deps()) to override correctly. + inclist = kwargs.get('include_directories', []) + if not isinstance(inclist, list): + inclist = [inclist] + self.add_include_dirs(inclist) self.custom_install_dir = kwargs.get('install_dir', None) if self.custom_install_dir is not None: if not isinstance(self.custom_install_dir, str): -- cgit v1.1 From bc8c0730f3389d979569fc1f4c99fb9b8308a923 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 21 Jan 2017 12:42:26 +0530 Subject: Add __repr__ for IncludeDirs Helps debug issues with include directory handling. --- mesonbuild/build.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mesonbuild/build.py') diff --git a/mesonbuild/build.py b/mesonbuild/build.py index e5d2284..5466431 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -170,6 +170,10 @@ class IncludeDirs: else: self.extra_build_dirs = extra_build_dirs + def __repr__(self): + r = '<{} {}/{}>' + return r.format(self.__class__.__name__, self.curdir, self.incdirs) + def get_curdir(self): return self.curdir -- cgit v1.1