11import  os 
22import  sys 
33import  subprocess 
4- import  ios_osxcross 
54from  SCons .Variables  import  * 
65
76if  sys .version_info  <  (3 ,):
@@ -16,6 +15,10 @@ def decode_utf8(x):
1615 return  codecs .utf_8_decode (x )[0 ]
1716
1817
18+ def  has_ios_osxcross ():
19+  return  "OSXCROSS_IOS"  in  os .environ 
20+ 
21+ 
1922def  options (opts ):
2023 opts .Add (BoolVariable ("ios_simulator" , "Target iOS Simulator" , False ))
2124 opts .Add ("ios_min_version" , "Target minimum iphoneos/iphonesimulator version" , "10.0" )
@@ -25,17 +28,18 @@ def options(opts):
2528 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain" ,
2629 )
2730 opts .Add ("IOS_SDK_PATH" , "Path to the iOS SDK" , "" )
28-  ios_osxcross .options (opts )
31+ 
32+  if  has_ios_osxcross ():
33+  opts .Add ("ios_triple" , "Triple for ios toolchain" , "" )
2934
3035
3136def  exists (env ):
32-  return  sys .platform  ==  "darwin"  or  ios_osxcross . exists ( env )
37+  return  sys .platform  ==  "darwin"  or  has_ios_osxcross ( )
3338
3439
3540def  generate (env ):
3641 if  env ["arch" ] not  in "universal" , "arm64" , "x86_64" ):
37-  print ("Only universal, arm64, and x86_64 are supported on iOS. Exiting." )
38-  Exit ()
42+  raise  ValueError ("Only universal, arm64, and x86_64 are supported on iOS. Exiting." )
3943
4044 if  env ["ios_simulator" ]:
4145 sdk_name  =  "iphonesimulator" 
@@ -64,7 +68,26 @@ def generate(env):
6468 env ["ENV" ]["PATH" ] =  env ["IOS_TOOLCHAIN_PATH" ] +  "/Developer/usr/bin/:"  +  env ["ENV" ]["PATH" ]
6569
6670 else :
67-  ios_osxcross .generate (env )
71+  # OSXCross 
72+  compiler_path  =  "$IOS_TOOLCHAIN_PATH/usr/bin/${ios_triple}" 
73+  env ["CC" ] =  compiler_path  +  "clang" 
74+  env ["CXX" ] =  compiler_path  +  "clang++" 
75+  env ["AR" ] =  compiler_path  +  "ar" 
76+  env ["RANLIB" ] =  compiler_path  +  "ranlib" 
77+  env ["SHLIBSUFFIX" ] =  ".dylib" 
78+ 
79+  env .Prepend (
80+  CPPPATH = [
81+  "$IOS_SDK_PATH/usr/include" ,
82+  "$IOS_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers" ,
83+  ]
84+  )
85+ 
86+  env .Append (CCFLAGS = ["-stdlib=libc++" ])
87+ 
88+  binpath  =  os .path .join (env ["IOS_TOOLCHAIN_PATH" ], "usr" , "bin" )
89+  if  binpath  not  in env ["ENV" ]["PATH" ]:
90+  env .PrependENVPath ("PATH" , binpath )
6891
6992 if  env ["arch" ] ==  "universal" :
7093 if  env ["ios_simulator" ]:
0 commit comments