aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-11-09 02:25:50 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-11-11 01:51:02 +0530
commit19a06d90330756c8b02e7f6f3dfef150d85efd1f (patch)
tree34de689005d7166433874f23234797c1ea1aaec1 /test cases
parenta72740a0d1a5cbf877d448201f856767fa8be025 (diff)
downloadmeson-19a06d90330756c8b02e7f6f3dfef150d85efd1f.zip
meson-19a06d90330756c8b02e7f6f3dfef150d85efd1f.tar.gz
meson-19a06d90330756c8b02e7f6f3dfef150d85efd1f.tar.bz2
qt4, qt5 modules: Improve moc/uic/rcc detection
Instead of blindly searching in PATH, use Qt5Dependency.compilers_detect() (same for qt4) to get moc/uic/rcc. This is much more robust, and it improves the chances that the correct ones will be found. We still manually verify for now because the fallback in dependencies.py for searching is stll to look in PATH for backwards-compat, and because people probably have setups like that. Also sync the qt4 module with the qt5 module w.r.t. resource compilation and make the compiled qrc.cpp file unique in terms of the framework version used (4 vs 5). This is needed for the test to work properly, which now covers both Qt4 and 5.
Diffstat (limited to 'test cases')
-rw-r--r--test cases/frameworks/4 qt5/meson.build64
1 files changed, 34 insertions, 30 deletions
diff --git a/test cases/frameworks/4 qt5/meson.build b/test cases/frameworks/4 qt5/meson.build
index 5672071..1096c78 100644
--- a/test cases/frameworks/4 qt5/meson.build
+++ b/test cases/frameworks/4 qt5/meson.build
@@ -1,41 +1,45 @@
-project('qt5 build test', 'cpp')
+project('qt4 and 5 build test', 'cpp')
-qt5 = import('qt5')
-qt5dep = dependency('qt5', modules : ['Core', 'Gui', 'Widgets'])
+foreach qt : ['qt4', 'qt5']
+ qtdep = dependency(qt, modules : ['Core', 'Gui', 'Widgets'], required : qt == 'qt5')
+ if qtdep.found()
+ qtmodule = import(qt)
-# The following has two resource files because having two in one target
-# requires you to do it properly or you get linker symbol clashes.
+ # The following has two resource files because having two in one target
+ # requires you to do it properly or you get linker symbol clashes.
-prep = qt5.preprocess(
- moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use.
- ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol.
- qresources : ['stuff.qrc', 'stuff2.qrc'], # Resource file for rcc compiler.
-)
+ prep = qtmodule.preprocess(
+ moc_headers : ['mainWindow.h'], # These need to be fed through the moc tool before use.
+ ui_files : 'mainWindow.ui', # XML files that need to be compiled with the uic tol.
+ qresources : ['stuff.qrc', 'stuff2.qrc'], # Resource file for rcc compiler.
+ )
-q5exe = executable('qt5app',
- sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing.
- prep],
- dependencies : qt5dep)
+ qexe = executable(qt + 'app',
+ sources : ['main.cpp', 'mainWindow.cpp', # Sources that don't need preprocessing.
+ prep],
+ dependencies : qtdep)
-# We need a console test application because some test environments
-# do not have an X server.
+ # We need a console test application because some test environments
+ # do not have an X server.
-qt5core = dependency('qt5', modules : 'Core')
+ qtcore = dependency(qt, modules : 'Core')
-qt5coreapp = executable('q5core', 'q5core.cpp',
- dependencies : qt5core)
+ qtcoreapp = executable(qt + 'core', 'q5core.cpp',
+ dependencies : qtcore)
-test('qt5test', qt5coreapp)
+ test(qt + 'test', qtcoreapp)
-# The build system needs to include the cpp files from
-# headers but the user must manually include moc
-# files from sources.
-manpreprocessed = qt5.preprocess(
- moc_sources : 'manualinclude.cpp',
- moc_headers : 'manualinclude.h')
+ # The build system needs to include the cpp files from
+ # headers but the user must manually include moc
+ # files from sources.
+ manpreprocessed = qtmodule.preprocess(
+ moc_sources : 'manualinclude.cpp',
+ moc_headers : 'manualinclude.h')
-q5maninclude = executable('q5maninclude',
- sources : ['manualinclude.cpp', manpreprocessed],
- dependencies : qt5core)
+ qtmaninclude = executable(qt + 'maninclude',
+ sources : ['manualinclude.cpp', manpreprocessed],
+ dependencies : qtcore)
-test('q5maninclude', q5maninclude)
+ test(qt + 'maninclude', qtmaninclude)
+ endif
+endforeach