From 51868d00e7a25ef9e587228e949964a765ed9d2d Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sat, 28 Apr 2018 17:45:23 +0200 Subject: [Qt module] Privates headers: added documentation Signed-off-by: Alexis Jeandet --- docs/markdown/Qt5-module.md | 7 +++++++ docs/markdown/Reference-manual.md | 1 + 2 files changed, 8 insertions(+) (limited to 'docs') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index b5393a85c..5a7a4c262 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -20,6 +20,7 @@ This method generates the necessary targets to build translation files with lrel - `install_dir` directory to install to (optional). - `build_by_default` when set to true, to have this target be built by default, that is, when invoking plain ninja; the default value is false (optional). +## Example A simple example would look like this: ```meson @@ -38,3 +39,9 @@ executable('myprog', 'main.cpp', 'myclass.cpp', moc_files, The 'modules' argument is used to include Qt modules in the project. See the Qt documentation for the [list of modules](http://doc.qt.io/qt-5/qtmodules.html). + +## private headers (since v0.47.0) + +Some projects needs Qt's private headers to build, that's why a **private_headers** keyword argument has been added to [dependency](Reference-manual.md#dependency) method. +Setting this optionnal argument will add private include path of the given module to the compiler flags. +Note that this option is only compatible with qmake dependency method, using auto or pkg-config will fallback to qmake. diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 776703c48..6bfee96dc 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -341,6 +341,7 @@ otherwise. This function supports the following keyword arguments: `>1.0.0`, `<=2.3.5` or `3.1.4` for exact matching. (*Added 0.37.0*) You can also specify multiple restrictions by passing a list to this keyword argument, such as: `['>=3.14.0', '<=4.1.0']`. +- `private_headers`, only available with Qt modules see [documentation](Qt5-module.md#private_headers). If dependency_name is '', the dependency is always not found. So with `required: false`, this always returns a dependency object for which the -- cgit v1.2.3 From f3a8efc11be3b356f95b39430d3bd165f1646038 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Mon, 30 Apr 2018 11:39:58 +0200 Subject: Added Added Qt's private header support with pkg-config Just use the same approach than qmake to generate private headers path Signed-off-by: Alexis Jeandet --- docs/markdown/Qt5-module.md | 3 ++- mesonbuild/dependencies/ui.py | 21 +++++++++++---------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index 5a7a4c262..7b0bf2896 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -44,4 +44,5 @@ See the Qt documentation for the [list of modules](http://doc.qt.io/qt-5/qtmodul Some projects needs Qt's private headers to build, that's why a **private_headers** keyword argument has been added to [dependency](Reference-manual.md#dependency) method. Setting this optionnal argument will add private include path of the given module to the compiler flags. -Note that this option is only compatible with qmake dependency method, using auto or pkg-config will fallback to qmake. + +**Note** that using private headers in your project is a bad idea, do it at your own risks. \ No newline at end of file diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py index 99346ec8d..27820b94e 100644 --- a/mesonbuild/dependencies/ui.py +++ b/mesonbuild/dependencies/ui.py @@ -147,19 +147,20 @@ class GnuStepDependency(ConfigToolDependency): return version -def _qt_get_private_includes(mod_inc_dir, module, qt_version): +def _qt_get_private_includes(mod_inc_dir, module, mod_version): # usually Qt5 puts private headers in /QT_INSTALL_HEADERS/module/VERSION/module/private # except for at least QtWebkit and Enginio where the module version doesn't match Qt version # as an example with Qt 5.10.1 on linux you would get: # /usr/include/qt5/QtCore/5.10.1/QtCore/private/ # /usr/include/qt5/QtWidgets/5.10.1/QtWidgets/private/ - # /usr/include/qt5/Enginio/1.6.2/Enginio/private/ + # /usr/include/qt5/QtWebKit/5.212.0/QtWebKit/private/ # on Qt4 when available private folder is directly in module folder - if int(qt_version.split('.')[0]) < 5: + # like /usr/include/QtCore/private/ + if int(mod_version.split('.')[0]) < 5: return tuple() - private_dir = os.path.join(mod_inc_dir, qt_version) + private_dir = os.path.join(mod_inc_dir, mod_version) # fallback, let's try to find a directory with the latest version if not os.path.exists(private_dir): dirs = [filename for filename in os.listdir(mod_inc_dir) @@ -255,19 +256,19 @@ class QtBaseDependency(ExternalDependency): # qmake-based fallback if pkg-config fails. kwargs['required'] = False modules = OrderedDict() - # Until Qt's pkg-config files provide private headers path - # let's just fallback to qmake method - if self.private_headers: - self.is_found = False - return for module in mods: modules[module] = PkgConfigDependency(self.qtpkgname + module, self.env, kwargs, language=self.language) - for m in modules.values(): + for m_name, m in modules.items(): if not m.found(): self.is_found = False return self.compile_args += m.get_compile_args() + if self.private_headers: + qt_inc_dir = m.get_pkgconfig_variable('includedir', dict()) + mod_private_inc = _qt_get_private_includes(os.path.join(qt_inc_dir, 'Qt' + m_name), m_name, m.version) + for dir in mod_private_inc: + self.compile_args.append('-I' + dir) self.link_args += m.get_link_args() self.is_found = True self.version = m.version -- cgit v1.2.3 From 7cfe970cef7e913279b55f7b3261b53b7f2a50a1 Mon Sep 17 00:00:00 2001 From: Alexis Jeandet Date: Sun, 27 May 2018 21:20:42 +0200 Subject: [Qt module] private_headers kwarg documentation reformulation Signed-off-by: Alexis Jeandet --- docs/markdown/Qt5-module.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md index 7b0bf2896..0185a64dc 100644 --- a/docs/markdown/Qt5-module.md +++ b/docs/markdown/Qt5-module.md @@ -42,7 +42,7 @@ See the Qt documentation for the [list of modules](http://doc.qt.io/qt-5/qtmodul ## private headers (since v0.47.0) -Some projects needs Qt's private headers to build, that's why a **private_headers** keyword argument has been added to [dependency](Reference-manual.md#dependency) method. -Setting this optionnal argument will add private include path of the given module to the compiler flags. +**private_headers** keyword argument has been added to [dependency](Reference-manual.md#dependency) method to allow Qt's modules private headers usage. +Setting this optional argument to true will add private include path of the given module to the compiler flags. **Note** that using private headers in your project is a bad idea, do it at your own risks. \ No newline at end of file -- cgit v1.2.3