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 3bb8eef commit 732ace9
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 @@ -555,9 +555,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 @@ -192,12 +192,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 @@ -296,6 +290,11 @@ fn main() {
format!("{include_out_dir}/cxx-qt-lib/common.h"),
)
.expect("could not copy common.h");

// 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(include_out_dir);

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

0 comments on commit 732ace9

Please sign in to comment.