Skip to content

Commit 32a4c12

Browse files
committed
qt-build-utils: Add support for including headers from private modules
This allows you to include headers from private modules, e.g. "qpa/qplatformnativeinterface.h" from GuiPrivate. It does this by adding a special case for these modules, and appends the correct path. Fixes KDAB#955
1 parent e84662a commit 32a4c12

File tree

1 file changed

+16
-6
lines changed
  • crates/qt-build-utils/src

1 file changed

+16
-6
lines changed

crates/qt-build-utils/src/lib.rs

+16-6
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,10 @@ impl QtBuild {
489489
};
490490

491491
for qt_module in &self.qt_modules {
492+
if qt_module.contains("Private") {
493+
continue;
494+
}
495+
492496
let framework = if is_apple_target() {
493497
Path::new(&format!("{lib_path}/Qt{qt_module}.framework")).exists()
494498
} else {
@@ -562,13 +566,19 @@ impl QtBuild {
562566
let lib_path = self.qmake_query("QT_INSTALL_LIBS");
563567
let mut paths = Vec::new();
564568
for qt_module in &self.qt_modules {
565-
// Add the usual location for the Qt module
566-
paths.push(format!("{root_path}/Qt{qt_module}"));
569+
if qt_module.contains("Private") {
570+
let version = &self.version;
571+
let qt_module = qt_module.replace("Private", "");
572+
paths.push(format!("{root_path}/Qt{qt_module}/{version}/Qt{qt_module}"));
573+
} else {
574+
// Add the usual location for the Qt module
575+
paths.push(format!("{root_path}/Qt{qt_module}"));
567576

568-
// Ensure that we add any framework's headers path
569-
let header_path = format!("{lib_path}/Qt{qt_module}.framework/Headers");
570-
if is_apple_target() && Path::new(&header_path).exists() {
571-
paths.push(header_path);
577+
// Ensure that we add any framework's headers path
578+
let header_path = format!("{lib_path}/Qt{qt_module}.framework/Headers");
579+
if is_apple_target() && Path::new(&header_path).exists() {
580+
paths.push(header_path);
581+
}
572582
}
573583
}
574584

0 commit comments

Comments
 (0)