summaryrefslogtreecommitdiffstats
path: root/tools/macos.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/macos.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/macos.py')
-rw-r--r--tools/macos.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/tools/macos.py b/tools/macos.py
index 5718776..34a755a 100644
--- a/tools/macos.py
+++ b/tools/macos.py
@@ -1,16 +1,20 @@
import os
import sys
-import macos_osxcross
+
+
+def has_osxcross():
+ return "OSXCROSS_ROOT" in os.environ
def options(opts):
opts.Add("macos_deployment_target", "macOS deployment target", "default")
opts.Add("macos_sdk_path", "macOS SDK path", "")
- macos_osxcross.options(opts)
+ if has_osxcross():
+ opts.Add("osxcross_sdk", "OSXCross SDK version", "darwin16")
def exists(env):
- return sys.platform == "darwin" or macos_osxcross.exists(env)
+ return sys.platform == "darwin" or has_osxcross()
def generate(env):
@@ -23,9 +27,25 @@ def generate(env):
env["CXX"] = "clang++"
env["CC"] = "clang"
else:
- # Use osxcross
- macos_osxcross.generate(env)
+ # OSXCross
+ root = os.environ.get("OSXCROSS_ROOT", "")
+ if env["arch"] == "arm64":
+ basecmd = root + "/target/bin/arm64-apple-" + env["osxcross_sdk"] + "-"
+ else:
+ basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
+
+ env["CC"] = basecmd + "clang"
+ env["CXX"] = basecmd + "clang++"
+ env["AR"] = basecmd + "ar"
+ env["RANLIB"] = basecmd + "ranlib"
+ env["AS"] = basecmd + "as"
+
+ binpath = os.path.join(root, "target", "bin")
+ if binpath not in env["ENV"]["PATH"]:
+ # Add OSXCROSS bin folder to PATH (required for linking).
+ env.PrependENVPath("PATH", binpath)
+ # Common flags
if env["arch"] == "universal":
env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])