1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/ios/ios_sdk.gni")
import("//build/config/sysroot.gni")
import("//build/toolchain/toolchain.gni")
declare_args() {
# Enabling this option makes clang compile to an intermediate
# representation ("bitcode"), and not to native code. This is preferred
# when including WebRTC in the apps that will be sent to Apple's App Store
# and mandatory for the apps that run on watchOS or tvOS.
# The option only works when building with Xcode (use_xcode_clang = true).
# Mimicking how Xcode handles it, the production builds (is_debug = false)
# get real bitcode sections added, while the debug builds (is_debug = true)
# only get bitcode-section "markers" added in them.
# NOTE: This option is ignored when building versions for the iOS simulator,
# where a part of libvpx is compiled from the assembly code written using
# Intel assembly syntax; Yasm / Nasm do not support emitting bitcode parts.
# That is not a limitation for now as Xcode mandates the presence of bitcode
# only when building bitcode-enabled projects for real devices (ARM CPUs).
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
# :runtime_library vs. :compiler.
config("runtime_library") {
common_flags = [
"-isysroot",
sysroot,
"-stdlib=libc++",
]
if (use_ios_simulator) {
common_flags += [ "-mios-simulator-version-min=$ios_deployment_target" ]
} else {
common_flags += [ "-miphoneos-version-min=$ios_deployment_target" ]
}
if (use_xcode_clang && enable_ios_bitcode && !use_ios_simulator) {
if (is_debug) {
common_flags += [ "-fembed-bitcode-marker" ]
} else {
common_flags += [ "-fembed-bitcode" ]
}
}
asmflags = common_flags
cflags = common_flags
ldflags = common_flags
# TODO(crbug.com/634373): Remove once Xcode's libc++ has LLVM r256325. Most
# likely this means one Xcode 8 is released and required.
if (use_xcode_clang && get_path_info(ios_sdk_version, "name") != "10") {
common_cc_flags = [
"-isystem",
rebase_path("//third_party/llvm-build/Release+Asserts/include/c++/v1",
root_build_dir),
]
cflags_cc = common_cc_flags
cflags_objcc = common_cc_flags
}
if (ios_enable_coverage) {
configs = [ ":enable_coverage" ]
}
}
config("ios_executable_flags") {
}
config("ios_dynamic_flags") {
ldflags = [ "-Wl,-ObjC" ] # Always load Objective-C categories and class.
}
config("xctest_config") {
common_flags = [
"-F",
"$ios_sdk_platform_path/Developer/Library/Frameworks",
]
cflags = common_flags
ldflags = common_flags
libs = [
"Foundation.framework",
"XCTest.framework",
]
}
# This enables support for LLVM code coverage. See
# http://llvm.org/docs/CoverageMappingFormat.html.
config("enable_coverage") {
cflags = [
"-fprofile-instr-generate",
"-fcoverage-mapping",
]
ldflags = [ "-fprofile-instr-generate" ]
}
group("xctest") {
public_configs = [ ":xctest_config" ]
}
|