update build for Apple Silicon

You can use this to cross complie from an x86_64 mac if you have
at least XCode12 beta 2 installed, and you set target_cpu = "arm64"
in your gn args.

Change-Id: I3fcdcd162155ac0242c15260994de09177ff2f97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328659
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
Herb Derby 2020-10-20 12:35:51 -04:00 committed by Skia Commit-Bot
parent 4195bcc25a
commit 7e581790bf
3 changed files with 19 additions and 2 deletions

View File

@ -254,6 +254,23 @@ config("default") {
# /System/Library/Frameworks/foo.framework/foo are out of sync.
# Falling back to library file for linking.
ldflags += [ "-Wl,-w" ]
# As of 11/2020, gn is an x86 binary and defaults the host_cpu to x86_64.
# This allows you to build arm64 mac binaries by setting target_cpu = "arm64"
if (current_cpu == "arm64") {
asmflags += [
"-target",
"arm64-apple-macos11",
]
cflags += [
"-target",
"arm64-apple-macos11",
]
ldflags += [
"-target",
"arm64-apple-macos11",
]
}
}
if (sanitize != "" && sanitize != "MSVC") {

View File

@ -95,7 +95,7 @@ if (skia_use_system_libjpeg_turbo) {
"../externals/libjpeg-turbo/simd/arm/common/jidctint-neon.c",
"../externals/libjpeg-turbo/simd/arm/common/jidctred-neon.c",
]
} else if (current_cpu == "arm64" && !is_ios && !is_win) {
} else if (current_cpu == "arm64" && !is_mac && !is_ios && !is_win) {
sources += [
"../externals/libjpeg-turbo/simd/arm/arm64/jsimd.c",
"../externals/libjpeg-turbo/simd/arm/arm64/jsimd_neon.S",

View File

@ -40,7 +40,7 @@ if (skia_use_system_zlib) {
defines += [ "ARMV8_OS_FUCHSIA" ]
} else if (is_win) {
defines += [ "ARMV8_OS_WINDOWS" ]
} else if (is_ios) {
} else if (is_ios || is_mac) {
# iOS@ARM is a special case where we always have NEON but don't check
# for crypto extensions.
defines += [ "ARM_OS_IOS" ]