aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Jeandet <alexis.jeandet@member.fsf.org>2018-04-30 11:39:58 +0200
committerAlexis Jeandet <alexis.jeandet@member.fsf.org>2018-04-30 11:43:54 +0200
commitf3a8efc11be3b356f95b39430d3bd165f1646038 (patch)
treed389a4d98cfad3fbef03617e3aee610c5ea9acd6
parentf784ee62eab752ca9b8c14281a0c6edbcde2c7b2 (diff)
downloadmeson-f3a8efc11be3b356f95b39430d3bd165f1646038.zip
meson-f3a8efc11be3b356f95b39430d3bd165f1646038.tar.gz
meson-f3a8efc11be3b356f95b39430d3bd165f1646038.tar.bz2
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 <alexis.jeandet@member.fsf.org>
-rw-r--r--docs/markdown/Qt5-module.md3
-rw-r--r--mesonbuild/dependencies/ui.py21
2 files changed, 13 insertions, 11 deletions
diff --git a/docs/markdown/Qt5-module.md b/docs/markdown/Qt5-module.md
index 5a7a4c2..7b0bf28 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 99346ec..27820b9 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