File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -89,6 +89,14 @@ impl CargoCmd for Command {
8989 // see https://docs.rs/cc/latest/cc/#external-configuration-via-environment-variables
9090 self . env ( format ! ( "CC_{}" , triplet. as_ref( ) ) , cc. as_ref ( ) ) ;
9191 self . env ( "CLANG_PATH" , cc. as_ref ( ) ) ;
92+ // In windows, set LIBCLANG_PATH
93+ if let Some ( parent) = cc. as_ref ( ) . parent ( ) {
94+ if parent. join ( "libclang.dll" ) . exists ( ) {
95+ self . env ( "LIBCLANG_PATH" , parent. join ( "libclang.dll" ) ) ;
96+ } else if parent. join ( "clang.dll" ) . exists ( ) {
97+ self . env ( "LIBCLANG_PATH" , parent. join ( "clang.dll" ) ) ;
98+ }
99+ }
92100 self
93101 }
94102
@@ -163,11 +171,14 @@ impl CargoCmd for Command {
163171 return self ;
164172 }
165173
174+ // For some reason we need to escape backslashes on Windows
175+ let flags = flags. as_ref ( ) . to_string_lossy ( ) . replace ( "\\ " , "\\ \\ " ) ;
176+
166177 let mut new_flags = get_env ( self , "BINDGEN_EXTRA_CLANG_ARGS" ) . unwrap_or_default ( ) ;
167178 if !new_flags. is_empty ( ) {
168179 new_flags. push ( " " ) ;
169180 }
170- new_flags. push ( flags. as_ref ( ) ) ;
181+ new_flags. push ( flags) ;
171182 self . env ( "BINDGEN_EXTRA_CLANG_ARGS" , new_flags) ;
172183 self
173184 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use std::env;
22
33use cargo_hyperlight:: cargo;
44
5- fn main ( ) -> ! {
5+ fn main ( ) {
66 let args = env:: args_os ( ) . enumerate ( ) . filter_map ( |( i, arg) | {
77 // skip the binary name and the "hyperlight" subcommand if present
88 if i == 0 || ( i == 1 && arg == "hyperlight" ) {
@@ -15,5 +15,6 @@ fn main() -> ! {
1515 cargo ( )
1616 . expect ( "Failed to create cargo command" )
1717 . args ( args)
18- . exec ( )
18+ . status ( )
19+ . expect ( "Failed to execute cargo" )
1920}
You can’t perform that action at this time.
0 commit comments