aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-03-22 15:25:29 -0700
committerDylan Baker <dylan@pnwbakers.com>2021-03-23 15:28:08 -0700
commitc211fea51389728783cf59ae41156a5e0de9c41a (patch)
tree3269d721c713be5e7cd9d0c3a30e14b20b58e46e /mesonbuild/dependencies/base.py
parent54c55f77a976deb0047a78468250b75525df6514 (diff)
downloadmeson-c211fea51389728783cf59ae41156a5e0de9c41a.zip
meson-c211fea51389728783cf59ae41156a5e0de9c41a.tar.gz
meson-c211fea51389728783cf59ae41156a5e0de9c41a.tar.bz2
Refactor Qt Dependency into proper split classes with factories
Currently the Qt Dependencies still use the old "combined" method for dependencies with multiple ways to be found. This is problematic as it means that `get_variable()` and friends don't work, as the dependency can't implement any of those methods. The correct solution is to make use of multiple Dependency instances, and a factory to tie them together. This does that. To handle QMake, I've leveraged the existing config-tool mechanism, which allows us to save a good deal of code, and use well tested code instead of rolling more of our own code. The one thing this doesn't do, but we probably should, is expose the macOS ExtraFrameworks directly, instead of forcing them to be found through QMake. That is a problem for another series, and someone who cares more about macOS than I do.
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r--mesonbuild/dependencies/base.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 6ec74ce..8944780 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -18,6 +18,7 @@ import copy
import functools
import os
import re
+import itertools
import json
import shlex
import shutil
@@ -136,11 +137,21 @@ class Dependency:
return converted
return self.compile_args
+ def get_all_compile_args(self) -> T.List[str]:
+ """Get the compile arguments from this dependency and it's sub dependencies."""
+ return list(itertools.chain(self.get_compile_args(),
+ *[d.get_all_compile_args() for d in self.ext_deps]))
+
def get_link_args(self, raw: bool = False) -> T.List[str]:
if raw and self.raw_link_args is not None:
return self.raw_link_args
return self.link_args
+ def get_all_link_args(self) -> T.List[str]:
+ """Get the link arguments from this dependency and it's sub dependencies."""
+ return list(itertools.chain(self.get_link_args(),
+ *[d.get_all_link_args() for d in self.ext_deps]))
+
def found(self) -> bool:
return self.is_found