forked from youtube/cobalt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.gn
314 lines (274 loc) · 9.92 KB
/
BUILD.gn
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# Copyright 2021 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//starboard/build/config/os_definitions.gni")
import("//starboard/build/config/starboard_target_type.gni")
import("//starboard/contrib/cast/cast.gni")
if (!is_cobalt) {
group("gn_all") {
testonly = true
deps = [
":default",
"//starboard/client_porting/icu_init",
]
if (enable_test_targets) {
if (sb_is_evergreen_compatible &&
current_toolchain == starboard_toolchain) {
deps += [ "//starboard/nplb/nplb_evergreen_compat_tests" ]
}
deps += [
"//starboard/client_porting/eztime:eztime_test",
"//starboard/examples/glclear:starboard_glclear_example",
"//starboard/examples/hello_world:starboard_hello_world_example",
"//starboard/examples/window:starboard_window_example",
"//starboard/extension:extension_test",
"//starboard/nplb",
]
}
if (has_platform_targets) {
deps += [ "//$starboard_path/platform_targets" ]
}
if (platform_tests_path == "") {
deps += [
":starboard_platform_tests($starboard_toolchain)",
":starboard_platform_tests_install($starboard_toolchain)",
]
} else {
deps += [ platform_tests_path ]
}
if (sb_filter_based_player) {
deps += [
"//starboard/shared/starboard/player/filter/testing:player_filter_tests($starboard_toolchain)",
"//starboard/shared/starboard/player/filter/testing:player_filter_tests_install($starboard_toolchain)",
"//starboard/shared/starboard/player/filter/tools:audio_dmp_player($starboard_toolchain)",
]
}
if (sb_enable_benchmark) {
deps += [ "//starboard/benchmark" ]
}
if (build_with_separate_cobalt_toolchain && use_contrib_cast) {
deps += [ "//starboard/contrib/cast/cast_starboard_api/samples:cast" ]
}
if (!sb_is_evergreen) {
if (sb_is_evergreen_compatible && enable_evergreen_code) {
deps += [
"//starboard/elf_loader:elf_loader_test_install($starboard_toolchain)",
"//starboard/loader_app:installation_manager_test_install($starboard_toolchain)",
"//starboard/loader_app:reset_evergreen_update_test_install($starboard_toolchain)",
]
if (current_toolchain == starboard_toolchain) {
deps += [ "//third_party/lz4_lib:lz4" ]
deps += [ "//third_party/crashpad/crashpad/client" ]
data_deps = [
"//starboard/loader_app($starboard_toolchain)",
"//third_party/crashpad/crashpad/handler:crashpad_handler(//$starboard_path/toolchain:native_target)",
"//third_party/crashpad/crashpad/tools:crashpad_database_util(//$starboard_path/toolchain:native_target)",
]
}
}
} else { # !sb_is_evergreen
deps += [
"//starboard/loader_app:app_key_files_test",
"//starboard/loader_app:app_key_test",
"//starboard/loader_app:drain_file_test",
"//starboard/loader_app:slot_management_test",
]
}
}
group("default") {
deps = [
":starboard_group",
"//starboard/tools:build_app_launcher_zip",
]
}
group("starboard_group") {
deps = []
public_deps = [
":starboard_headers_only",
"//starboard/client_porting/eztime",
]
if (sb_is_modular && current_toolchain == cobalt_toolchain) {
public_deps += [
"//third_party/llvm-project/compiler-rt:compiler_rt",
"//third_party/llvm-project/libcxx:cxx",
"//third_party/llvm-project/libcxxabi:cxxabi",
"//third_party/musl:c",
]
if (!sb_is_evergreen) {
# For modular builds, we need to wrap any POSIX APIs that may not be ABI
# equivalent across the Cobalt toolchain and the platform toolchain. For
# non-Evergreen builds, this is done via the below wrapper implementations
# of the API functions, which will simply call a renamed version of the
# function that will be implemented in the Starboard shared library. The
# same behavior is achieved in Evergreen via exported_symbols.cc remapping
# the functions to the same renamed version. In both cases, implementation
# of these renamed functions will handle translating data types across the
# ABI boundary and be compiled into the Starboard shared library in
# //starboard/build/config/starboard_target_type.gni.
deps += [ "//starboard/shared/modular:cobalt_layer_posix_abi_wrappers" ]
}
if (sb_is_evergreen) {
public_deps += [ "//starboard/elf_loader:sabi_string" ]
} else {
data_deps = [ ":starboard($starboard_toolchain)" ]
}
# TODO: b/295702296 Fix libunwind for modular builds.
if (sb_is_evergreen) {
public_deps += [ "//third_party/llvm-project/libunwind:unwind" ]
}
} else {
public_deps += [
":starboard($starboard_toolchain)",
"//starboard/common",
]
if (enable_evergreen_code) {
if (!sb_is_modular || sb_is_evergreen) {
if (sb_is_evergreen_compatible &&
current_toolchain == starboard_toolchain) {
public_deps += [ "//starboard/crashpad_wrapper" ]
} else {
public_deps += [ "//starboard/crashpad_wrapper:wrapper_stub" ]
}
}
}
if (final_executable_type == "shared_library" &&
current_toolchain != default_toolchain) {
set_defaults("executable") {
sources = [ "//starboard/shared/starboard/shared_main_adapter.cc" ]
}
}
}
}
} else {
group("starboard_group") {
deps = [ "//starboard($starboard_toolchain)" ]
}
}
source_set("starboard_headers_only") {
# We include starboard/common/log.h in starboard_headers, but some common
# files include starboard headers.
check_includes = false
sources = [
"atomic.h",
"audio_sink.h",
"configuration.h",
"configuration_constants.h",
"cpu_features.h",
"decode_target.h",
"directory.h",
"drm.h",
"egl.h",
"event.h",
"export.h",
"file.h",
"gles.h",
"input.h",
"key.h",
"log.h",
"media.h",
"memory.h",
"microphone.h",
"player.h",
"queue.h",
"socket.h",
"socket_waiter.h",
"storage.h",
"system.h",
"thread.h",
"time_zone.h",
"types.h",
"window.h",
]
if (is_internal_build) {
public_deps = [ "//internal/starboard/private:private_starboard_headers" ]
}
all_dependent_configs = [
"//starboard/build/config:starboard",
"//starboard/build/config/sabi",
":hacky_wnos",
"//base/third_party/symbolize:symbolize_config",
]
}
# TODO: b/374302273 - Fix starboard implementation to not emit these compiler warnings.
config("hacky_wnos") {
cflags = [
"-Wno-undefined-internal",
# Disable errors for the warning till the Android NDK r19 is fixed.
# The warning is trigger when compiling .c files and complains for
# "-stdlib=libc++" which is added by the NDK.
"-Wno-error=unused-command-line-argument",
# Don"t warn about register variables (in base and net)
"-Wno-deprecated-register",
# Don"t warn about deprecated ICU methods (in googleurl and net)
"-Wno-deprecated-declarations",
# Skia doesn"t use overrides.
"-Wno-inconsistent-missing-override",
# shifting a negative signed value is undefined
"-Wno-shift-negative-value",
# Don"t warn for implicit sign conversions. (in v8 and protobuf)
"-Wno-sign-conversion",
# TODO: b/287129945 - Fix compiler warnings
"-Wno-implicit-const-int-float-conversion",
# TODO: b/287320271 - Fix compiler warnings
"-Wno-deprecated-copy",
# TODO: b/287324882 - Fix compiler warnings
"-Wno-unused-but-set-variable",
"-Wno-unused-private-field",
"-Wno-implicit-fallthrough",
"-Wno-c++98-compat-extra-semi",
"-Wno-unused-variable",
"-Wno-reorder-ctor",
"-Wno-sign-compare",
"-Wno-unused-but-set-variable",
"-Wno-unreachable-code-return",
"-Wno-unused-function",
"-Wno-missing-braces",
"-Wno-mismatched-tags",
"-Wno-return-type",
# ./../starboard/shared/modular/starboard_layer_posix_socket_abi_wrappers.cc:237:28:
# error: comparison of array 'ai_copy.ai_addr->sa_data' not equal
# to a null pointer is always true [-Werror,-Wtautological-pointer-compare]
"-Wno-tautological-pointer-compare",
#../../starboard/shared/ffmpeg/ffmpeg_video_decoder_impl.cc:512:3: error:
# ignoring return value of function declared with
# 'warn_unused_result' attribute [-Werror,-Wunused-result]
"-Wno-unused-result",
"-Wno-shadow",
"-Wno-unknown-warning-option",
"-Wno-user-defined-warnings",
]
}
if (current_toolchain == starboard_toolchain) {
# This is the default 'starboard_platform_target'; use default properties
starboard_platform_target("starboard") {
}
if (platform_tests_path == "") {
# If 'starboard_platform_tests' is not defined by the platform, then an
# empty 'starboard_platform_tests' target is defined.
target(starboard_level_gtest_target_type, "starboard_platform_tests") {
testonly = true
sources = [ "//starboard/common/test_main.cc" ]
public_deps = [
":starboard_with_main",
"//testing/gmock",
"//testing/gtest",
]
}
}
group("starboard_with_main") {
public_deps = [ ":starboard_group" ]
if (sb_is_modular && !sb_is_evergreen) {
public_deps += [ "//$starboard_path:starboard_platform_with_main" ]
}
}
}