File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -270,6 +270,10 @@ impl Gen {
270270 builder = builder. clang_arg ( * arg) ;
271271 }
272272
273+ for arg in arm_sysroot_args ( ) {
274+ builder = builder. clang_arg ( arg) ;
275+ }
276+
273277 if !spec. allowlist . is_empty ( ) {
274278 for pattern in spec. allowlist {
275279 builder = builder
@@ -394,3 +398,24 @@ impl Gen {
394398 triple. trim ( ) . to_ascii_lowercase ( ) . starts_with ( "thumb" )
395399 }
396400}
401+
402+ fn arm_sysroot_args ( ) -> Vec < String > {
403+ if let Ok ( output) = Command :: new ( "arm-none-eabi-gcc" )
404+ . arg ( "-print-sysroot" )
405+ . output ( )
406+ {
407+ if output. status . success ( ) {
408+ if let Ok ( path) = String :: from_utf8 ( output. stdout ) {
409+ let trimmed = path. trim ( ) ;
410+ if !trimmed. is_empty ( ) {
411+ return vec ! [
412+ format!( "--sysroot={trimmed}" ) ,
413+ format!( "-I{trimmed}/include" ) ,
414+ format!( "-I{trimmed}/include/c++/11.2.1" ) , // adjust compiler version if needed
415+ ] ;
416+ }
417+ }
418+ }
419+ }
420+ Vec :: new ( )
421+ }
You can’t perform that action at this time.
0 commit comments