diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-05-18 20:50:03 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-08-01 14:26:01 +0100 |
commit | f2673d9b57d0134c293e7acf5af5a0b3364523fb (patch) | |
tree | 02266f8449cf50f7cda389c1f6193a2d40957c02 /mesonbuild/dependencies/dev.py | |
parent | 3576623b0f46dab27fbb243f6d5595916187642f (diff) | |
download | meson-f2673d9b57d0134c293e7acf5af5a0b3364523fb.zip meson-f2673d9b57d0134c293e7acf5af5a0b3364523fb.tar.gz meson-f2673d9b57d0134c293e7acf5af5a0b3364523fb.tar.bz2 |
Consolidate reporting result of a dependency check
If successful, we should identify the method which was successful
If successful, we should report the version found (if known)
If failing, we should identify the methods we tried
Some dependency detectors which had no reporting now gain it
There's all kinds of complexities, inconsistencies and special cases hidden
in the existing behaviour, e.g.:
- boost reports modules requested, and BOOST_ROOT (if set)
- gtest/gmock report if they are a prebuilt library or header only
- mpi reports the language
- qt reports modules requested, and the config tool used or tried
- configtool reports the config tool used
- llvm reports if missing modules are optional (one per line)
We add some simple hooks to allow the dependency object to expose the
currently reported information into the consolidated reporting
Note that PkgConfigDependency() takes a silent: keyword which is used
internallly to suppress reporting. This behaviour isn't needed in
find_external_dependency().
Diffstat (limited to 'mesonbuild/dependencies/dev.py')
-rw-r--r-- | mesonbuild/dependencies/dev.py | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index 4ea3385..0cd3c2b 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -45,7 +45,7 @@ class GTestDependency(ExternalDependency): if self.main: self.link_args += gtest_main_detect self.sources = [] - mlog.log('Dependency GTest found:', mlog.green('YES'), '(prebuilt)') + self.prebuilt = True elif self.detect_srcdir(): self.is_found = True self.compile_args = ['-I' + d for d in self.src_include_dirs] @@ -54,9 +54,8 @@ class GTestDependency(ExternalDependency): self.sources = [self.all_src, self.main_src] else: self.sources = [self.all_src] - mlog.log('Dependency GTest found:', mlog.green('YES'), '(building self)') + self.prebuilt = False else: - mlog.log('Dependency GTest found:', mlog.red('NO')) self.is_found = False def detect_srcdir(self): @@ -76,6 +75,12 @@ class GTestDependency(ExternalDependency): def need_threads(self): return True + def log_info(self): + if self.prebuilt: + return 'prebuilt' + else: + return 'building self' + class GMockDependency(ExternalDependency): def __init__(self, environment, kwargs): @@ -89,7 +94,7 @@ class GMockDependency(ExternalDependency): self.compile_args = [] self.link_args = gmock_detect self.sources = [] - mlog.log('Dependency GMock found:', mlog.green('YES'), '(prebuilt)') + self.prebuilt = True return for d in ['/usr/src/googletest/googlemock/src', '/usr/src/gmock/src', '/usr/src/gmock']: @@ -106,11 +111,17 @@ class GMockDependency(ExternalDependency): self.sources = [all_src, main_src] else: self.sources = [all_src] - mlog.log('Dependency GMock found:', mlog.green('YES'), '(building self)') + self.prebuilt = False return - mlog.log('Dependency GMock found:', mlog.red('NO')) + self.is_found = False + def log_info(self): + if self.prebuilt: + return 'prebuilt' + else: + return 'building self' + class LLVMDependency(ConfigToolDependency): """ @@ -145,6 +156,7 @@ class LLVMDependency(ConfigToolDependency): super().__init__('LLVM', environment, 'cpp', kwargs) self.provided_modules = [] self.required_modules = set() + self.module_details = [] if not self.is_found: return self.static = kwargs.get('static', False) @@ -237,21 +249,30 @@ class LLVMDependency(ConfigToolDependency): is required. """ for mod in sorted(set(modules)): + status = '' + if mod not in self.provided_modules: - mlog.log('LLVM module', mlog.bold(mod), 'found:', mlog.red('NO'), - '(optional)' if not required else '') if required: self.is_found = False if self.required: raise DependencyException( 'Could not find required LLVM Component: {}'.format(mod)) + status = '(missing)' + else: + status = '(missing but optional)' else: self.required_modules.add(mod) - mlog.log('LLVM module', mlog.bold(mod), 'found:', mlog.green('YES')) + + self.module_details.append(mod + status) def need_threads(self): return True + def log_details(self): + if self.module_details: + return 'modules: ' + ', '.join(self.module_details) + return '' + class ValgrindDependency(PkgConfigDependency): ''' |