Index: build/config/ios/BUILD.gn |
diff --git a/build/config/ios/BUILD.gn b/build/config/ios/BUILD.gn |
index ec6b9e67bcfb5f1fa5a7acb1495f5d4e6d7d8ac7..71f87de3ff914a0112b14dcf86933f1842b5fcf1 100644 |
--- a/build/config/ios/BUILD.gn |
+++ b/build/config/ios/BUILD.gn |
@@ -23,6 +23,53 @@ declare_args() { |
enable_ios_bitcode = false |
} |
+# 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. |
+config("compiler") { |
+ # These flags are shared between the C compiler and linker. |
+ common_ios_flags = [] |
+ |
+ # CPU architecture. |
+ if (current_cpu == "x64") { |
+ common_ios_flags += [ |
+ "-arch", |
+ "x86_64", |
+ ] |
+ } else if (current_cpu == "x86") { |
+ common_ios_flags += [ |
+ "-arch", |
+ "i386", |
+ ] |
+ } else if (current_cpu == "armv7" || current_cpu == "arm") { |
+ common_ios_flags += [ |
+ "-arch", |
+ "armv7", |
+ ] |
+ } else if (current_cpu == "arm64") { |
+ common_ios_flags += [ |
+ "-arch", |
+ "arm64", |
+ ] |
+ } |
+ |
+ # This is here so that all files get recompiled after an Xcode update. |
+ # (defines are passed via the command line, and build system rebuild things |
+ # when their commandline changes). Nothing should ever read this define. |
+ defines = [ "CR_XCODE_VERSION=$xcode_version" ] |
+ |
+ asmflags = common_ios_flags |
+ cflags = common_ios_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_ios_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 iOS-only. Please see that target for advice on what should go in |
@@ -67,6 +114,9 @@ config("runtime_library") { |
} |
} |
+config("ios_executable_flags") { |
+} |
+ |
config("ios_dynamic_flags") { |
ldflags = [ "-Wl,-ObjC" ] # Always load Objective-C categories and class. |
} |