| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/ios/ios_sdk.gni") | 5 import("//build/config/ios/ios_sdk.gni") |
| 6 import("//build/config/sysroot.gni") | 6 import("//build/config/sysroot.gni") |
| 7 import("//build/toolchain/toolchain.gni") | 7 import("//build/toolchain/toolchain.gni") |
| 8 | 8 |
| 9 declare_args() { | 9 declare_args() { |
| 10 # Enabling this option makes clang compile to an intermediate | 10 # Enabling this option makes clang compile to an intermediate |
| 11 # representation ("bitcode"), and not to native code. This is preferred | 11 # representation ("bitcode"), and not to native code. This is preferred |
| 12 # when including WebRTC in the apps that will be sent to Apple's App Store | 12 # when including WebRTC in the apps that will be sent to Apple's App Store |
| 13 # and mandatory for the apps that run on watchOS or tvOS. | 13 # and mandatory for the apps that run on watchOS or tvOS. |
| 14 # The option only works when building with Xcode (use_xcode_clang = true). | 14 # The option only works when building with Xcode (use_xcode_clang = true). |
| 15 # Mimicking how Xcode handles it, the production builds (is_debug = false) | 15 # Mimicking how Xcode handles it, the production builds (is_debug = false) |
| 16 # get real bitcode sections added, while the debug builds (is_debug = true) | 16 # get real bitcode sections added, while the debug builds (is_debug = true) |
| 17 # only get bitcode-section "markers" added in them. | 17 # only get bitcode-section "markers" added in them. |
| 18 # NOTE: This option is ignored when building versions for the iOS simulator, | 18 # NOTE: This option is ignored when building versions for the iOS simulator, |
| 19 # where a part of libvpx is compiled from the assembly code written using | 19 # where a part of libvpx is compiled from the assembly code written using |
| 20 # Intel assembly syntax; Yasm / Nasm do not support emitting bitcode parts. | 20 # Intel assembly syntax; Yasm / Nasm do not support emitting bitcode parts. |
| 21 # That is not a limitation for now as Xcode mandates the presence of bitcode | 21 # That is not a limitation for now as Xcode mandates the presence of bitcode |
| 22 # only when building bitcode-enabled projects for real devices (ARM CPUs). | 22 # only when building bitcode-enabled projects for real devices (ARM CPUs). |
| 23 enable_ios_bitcode = false | 23 enable_ios_bitcode = false |
| 24 } | 24 } |
| 25 | 25 |
| 26 # This is included by reference in the //build/config/compiler config that |
| 27 # is applied to all targets. It is here to separate out the logic. |
| 28 config("compiler") { |
| 29 # These flags are shared between the C compiler and linker. |
| 30 common_ios_flags = [] |
| 31 |
| 32 # CPU architecture. |
| 33 if (current_cpu == "x64") { |
| 34 common_ios_flags += [ |
| 35 "-arch", |
| 36 "x86_64", |
| 37 ] |
| 38 } else if (current_cpu == "x86") { |
| 39 common_ios_flags += [ |
| 40 "-arch", |
| 41 "i386", |
| 42 ] |
| 43 } else if (current_cpu == "armv7" || current_cpu == "arm") { |
| 44 common_ios_flags += [ |
| 45 "-arch", |
| 46 "armv7", |
| 47 ] |
| 48 } else if (current_cpu == "arm64") { |
| 49 common_ios_flags += [ |
| 50 "-arch", |
| 51 "arm64", |
| 52 ] |
| 53 } |
| 54 |
| 55 # This is here so that all files get recompiled after an Xcode update. |
| 56 # (defines are passed via the command line, and build system rebuild things |
| 57 # when their commandline changes). Nothing should ever read this define. |
| 58 defines = [ "CR_XCODE_VERSION=$xcode_version" ] |
| 59 |
| 60 asmflags = common_ios_flags |
| 61 cflags = common_ios_flags |
| 62 |
| 63 # Without this, the constructors and destructors of a C++ object inside |
| 64 # an Objective C struct won't be called, which is very bad. |
| 65 cflags_objcc = [ "-fobjc-call-cxx-cdtors" ] |
| 66 |
| 67 cflags_c = [ "-std=c99" ] |
| 68 cflags_objc = cflags_c |
| 69 |
| 70 ldflags = common_ios_flags |
| 71 } |
| 72 |
| 26 # This is included by reference in the //build/config/compiler:runtime_library | 73 # This is included by reference in the //build/config/compiler:runtime_library |
| 27 # config that is applied to all targets. It is here to separate out the logic | 74 # config that is applied to all targets. It is here to separate out the logic |
| 28 # that is iOS-only. Please see that target for advice on what should go in | 75 # that is iOS-only. Please see that target for advice on what should go in |
| 29 # :runtime_library vs. :compiler. | 76 # :runtime_library vs. :compiler. |
| 30 config("runtime_library") { | 77 config("runtime_library") { |
| 31 common_flags = [ | 78 common_flags = [ |
| 32 "-isysroot", | 79 "-isysroot", |
| 33 sysroot, | 80 sysroot, |
| 34 | 81 |
| 35 "-stdlib=libc++", | 82 "-stdlib=libc++", |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 "-isystem", | 107 "-isystem", |
| 61 rebase_path("//third_party/llvm-build/Release+Asserts/include/c++/v1", | 108 rebase_path("//third_party/llvm-build/Release+Asserts/include/c++/v1", |
| 62 root_build_dir), | 109 root_build_dir), |
| 63 ] | 110 ] |
| 64 | 111 |
| 65 cflags_cc = common_cc_flags | 112 cflags_cc = common_cc_flags |
| 66 cflags_objcc = common_cc_flags | 113 cflags_objcc = common_cc_flags |
| 67 } | 114 } |
| 68 } | 115 } |
| 69 | 116 |
| 117 config("ios_executable_flags") { |
| 118 } |
| 119 |
| 70 config("ios_dynamic_flags") { | 120 config("ios_dynamic_flags") { |
| 71 ldflags = [ "-Wl,-ObjC" ] # Always load Objective-C categories and class. | 121 ldflags = [ "-Wl,-ObjC" ] # Always load Objective-C categories and class. |
| 72 } | 122 } |
| 73 | 123 |
| 74 config("xctest_config") { | 124 config("xctest_config") { |
| 75 common_flags = [ | 125 common_flags = [ |
| 76 "-F", | 126 "-F", |
| 77 "$ios_sdk_platform_path/Developer/Library/Frameworks", | 127 "$ios_sdk_platform_path/Developer/Library/Frameworks", |
| 78 ] | 128 ] |
| 79 | 129 |
| 80 cflags = common_flags | 130 cflags = common_flags |
| 81 ldflags = common_flags | 131 ldflags = common_flags |
| 82 | 132 |
| 83 libs = [ | 133 libs = [ |
| 84 "Foundation.framework", | 134 "Foundation.framework", |
| 85 "XCTest.framework", | 135 "XCTest.framework", |
| 86 ] | 136 ] |
| 87 } | 137 } |
| 88 | 138 |
| 89 group("xctest") { | 139 group("xctest") { |
| 90 public_configs = [ ":xctest_config" ] | 140 public_configs = [ ":xctest_config" ] |
| 91 } | 141 } |
| OLD | NEW |