Skip to content

Commit 3936872

Browse files
ahayzen-kdabLeonMatthesKDAB
authored andcommitted
cxx-qt-lib: use cc Builder include instead of links and export headers
1 parent 1ba45c5 commit 3936872

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,7 @@ impl CxxQtBuilder {
542542
builder.define(extra_define, None);
543543
}
544544

545-
for include_dir in qtbuild.include_paths() {
546-
builder.include(&include_dir);
547-
}
545+
builder.includes(qtbuild.include_paths());
548546
builder.include(&header_root);
549547
builder.include(&generated_header_dir);
550548
}

crates/cxx-qt-lib/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ edition.workspace = true
1111
license.workspace = true
1212
description = "Qt types for integrating `cxx-qt` crate with `cxx`"
1313
repository.workspace = true
14-
# Fake linking so that we expose cargo data as env vars for downstream crates
15-
# https://github.com/rust-lang/cargo/issues/3544
16-
links = "cxx-qt-lib"
1714
exclude = [ "**/generate.sh" ]
1815

1916
[dependencies]

crates/cxx-qt-lib/build.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ fn main() {
193193
println!("cargo:rerun-if-changed=src/{bridge}.rs");
194194
}
195195

196-
for include_path in qtbuild.include_paths() {
197-
cxx_build::CFG
198-
.exported_header_dirs
199-
.push(include_path.as_path());
200-
}
201-
202196
let mut builder =
203197
cxx_build::bridges(rust_bridges.iter().map(|bridge| format!("src/{bridge}.rs")));
204198

@@ -280,6 +274,11 @@ fn main() {
280274
let mut header = File::create(h_path).expect("Could not create header: {h_path}");
281275
write!(header, "{file_contents}").expect("Could not write header: {h_path}");
282276
}
277+
278+
// Load the include paths
279+
//
280+
// TODO: note once we use cxx-qt-build we don't need to include the Qt paths here
281+
builder.includes(qtbuild.include_paths());
283282
builder.include(header_root);
284283

285284
// Enable Qt Gui in C++ if the feature is enabled

0 commit comments

Comments
 (0)