@@ -120,19 +120,29 @@ def SupportsMacOSUniversalBinaries():
120120 XcodeVersion = XcodeOutput [XcodeFind :].split (' ' )[1 ]
121121 return (XcodeVersion > '11.0' )
122122
123- def GetSDKRoot (context ) -> Optional [str ]:
123+
124+ def GetSDKName (context ) -> str :
124125 sdk = "macosx"
125126 if context .buildTarget == TARGET_IOS :
126- sdk = "iphoneos "
127+ sdk = "iPhoneOS "
127128 elif context .buildTarget == TARGET_VISIONOS :
128- sdk = "xros"
129+ sdk = "xrOS"
130+
131+ return sdk
132+
133+ def GetSDKRoot (context ) -> Optional [str ]:
134+ sdk = GetSDKName (context ).lower ()
129135
130136 for arg in (context .cmakeBuildArgs or '' ).split ():
131137 if "CMAKE_OSX_SYSROOT" in arg :
132138 override = arg .split ('=' )[1 ].strip ('"' ).strip ()
133139 if override :
134140 sdk = override
135- return GetCommandOutput (["xcrun" , "--sdk" , sdk , "--show-sdk-path" ])
141+
142+ sdkroot = GetCommandOutput (["xcrun" , "--sdk" , sdk , "--show-sdk-path" ])
143+ if not sdkroot :
144+ raise RuntimeError (f"Could not find an sdk path. Make sure you have the { sdk } sdk installed." )
145+ return sdkroot
136146
137147def SetTarget (context , targetName ):
138148 context .targetNative = (targetName == TARGET_NATIVE )
@@ -250,3 +260,30 @@ def ConfigureCMakeExtraArgs(context, args:List[str]) -> List[str]:
250260 args .append (f"-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH" )
251261
252262 return args
263+
264+ def GetTBBPatches (context ):
265+ if context .buildTarget not in EMBEDDED_PLATFORMS or context .buildTarget == TARGET_IOS :
266+ # TBB already handles these so we don't patch them out
267+ return [], []
268+
269+ sdk_name = GetSDKName (context )
270+
271+ # Standard Target based names
272+ target_config_patches = [("ios" , context .buildTarget .lower ()),
273+ ("iOS" , context .buildTarget ),
274+ ("IPHONEOS" , sdk_name .upper ())]
275+
276+ clang_config_patches = [("ios" ,context .buildTarget .lower ()),
277+ ("iOS" , context .buildTarget ),
278+ ("IPHONEOS" ,sdk_name .upper ())]
279+
280+ if context .buildTarget == TARGET_VISIONOS :
281+ target_config_patches .extend ([("iPhone" , "XR" ),
282+ ("?= 8.0" , "?= 1.0" )])
283+
284+ clang_config_patches .append (("iPhone" , "XR" ),)
285+
286+ if context .buildTarget == TARGET_VISIONOS :
287+ clang_config_patches .append (("-miphoneos-version-min=" , "-target arm64-apple-xros" ))
288+
289+ return target_config_patches , clang_config_patches
0 commit comments