Skip to content

Commit

Permalink
cxx-qt-lib: use cc Builder include instead of links and export headers
Browse files Browse the repository at this point in the history
  • Loading branch information
ahayzen-kdab committed Feb 8, 2024
1 parent c357722 commit e1c0fe0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 1 addition & 3 deletions crates/cxx-qt-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,9 +553,7 @@ impl CxxQtBuilder {
builder.define(extra_define, None);
}

for include_dir in qtbuild.include_paths() {
builder.include(&include_dir);
}
builder.includes(qtbuild.include_paths());
builder.include(&header_root);
builder.include(&generated_header_dir);
}
Expand Down
3 changes: 0 additions & 3 deletions crates/cxx-qt-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ edition.workspace = true
license.workspace = true
description = "Qt types for integrating `cxx-qt` crate with `cxx`"
repository.workspace = true
# Fake linking so that we expose cargo data as env vars for downstream crates
# https://github.com/rust-lang/cargo/issues/3544
links = "cxx-qt-lib"
exclude = [ "**/generate.sh" ]

[dependencies]
Expand Down
11 changes: 5 additions & 6 deletions crates/cxx-qt-lib/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ fn main() {
println!("cargo:rerun-if-changed=src/{bridge}.rs");
}

for include_path in qtbuild.include_paths() {
cxx_build::CFG
.exported_header_dirs
.push(include_path.as_path());
}

let mut builder =
cxx_build::bridges(rust_bridges.iter().map(|bridge| format!("src/{bridge}.rs")));

Expand Down Expand Up @@ -282,6 +276,11 @@ fn main() {
let mut header = File::create(h_path).expect("Could not create header: {h_path}");
write!(header, "{file_contents}").expect("Could not write header: {h_path}");
}

// Load the include paths
//
// TODO: note once we use cxx-qt-build we don't need to include the Qt paths here
builder.includes(qtbuild.include_paths());
builder.include(header_root);

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

0 comments on commit e1c0fe0

Please sign in to comment.