Add scons with_x86_64h option on macOS, to allow adding an x86_64h slice for improved performance.

pull/1642/head
Lukas Tenbrink 2024-11-17 13:17:28 +01:00
parent c20a84e483
commit ab01d43ede
1 changed files with 6 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import os
import sys import sys
import common_compiler_flags import common_compiler_flags
from SCons.Variables import BoolVariable
def has_osxcross(): def has_osxcross():
@ -11,6 +12,7 @@ def has_osxcross():
def options(opts): def options(opts):
opts.Add("macos_deployment_target", "macOS deployment target", "default") opts.Add("macos_deployment_target", "macOS deployment target", "default")
opts.Add("macos_sdk_path", "macOS SDK path", "") opts.Add("macos_sdk_path", "macOS SDK path", "")
opts.Add(BoolVariable("with_x86_64h", "If arch=x86_64 or universal, include an x86_64h slice.", False))
if has_osxcross(): if has_osxcross():
opts.Add("osxcross_sdk", "OSXCross SDK version", "darwin16") opts.Add("osxcross_sdk", "OSXCross SDK version", "darwin16")
@ -55,6 +57,10 @@ def generate(env):
env.Append(LINKFLAGS=["-arch", env["arch"]]) env.Append(LINKFLAGS=["-arch", env["arch"]])
env.Append(CCFLAGS=["-arch", env["arch"]]) env.Append(CCFLAGS=["-arch", env["arch"]])
if env["with_x86_64h"] and env["arch"] in ["universal", "x86_64"]:
env.Append(LINKFLAGS=["-arch", "x86_64h"])
env.Append(CCFLAGS=["-arch", "x86_64h"])
if env["macos_deployment_target"] != "default": if env["macos_deployment_target"] != "default":
env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]]) env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]]) env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])