Add arch flag to assembler to fix build on ARM64 macOS / iOS.

(cherry picked from commit b767d2e0fdf835dc181bb21c8be69a35671b60b8)
This commit is contained in:
bruvzg 2022-07-01 11:29:21 +03:00 committed by Relintai
parent a9eb3a52a3
commit b7d732b782
3 changed files with 9 additions and 3 deletions

View File

@ -133,10 +133,9 @@ if env["builtin_zstd"]:
"decompress/zstd_decompress_block.c",
"decompress/zstd_decompress.c",
]
if env["platform"] in ["android", "osx", "server", "x11"]:
if env["platform"] in ["android", "iphone", "osx", "server", "x11"]:
# Match platforms with ZSTD_ASM_SUPPORTED in common/portability_macros.h
# iOS x86_64 should be supported in theory, but it fails arm64 build, seems to use host S_compiler.
thirdparty_zstd_sources.append("decompress/huf_decompress_amd64.S")
thirdparty_zstd_sources = [thirdparty_zstd_dir + file for file in thirdparty_zstd_sources]

View File

@ -109,11 +109,13 @@ def configure(env):
if env["ios_simulator"]:
detect_darwin_sdk_path("iphonesimulator", env)
env.Append(ASFLAGS=["-mios-simulator-version-min=10.0"])
env.Append(CCFLAGS=["-mios-simulator-version-min=10.0"])
env.Append(LINKFLAGS=["-mios-simulator-version-min=10.0"])
env.extra_suffix = ".simulator" + env.extra_suffix
else:
detect_darwin_sdk_path("iphone", env)
env.Append(ASFLAGS=["-miphoneos-version-min=10.0"])
env.Append(CCFLAGS=["-miphoneos-version-min=10.0"])
env.Append(LINKFLAGS=["-miphoneos-version-min=10.0"])
@ -127,16 +129,19 @@ def configure(env):
+ " -fobjc-arc -fobjc-abi-version=2 -fobjc-legacy-dispatch -fmessage-length=0 -fpascal-strings -fblocks -fasm-blocks -isysroot $IPHONESDK"
).split()
)
env.Append(ASFLAGS=["-arch", arch_flag])
elif env["arch"] == "arm":
detect_darwin_sdk_path("iphone", env)
env.Append(
CCFLAGS='-fobjc-arc -arch armv7 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -isysroot $IPHONESDK -fvisibility=hidden -mthumb "-DIBOutlet=__attribute__((iboutlet))" "-DIBOutletCollection(ClassName)=__attribute__((iboutletcollection(ClassName)))" "-DIBAction=void)__attribute__((ibaction)" -MMD -MT dependencies'.split()
)
env.Append(ASFLAGS=["-arch", "armv7"])
elif env["arch"] == "arm64":
detect_darwin_sdk_path("iphone", env)
env.Append(
CCFLAGS="-fobjc-arc -arch arm64 -fmessage-length=0 -fno-strict-aliasing -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -fpascal-strings -fblocks -fvisibility=hidden -MMD -MT dependencies -isysroot $IPHONESDK".split()
)
env.Append(ASFLAGS=["-arch", "arm64"])
env.Append(CPPDEFINES=["NEED_LONG_INT"])
env.Append(CPPDEFINES=["LIBYUV_DISABLE_NEON"])

View File

@ -79,10 +79,12 @@ def configure(env):
if env["arch"] == "arm64":
print("Building for macOS 10.15+, platform arm64.")
env.Append(ASFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"])
env.Append(CCFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"])
env.Append(LINKFLAGS=["-arch", "arm64", "-mmacosx-version-min=10.15"])
else:
print("Building for macOS 10.12+, platform x86-64.")
env.Append(ASFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
env.Append(CCFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])
env.Append(LINKFLAGS=["-arch", "x86_64", "-mmacosx-version-min=10.12"])