summaryrefslogtreecommitdiffstats
path: root/tools/ios.py
diff options
context:
space:
mode:
authorDavid Snopek <dsnopek@gmail.com>2023-07-31 15:40:27 -0500
committerGitHub <noreply@github.com>2023-07-31 15:40:27 -0500
commit845226d66aa25a34ffbbf63ca8666f36032ec8ec (patch)
tree8e0adab41c52f1d07ec291e64d9302ba5b4048f9 /tools/ios.py
parentd168dd021e186cecd990322e1fe2133d4342f3b4 (diff)
parent6d195137fe21d6169bc43a928141c006efc7c1f2 (diff)
downloadredot-cpp-845226d66aa25a34ffbbf63ca8666f36032ec8ec.tar.gz
Merge pull request #1191 from Faless/build/unify_osxcross
[SCons] Merge OSXCross tools into platform ones
Diffstat (limited to 'tools/ios.py')
-rw-r--r--tools/ios.py35
1 files changed, 29 insertions, 6 deletions
diff --git a/tools/ios.py b/tools/ios.py
index 477e27a..e387f42 100644
--- a/tools/ios.py
+++ b/tools/ios.py
@@ -1,7 +1,6 @@
import os
import sys
import subprocess
-import ios_osxcross
from SCons.Variables import *
if sys.version_info < (3,):
@@ -16,6 +15,10 @@ else:
return codecs.utf_8_decode(x)[0]
+def has_ios_osxcross():
+ return "OSXCROSS_IOS" in os.environ
+
+
def options(opts):
opts.Add(BoolVariable("ios_simulator", "Target iOS Simulator", False))
opts.Add("ios_min_version", "Target minimum iphoneos/iphonesimulator version", "10.0")
@@ -25,17 +28,18 @@ def options(opts):
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
)
opts.Add("IOS_SDK_PATH", "Path to the iOS SDK", "")
- ios_osxcross.options(opts)
+
+ if has_ios_osxcross():
+ opts.Add("ios_triple", "Triple for ios toolchain", "")
def exists(env):
- return sys.platform == "darwin" or ios_osxcross.exists(env)
+ return sys.platform == "darwin" or has_ios_osxcross()
def generate(env):
if env["arch"] not in ("universal", "arm64", "x86_64"):
- print("Only universal, arm64, and x86_64 are supported on iOS. Exiting.")
- Exit()
+ raise ValueError("Only universal, arm64, and x86_64 are supported on iOS. Exiting.")
if env["ios_simulator"]:
sdk_name = "iphonesimulator"
@@ -64,7 +68,26 @@ def generate(env):
env["ENV"]["PATH"] = env["IOS_TOOLCHAIN_PATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"]
else:
- ios_osxcross.generate(env)
+ # OSXCross
+ compiler_path = "$IOS_TOOLCHAIN_PATH/usr/bin/${ios_triple}"
+ env["CC"] = compiler_path + "clang"
+ env["CXX"] = compiler_path + "clang++"
+ env["AR"] = compiler_path + "ar"
+ env["RANLIB"] = compiler_path + "ranlib"
+ env["SHLIBSUFFIX"] = ".dylib"
+
+ env.Prepend(
+ CPPPATH=[
+ "$IOS_SDK_PATH/usr/include",
+ "$IOS_SDK_PATH/System/Library/Frameworks/AudioUnit.framework/Headers",
+ ]
+ )
+
+ env.Append(CCFLAGS=["-stdlib=libc++"])
+
+ binpath = os.path.join(env["IOS_TOOLCHAIN_PATH"], "usr", "bin")
+ if binpath not in env["ENV"]["PATH"]:
+ env.PrependENVPath("PATH", binpath)
if env["arch"] == "universal":
if env["ios_simulator"]: