@@ -49,6 +49,15 @@ const SKIPPED_TARGETS: &[&str] = &[
49
49
"xtensa-esp32s3-none-elf" ,
50
50
] ;
51
51
52
+ /// Map from a Rust target to the Clang target if they are not the same.
53
+ const MAPPED_TARGETS : & [ ( & str , & str ) ] = & [
54
+ ( "aarch64-apple-ios-sim" , "aarch64-apple-ios" ) ,
55
+ ( "aarch64-apple-tvos-sim" , "aarch64-apple-tvos" ) ,
56
+ ( "aarch64-apple-visionos-sim" , "aarch64-apple-visionos" ) ,
57
+ ( "aarch64-apple-watchos-sim" , "aarch64-apple-watchos" ) ,
58
+ ( "x86_64-apple-watchos-sim" , "x86_64-apple-watchos" ) ,
59
+ ] ;
60
+
52
61
fn main ( ) {
53
62
let targets = get_target_list ( ) ;
54
63
@@ -61,13 +70,15 @@ fn main() {
61
70
continue ;
62
71
}
63
72
73
+ // Map the Rust target string to a Clang target string if needed.
74
+ let ctarget = match MAPPED_TARGETS . iter ( ) . find ( |( rtarget, _ctarget) | rtarget == & target) {
75
+ Some ( ( _rtarget, ctarget) ) => ctarget,
76
+ None => target,
77
+ } ;
78
+
64
79
// Run Clang's preprocessor for the relevant target, printing default macro definitions.
65
80
let clang_output =
66
- clang ( ) . args ( & [ "-E" , "-dM" , "-x" , "c" , "/dev/null" , "-target" , target] ) . run ( ) ;
67
-
68
- if !clang_output. status ( ) . success ( ) {
69
- continue ;
70
- }
81
+ clang ( ) . args ( & [ "-E" , "-dM" , "-x" , "c" , "/dev/null" , "-target" , ctarget] ) . run ( ) ;
71
82
72
83
let defines = String :: from_utf8 ( clang_output. stdout ( ) ) . expect ( "Invalid UTF-8" ) ;
73
84
0 commit comments