Index: build/config/mac/BUILD.gn |
diff --git a/build/config/mac/BUILD.gn b/build/config/mac/BUILD.gn |
index 16dc52eb0dda89c2d4aed03f54b4684f53d585e2..c2b7fe9cf480410baead30c182bbf358a730e787 100644 |
--- a/build/config/mac/BUILD.gn |
+++ b/build/config/mac/BUILD.gn |
@@ -5,6 +5,48 @@ |
import("//build/config/sysroot.gni") |
import("//build/config/mac/mac_sdk.gni") |
+# This is included by reference in the //build/config/compiler config that |
+# is applied to all targets. It is here to separate out the logic. |
+# |
+# This is applied to BOTH desktop Mac and iOS targets. |
+config("compiler") { |
+ # These flags are shared between the C compiler and linker. |
+ common_mac_flags = [] |
+ |
+ # CPU architecture. |
+ if (current_cpu == "x64") { |
+ common_mac_flags += [ |
+ "-arch", |
+ "x86_64", |
+ ] |
+ } else if (current_cpu == "x86") { |
+ common_mac_flags += [ |
+ "-arch", |
+ "i386", |
+ ] |
+ } else if (current_cpu == "arm") { |
+ # TODO(GYP): we may need to distinguish between "arm64", "armv7", |
+ # and "armv7s" for iOS, and hence need multiple current_cpu values |
+ # rather than just "arm". |
+ common_mac_flags += [ |
+ "-arch", |
+ "arm64", |
+ ] |
+ } |
+ |
+ asmflags = common_mac_flags |
+ cflags = common_mac_flags |
+ |
+ # Without this, the constructors and destructors of a C++ object inside |
+ # an Objective C struct won't be called, which is very bad. |
+ cflags_objcc = [ "-fobjc-call-cxx-cdtors" ] |
+ |
+ cflags_c = [ "-std=c99" ] |
+ cflags_objc = cflags_c |
+ |
+ ldflags = common_mac_flags |
+} |
+ |
# This is included by reference in the //build/config/compiler:runtime_library |
# config that is applied to all targets. It is here to separate out the logic |
# that is Mac-only. Please see that target for advice on what should go in |