Skip to content

Commit 16f9f04

Browse files
committed
cxx-qt-build: remove CxxQtBuilder::library instead use new and export
1 parent fb6ff0f commit 16f9f04

File tree

7 files changed

+7
-21
lines changed

7 files changed

+7
-21
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::path::{Path, PathBuf};
1212
use crate::{dir, dir::INCLUDE_VERB, Dependency, Manifest};
1313

1414
/// When generating a library with cxx-qt-build, the library may need to export certain flags or headers.
15-
/// These are all specified by this Interface struct, which should be passed to the [crate::CxxQtBuilder::library] function.
15+
/// These are all specified by this Interface struct.
1616
pub struct Interface {
1717
// The name of the links keys, whose CXX-Qt dependencies to reexport
1818
pub(crate) reexport_links: HashSet<String>,

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

+1-13
Original file line numberDiff line numberDiff line change
@@ -413,18 +413,6 @@ impl CxxQtBuilder {
413413
}
414414
}
415415

416-
/// Create a new builder that is set up to create a library crate that is meant to be
417-
/// included by later dependencies.
418-
///
419-
/// The headers generated for this crate will be specified
420-
pub fn library() -> Self {
421-
if link_name().is_none() {
422-
panic!("Building a Cxx-Qt based library requires setting a `links` field in the Cargo.toml file.\nConsider adding:\n\tlinks = \"{}\"\nto your Cargo.toml\n", crate_name());
423-
}
424-
425-
Self::new()
426-
}
427-
428416
/// Specify rust file paths to parse through the cxx-qt marco
429417
/// Relative paths are treated as relative to the path of your crate's Cargo.toml file
430418
pub fn file(mut self, rust_source: impl AsRef<Path>) -> Self {
@@ -478,7 +466,7 @@ impl CxxQtBuilder {
478466
/// The `Core` module and any modules from dependencies are linked automatically; there is no need to specify them.
479467
///
480468
/// Note that any qt_module you specify here will be enabled for all downstream
481-
/// dependencies as well if this crate is built as a library with [CxxQtBuilder::library].
469+
/// dependencies as well if this crate is exported.
482470
/// It is therefore best practice to specify features on your crate that allow downstream users
483471
/// to disable any qt modules that are optional.
484472
pub fn qt_module(mut self, module: &str) -> Self {

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

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
use cxx_qt_build::CxxQtBuilder;
77

88
fn main() {
9-
let mut builder = CxxQtBuilder::library()
10-
.qt_module("Gui")
11-
.qt_module("Widgets");
9+
let mut builder = CxxQtBuilder::new().qt_module("Gui").qt_module("Widgets");
1210

1311
let rust_bridges = vec![
1412
"core/qelapsedtimer",

crates/cxx-qt-lib/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ fn main() {
346346
cpp_files.extend(["core/qdatetime", "core/qtimezone"]);
347347
}
348348

349-
let mut builder = CxxQtBuilder::library()
349+
let mut builder = CxxQtBuilder::new()
350350
// Use a short name due to the Windows file path limit!
351351
// We don't re-export these headers anyway
352352
.include_prefix("private")

crates/cxx-qt/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use cxx_qt_build::CxxQtBuilder;
77

88
fn main() {
9-
let mut builder = CxxQtBuilder::library();
9+
let mut builder = CxxQtBuilder::new();
1010

1111
let cpp_files = ["src/connection.cpp"];
1212
let rust_bridges = ["src/connection.rs", "src/qobject.rs"];

examples/qml_multi_crates/rust/sub1/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use cxx_qt_build::{CxxQtBuilder, QmlModule};
77

88
fn main() {
9-
CxxQtBuilder::library()
9+
CxxQtBuilder::new()
1010
.qt_module("Network")
1111
.qml_module(QmlModule::<_, &str> {
1212
uri: "com.kdab.cxx_qt.demo.sub1",

examples/qml_multi_crates/rust/sub2/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use cxx_qt_build::{CxxQtBuilder, QmlModule};
77

88
fn main() {
9-
CxxQtBuilder::library()
9+
CxxQtBuilder::new()
1010
.qml_module(QmlModule::<_, &str> {
1111
uri: "com.kdab.cxx_qt.demo.sub2",
1212
rust_files: &["src/sub2_object.rs"],

0 commit comments

Comments
 (0)