@@ -1892,6 +1892,7 @@ impl Build {
1892
1892
if !target. contains ( "apple-ios" )
1893
1893
&& !target. contains ( "apple-watchos" )
1894
1894
&& !target. contains ( "apple-tvos" )
1895
+ && !target. contains ( "apple-visionos" )
1895
1896
{
1896
1897
cmd. push_cc_arg ( "-ffunction-sections" . into ( ) ) ;
1897
1898
cmd. push_cc_arg ( "-fdata-sections" . into ( ) ) ;
@@ -2033,6 +2034,42 @@ impl Build {
2033
2034
format ! ( "--target={}-apple-tvos{}" , arch, deployment_target) . into ( ) ,
2034
2035
) ;
2035
2036
}
2037
+ } else if target. contains ( "visionos-sim" ) {
2038
+ if let Some ( arch) =
2039
+ map_darwin_target_from_rust_to_compiler_architecture ( target)
2040
+ {
2041
+ let sdk_details = apple_os_sdk_parts (
2042
+ AppleOs :: VisionOS ,
2043
+ & AppleArchSpec :: Simulator ( "" ) ,
2044
+ ) ;
2045
+ let deployment_target = self . apple_deployment_version (
2046
+ AppleOs :: VisionOS ,
2047
+ None ,
2048
+ & sdk_details. sdk ,
2049
+ ) ;
2050
+ cmd. args . push (
2051
+ format ! (
2052
+ "--target={}-apple-xros{}-simulator" ,
2053
+ arch, deployment_target
2054
+ )
2055
+ . into ( ) ,
2056
+ ) ;
2057
+ }
2058
+ } else if target. contains ( "visionos" ) {
2059
+ if let Some ( arch) =
2060
+ map_darwin_target_from_rust_to_compiler_architecture ( target)
2061
+ {
2062
+ let sdk_details =
2063
+ apple_os_sdk_parts ( AppleOs :: VisionOS , & AppleArchSpec :: Device ( "" ) ) ;
2064
+ let deployment_target = self . apple_deployment_version (
2065
+ AppleOs :: VisionOS ,
2066
+ None ,
2067
+ & sdk_details. sdk ,
2068
+ ) ;
2069
+ cmd. args . push (
2070
+ format ! ( "--target={}-apple-xros{}" , arch, deployment_target) . into ( ) ,
2071
+ ) ;
2072
+ }
2036
2073
} else if let Ok ( index) = target_info:: RISCV_ARCH_MAPPING
2037
2074
. binary_search_by_key ( & arch, |( arch, _) | & arch)
2038
2075
{
@@ -2536,6 +2573,8 @@ impl Build {
2536
2573
AppleOs :: WatchOs
2537
2574
} else if target. contains ( "-tvos" ) {
2538
2575
AppleOs :: TvOs
2576
+ } else if target. contains ( "-visionos" ) {
2577
+ AppleOs :: VisionOS
2539
2578
} else {
2540
2579
AppleOs :: Ios
2541
2580
} ;
@@ -2805,6 +2844,7 @@ impl Build {
2805
2844
} else if target. contains ( "apple-ios" )
2806
2845
| target. contains ( "apple-watchos" )
2807
2846
| target. contains ( "apple-tvos" )
2847
+ | target. contains ( "apple-visionos" )
2808
2848
{
2809
2849
clang. to_string ( )
2810
2850
} else if target. contains ( "android" ) {
@@ -3720,7 +3760,7 @@ impl Build {
3720
3760
return None ;
3721
3761
}
3722
3762
}
3723
- // watchOS, tvOS, and others are all new enough that libc++ is their baseline.
3763
+ // watchOS, tvOS, visionOS, and others are all new enough that libc++ is their baseline.
3724
3764
_ => { }
3725
3765
}
3726
3766
@@ -3764,6 +3804,10 @@ impl Build {
3764
3804
AppleOs :: TvOs => deployment_from_env ( "TVOS_DEPLOYMENT_TARGET" )
3765
3805
. or_else ( default_deployment_from_sdk)
3766
3806
. unwrap_or_else ( || "9.0" . into ( ) ) ,
3807
+
3808
+ AppleOs :: VisionOS => deployment_from_env ( "VISIONOS_DEPLOYMENT_TARGET" )
3809
+ . or_else ( default_deployment_from_sdk)
3810
+ . unwrap_or_else ( || "1.0" . into ( ) ) ,
3767
3811
}
3768
3812
}
3769
3813
@@ -3792,6 +3836,7 @@ enum AppleOs {
3792
3836
Ios ,
3793
3837
WatchOs ,
3794
3838
TvOs ,
3839
+ VisionOS ,
3795
3840
}
3796
3841
3797
3842
impl std:: fmt:: Debug for AppleOs {
@@ -3801,6 +3846,7 @@ impl std::fmt::Debug for AppleOs {
3801
3846
AppleOs :: Ios => f. write_str ( "iOS" ) ,
3802
3847
AppleOs :: WatchOs => f. write_str ( "WatchOS" ) ,
3803
3848
AppleOs :: TvOs => f. write_str ( "AppleTVOS" ) ,
3849
+ AppleOs :: VisionOS => f. write_str ( "visionOS" ) ,
3804
3850
}
3805
3851
}
3806
3852
}
@@ -3817,6 +3863,7 @@ fn apple_os_sdk_parts(os: AppleOs, arch: &AppleArchSpec) -> AppleSdkTargetParts
3817
3863
AppleOs :: Ios => ( "iphone" , "ios-" ) ,
3818
3864
AppleOs :: WatchOs => ( "watch" , "watch" ) ,
3819
3865
AppleOs :: TvOs => ( "appletv" , "appletv" ) ,
3866
+ AppleOs :: VisionOS => ( "xr" , "xr" ) ,
3820
3867
} ;
3821
3868
let sdk = match arch {
3822
3869
AppleArchSpec :: Device ( _) if os == AppleOs :: MacOs => Cow :: Borrowed ( "macosx" ) ,
0 commit comments