File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed
Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,34 @@ fn main() {
1515 let flags = String :: from_utf8 ( pkg. stdout ) . unwrap ( ) ;
1616 let flags = flags. split ( " " ) ;
1717 let mut config = cpp_build:: Config :: new ( ) ;
18- config. flag ( "-std=c++14" ) ;
18+ config. flag ( "-std=c++14" ) . flag ( "-w" ) ;
19+
20+ let mut search = Vec :: new ( ) ;
21+ let mut libs = Vec :: new ( ) ;
1922
2023 for flag in flags {
21- config. flag ( flag) ;
24+ if let Some ( s) = flag. strip_prefix ( "-L" ) {
25+ search. push ( s. to_string ( ) ) ;
26+ } else if let Some ( s) = flag. strip_prefix ( "-l" ) {
27+ libs. push ( s. to_string ( ) ) ;
28+ } else {
29+ config. flag ( flag) ;
30+ }
2231 }
2332
2433 config. build ( "src/io/oiio.rs" ) ;
2534
26- println ! ( "cargo:rustc-link-lib=OpenImageIO" ) ;
27- println ! ( "cargo:rustc-link-lib=OpenImageIO_Util" ) ;
35+ for s in search {
36+ println ! ( "cargo:rustc-link-search={s}" ) ;
37+ }
38+
39+ if libs. is_empty ( ) {
40+ println ! ( "cargo:rustc-link-lib=OpenImageIO" ) ;
41+ println ! ( "cargo:rustc-link-lib=OpenImageIO_Util" ) ;
42+ } else {
43+ for lib in libs {
44+ println ! ( "cargo:rustc-link-lib={lib}" ) ;
45+ }
46+ }
2847 }
2948}
You can’t perform that action at this time.
0 commit comments