@@ -370,7 +370,6 @@ pub struct CxxQtBuilder {
370370 qt_modules : HashSet < String > ,
371371 qml_modules : Vec < OwningQmlModule > ,
372372 cc_builder : cc:: Build ,
373- public_interface : Option < Interface > ,
374373 include_prefix : String ,
375374}
376375
@@ -410,7 +409,6 @@ impl CxxQtBuilder {
410409 qt_modules,
411410 qml_modules : vec ! [ ] ,
412411 cc_builder : cc:: Build :: new ( ) ,
413- public_interface : None ,
414412 include_prefix : crate_name ( ) ,
415413 }
416414 }
@@ -419,15 +417,12 @@ impl CxxQtBuilder {
419417 /// included by later dependencies.
420418 ///
421419 /// The headers generated for this crate will be specified
422- pub fn library ( interface_definition : Interface ) -> Self {
423- let mut this = Self :: new ( ) ;
424- this. public_interface = Some ( interface_definition) ;
425-
420+ pub fn library ( ) -> Self {
426421 if link_name ( ) . is_none ( ) {
427422 panic ! ( "Building a Cxx-Qt based library requires setting a `links` field in the Cargo.toml file.\n Consider adding:\n \t links = \" {}\" \n to your Cargo.toml\n " , crate_name( ) ) ;
428423 }
429424
430- this
425+ Self :: new ( )
431426 }
432427
433428 /// Specify rust file paths to parse through the cxx-qt marco
@@ -1049,7 +1044,7 @@ extern "C" bool {init_fun}() {{
10491044
10501045 /// Generate and compile cxx-qt C++ code, as well as compile any additional files from
10511046 /// [CxxQtBuilder::qobject_header] and [CxxQtBuilder::cc_builder].
1052- pub fn build ( mut self ) {
1047+ pub fn build ( mut self ) -> Interface {
10531048 dir:: clean ( dir:: crate_target ( ) ) . expect ( "Failed to clean crate export directory!" ) ;
10541049
10551050 // We will do these two steps first, as setting up the dependencies can modify flags we
@@ -1125,17 +1120,17 @@ extern "C" bool {init_fun}() {{
11251120 self . cc_builder . compile ( & static_lib_name ( ) ) ;
11261121 }
11271122
1128- if let Some ( mut interface ) = self . public_interface {
1129- interface . manifest = Manifest {
1123+ Interface {
1124+ manifest : Manifest {
11301125 name : crate_name ( ) ,
11311126 link_name : link_name ( )
11321127 . expect ( "The links key must be set when creating a library with CXX-Qt-build!" ) ,
11331128 initializers : vec ! [ public_initializer. strip_file( ) ] ,
11341129 qt_modules : qt_modules. into_iter ( ) . collect ( ) ,
11351130 exported_include_prefixes : vec ! [ ] ,
1136- } ;
1137- interface . dependencies = dependencies ;
1138- interface . export ( ) ;
1131+ } ,
1132+ dependencies,
1133+ .. Default :: default ( )
11391134 }
11401135 }
11411136}
0 commit comments