Skip to content

Commit 4e6c6b2

Browse files
committed
WIP: cxx-qt-build: use same builder for now for all qml modules
1 parent d0e2a20 commit 4e6c6b2

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

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

+27-25
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,14 @@ fn static_lib_name() -> String {
302302
format!("{}-cxxqt-generated", crate_name())
303303
}
304304

305-
fn qml_module_static_lib_name(module_uri: &str) -> String {
306-
format!(
307-
"{}-qml-module-{}-cxxqt-generated",
308-
crate_name(),
309-
module_name_from_uri(module_uri)
310-
)
311-
}
305+
// TODO: useful once we have a cc_builder per qml_module
306+
// fn qml_module_static_lib_name(module_uri: &str) -> String {
307+
// format!(
308+
// "{}-qml-module-{}-cxxqt-generated",
309+
// crate_name(),
310+
// module_name_from_uri(module_uri)
311+
// )
312+
// }
312313

313314
fn panic_duplicate_file_and_qml_module(
314315
path: impl AsRef<Path>,
@@ -783,13 +784,11 @@ impl CxxQtBuilder {
783784
);
784785
}
785786

786-
// Use a separate cc_builder per QML module so we don't have collisions
787-
//
788-
// TODO: for now we copy the global CxxQtBuilder cc_builder
787+
// TODO: for now we use the global CxxQtBuilder cc_builder
789788
// this means that any includes/files etc on these are in this builder
790789
// but we cannot have separate builds until we can configure includes,
791790
// qt modules, files, cc_builder options etc in the QmlModule itself
792-
let mut cc_builder = self.cc_builder.clone();
791+
let mut cc_builder = &mut self.cc_builder;
793792
qtbuild.cargo_link_libraries(&mut cc_builder);
794793

795794
let mut moc_include_paths = HashSet::new();
@@ -883,20 +882,23 @@ impl CxxQtBuilder {
883882
dir::module_target(&qml_module.uri).join("plugin_init.o"),
884883
);
885884

886-
// Build the QML module as a library
887-
if cc_builder.get_files().count() > 0 {
888-
let qml_library_name = qml_module_static_lib_name(&qml_module.uri);
889-
890-
// The linker argument order matters!
891-
// We need to link the object file first, then link the static library.
892-
// Otherwise, the linker will be unable to find the symbols in the static library file.
893-
// See also: https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc
894-
if !dir::is_exporting() {
895-
println!("cargo::rustc-link-arg=-l{}", &qml_library_name);
896-
}
897-
898-
cc_builder.compile(&qml_library_name);
899-
}
885+
// TODO: once we have a separate cc_builder per qml_module we will
886+
// need to build the qml module here and link it
887+
//
888+
// // Build the QML module as a library
889+
// if cc_builder.get_files().count() > 0 {
890+
// let qml_library_name = qml_module_static_lib_name(&qml_module.uri);
891+
892+
// // The linker argument order matters!
893+
// // We need to link the object file first, then link the static library.
894+
// // Otherwise, the linker will be unable to find the symbols in the static library file.
895+
// // See also: https://stackoverflow.com/questions/45135/why-does-the-order-in-which-libraries-are-linked-sometimes-cause-errors-in-gcc
896+
// if !dir::is_exporting() {
897+
// println!("cargo::rustc-link-arg=-l{}", &qml_library_name);
898+
// }
899+
900+
// cc_builder.compile(&qml_library_name);
901+
// }
900902
}
901903
}
902904

0 commit comments

Comments
 (0)