From 5de5e7673f48bd1d11f68c3c1cb69041f27d8d22 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Wed, 22 Nov 2017 22:52:38 +0100 Subject: [Qt module] Few minor fixes - removed a typo in tools detection loop - added include dir also when parsing cpp sources with moc, not only headers Signed-off-by: Alexis Jeandet --- mesonbuild/modules/qt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 285169b..df6a631 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -62,7 +62,7 @@ class QtBaseModule: raise MesonException('{name} preprocessor is not for Qt {version}. Output:\n{stdo}\n{stderr}'.format( name=compiler_name, version=self.qt_version, stdo=stdout, stderr=stderr)) mlog.log(' {}:'.format(compiler_name.lower()), mlog.green('YES'), '({path}, {version})'.format( - path=self.moc.get_path(), version=compiler_ver.split()[-1])) + path=compiler.get_path(), version=compiler_ver.split()[-1])) else: mlog.log(' {}:'.format(compiler_name.lower()), mlog.red('NO')) self.tools_detected = True @@ -137,7 +137,7 @@ class QtBaseModule: moc_output = moc_gen.process_files('Qt{} moc header'.format(self.qt_version), moc_headers, state) sources.append(moc_output) if len(moc_sources) > 0: - arguments = moc_extra_arguments + ['@INPUT@', '-o', '@OUTPUT@'] + arguments = moc_extra_arguments + inc + ['@INPUT@', '-o', '@OUTPUT@'] moc_kwargs = {'output': '@BASENAME@.moc', 'arguments': arguments} moc_gen = build.Generator([self.moc], moc_kwargs) -- cgit v1.1 From 1fd743e6adbb04fc0d75ac21908a108c3483dc80 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Wed, 22 Nov 2017 23:28:32 +0100 Subject: [Qt module] Added lrelease detection Just detect lrelease as done with other Qt tools. Uses -version instead of -v to probe version since lrelease don't support it. Signed-off-by: Alexis Jeandet --- mesonbuild/modules/qt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index df6a631..c07a361 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -43,13 +43,13 @@ class QtBaseModule: kwargs = {'required': 'true', 'modules': 'Core', 'silent': 'true', 'method': method} qt = _QT_DEPS_LUT[self.qt_version](env, kwargs) # Get all tools and then make sure that they are the right version - self.moc, self.uic, self.rcc = qt.compilers_detect() + self.moc, self.uic, self.rcc, self.lrelease = qt.compilers_detect() # Moc, uic and rcc write their version strings to stderr. # Moc and rcc return a non-zero result when doing so. # What kind of an idiot thought that was a good idea? - for compiler, compiler_name in ((self.moc, "Moc"), (self.uic, "Uic"), (self.rcc, "Rcc")): + for compiler, compiler_name in ((self.moc, "Moc"), (self.uic, "Uic"), (self.rcc, "Rcc"), (self.lrelease, "lrelease")): if compiler.found(): - stdout, stderr = Popen_safe(compiler.get_command() + ['-v'])[1:3] + stdout, stderr = Popen_safe(compiler.get_command() + ['-version'])[1:3] stdout = stdout.strip() stderr = stderr.strip() if 'Qt {}'.format(self.qt_version) in stderr: -- cgit v1.1 From 5c5eac357199092a1766bc43ce46bd7483451e74 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Thu, 23 Nov 2017 01:42:49 +0100 Subject: [Qt module] Added translation files compilation method - Added a new compile_translations method since preprocess was already quite full and translations compilation is quite different from ui, qrc, cpp files preprocessing. - Updated translation. - Updated test case. Signed-off-by: Alexis Jeandet --- mesonbuild/modules/qt.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index c07a361..463bf01 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -144,3 +144,21 @@ class QtBaseModule: moc_output = moc_gen.process_files('Qt{} moc source'.format(self.qt_version), moc_sources, state) sources.append(moc_output) return ModuleReturnValue(sources, sources) + + @permittedKwargs({'ts_files', 'install', 'install_dir', 'build_by_default', 'method'}) + def compile_translations(self, state, args, kwargs): + ts_files, install_dir = extract_as_list(kwargs, 'ts_files', 'install_dir', pop=True) + self._detect_tools(state.environment, kwargs.get('method', 'auto')) + translations = [] + for ts in ts_files: + cmd = [self.lrelease, '@INPUT@', '-qm', '@OUTPUT@'] + lrelease_kwargs = {'output': '@BASENAME@.qm', + 'input': ts, + 'install': kwargs.get('install', False), + 'build_by_default': kwargs.get('build_by_default', False), + 'command': cmd} + if install_dir is not None: + lrelease_kwargs['install_dir'] = install_dir + lrelease_target = build.CustomTarget('qt{}-compile-{}'.format(self.qt_version, ts), state.subdir, state.subproject, lrelease_kwargs) + translations.append(lrelease_target) + return ModuleReturnValue(translations, translations) -- cgit v1.1