File tree 3 files changed +30
-2
lines changed
3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,10 @@ pub(crate) fn header_root() -> PathBuf {
121
121
crate_target ( ) . join ( "include" )
122
122
}
123
123
124
+ pub ( crate ) fn header_root_interface ( ) -> PathBuf {
125
+ target ( ) . join ( "crates-include" )
126
+ }
127
+
124
128
/// The OUT_DIR, converted into a PathBuf
125
129
pub ( crate ) fn out ( ) -> PathBuf {
126
130
env:: var ( "OUT_DIR" ) . unwrap ( ) . into ( )
Original file line number Diff line number Diff line change @@ -133,7 +133,8 @@ impl Interface {
133
133
}
134
134
135
135
fn write_exported_include_directories ( & self ) {
136
- let header_root = dir:: header_root ( ) ;
136
+ let header_root = dir:: header_root_interface ( ) ;
137
+ std:: fs:: create_dir_all ( & header_root) . expect ( "Failed to create header root for interface" ) ;
137
138
for ( header_dir, dest) in & self . exported_include_directories {
138
139
let dest_dir = header_root. join ( dest) ;
139
140
match dir:: symlink_or_copy_directory ( header_dir, & dest_dir) {
@@ -152,6 +153,21 @@ impl Interface {
152
153
)
153
154
} ;
154
155
}
156
+
157
+ // TODO: needs tidying but add an reexport links to the exported include dir
158
+ let header_root_includes = dir:: header_root ( ) ;
159
+ for reexport in & self . reexport_links {
160
+ let source_dir = header_root_includes. join ( reexport) ;
161
+ let dest_dir = header_root. join ( reexport) ;
162
+ match dir:: symlink_or_copy_directory ( & source_dir, & dest_dir) {
163
+ Ok ( true ) => { } ,
164
+ Ok ( false ) => panic ! ( "Failed to create symlink folder already exists!" ) ,
165
+ Err ( e) => panic ! (
166
+ "Failed to {INCLUDE_VERB} `{reexport}` for export_include_directory `{dir_name}`: {e:?}" ,
167
+ dir_name = source_dir. to_string_lossy( )
168
+ )
169
+ } ;
170
+ }
155
171
}
156
172
}
157
173
Original file line number Diff line number Diff line change @@ -653,12 +653,20 @@ impl CxxQtBuilder {
653
653
// or deep copy the files if the platform does not support symlinks.
654
654
fn include_dependency ( & mut self , dependency : & Dependency ) {
655
655
let header_root = dir:: header_root ( ) ;
656
- let dependency_root = dependency. path . join ( "include" ) ;
656
+ let dependency_root = dependency. path . join ( "crates- include" ) ;
657
657
for include_prefix in & dependency. manifest . exported_include_prefixes {
658
658
// setup include directory
659
659
let source = dependency_root. join ( include_prefix) ;
660
660
let dest = header_root. join ( include_prefix) ;
661
661
662
+ // TODO: for now skip, this seems possible that not all crates have exports
663
+ if !Path :: new ( & source) . is_dir ( ) {
664
+ println ! (
665
+ "cargo::warning=Skipping {source:?} no exported includes found for dependency"
666
+ ) ;
667
+ continue ;
668
+ }
669
+
662
670
match dir:: symlink_or_copy_directory ( source, dest) {
663
671
Ok ( true ) => ( ) ,
664
672
Ok ( false ) => {
You can’t perform that action at this time.
0 commit comments