Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3393)

Unified Diff: build/config/mac/BUILD.gn

Issue 1371153005: Mov Linux & Mac GN compiler flags to separate configs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/linux/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « build/config/linux/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698