Skip to content

Commit 16524d0

Browse files
committed
qt-build-utils: move include paths to qmake installation
1 parent 346f74c commit 16524d0

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

crates/qt-build-utils/src/installation/qmake.rs

+24-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,30 @@ impl TryFrom<PathBuf> for QtInstallationQMake {
9999
}
100100

101101
impl QtInstallation for QtInstallationQMake {
102-
fn include_modules(&self, _qt_modules: &[String]) -> Vec<PathBuf> {
103-
todo!()
102+
fn include_modules(&self, qt_modules: &[String]) -> Vec<PathBuf> {
103+
let root_path = self.qmake_query("QT_INSTALL_HEADERS");
104+
let lib_path = self.qmake_query("QT_INSTALL_LIBS");
105+
let mut paths = Vec::new();
106+
for qt_module in qt_modules {
107+
// Add the usual location for the Qt module
108+
paths.push(format!("{root_path}/Qt{qt_module}"));
109+
110+
// Ensure that we add any framework's headers path
111+
let header_path = format!("{lib_path}/Qt{qt_module}.framework/Headers");
112+
if utils::is_apple_target() && Path::new(&header_path).exists() {
113+
paths.push(header_path);
114+
}
115+
}
116+
117+
// Add the QT_INSTALL_HEADERS itself
118+
paths.push(root_path);
119+
120+
paths
121+
.iter()
122+
.map(PathBuf::from)
123+
// Only add paths if they exist
124+
.filter(|path| path.exists())
125+
.collect()
104126
}
105127

106128
fn link_modules(&self, builder: &mut cc::Build, qt_modules: &[String]) {

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

+1-23
Original file line numberDiff line numberDiff line change
@@ -411,29 +411,7 @@ impl QtBuild {
411411
/// Get the include paths for Qt, including Qt module subdirectories. This is intended
412412
/// to be passed to whichever tool you are using to invoke the C++ compiler.
413413
pub fn include_paths(&self) -> Vec<PathBuf> {
414-
let root_path = self.qmake_query("QT_INSTALL_HEADERS");
415-
let lib_path = self.qmake_query("QT_INSTALL_LIBS");
416-
let mut paths = Vec::new();
417-
for qt_module in &self.qt_modules {
418-
// Add the usual location for the Qt module
419-
paths.push(format!("{root_path}/Qt{qt_module}"));
420-
421-
// Ensure that we add any framework's headers path
422-
let header_path = format!("{lib_path}/Qt{qt_module}.framework/Headers");
423-
if utils::is_apple_target() && Path::new(&header_path).exists() {
424-
paths.push(header_path);
425-
}
426-
}
427-
428-
// Add the QT_INSTALL_HEADERS itself
429-
paths.push(root_path);
430-
431-
paths
432-
.iter()
433-
.map(PathBuf::from)
434-
// Only add paths if they exist
435-
.filter(|path| path.exists())
436-
.collect()
414+
self.qt_installation.include_modules(&self.qt_modules)
437415
}
438416

439417
/// Version of the detected Qt installation

0 commit comments

Comments
 (0)