blob: 4cd92fb2d6a7fcea9f89e961e3122564dd55bddf [file] [log] [blame]
# 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")
group("gn_all") {
testonly = true
deps = [
":default",
"//starboard/client_porting/cwrappers:cwrappers_test",
"//starboard/client_porting/eztime",
"//starboard/client_porting/eztime:eztime_test",
"//starboard/client_porting/icu_init",
"//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 (sb_is_evergreen_compatible && current_toolchain == starboard_toolchain) {
deps += [ "//starboard/nplb/nplb_evergreen_compat_tests" ]
}
if (has_platform_targets) {
deps += [ "//$starboard_path/platform_targets" ]
}
if (platform_tests_path == "") {
deps += [ ":starboard_platform_tests($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)",
]
# TODO: b/296715826 - Fix build error for windows modular builds.
if (!(sb_is_modular && is_host_win)) {
deps += [ "//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) {
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/crashpad/client",
"//third_party/lz4_lib:lz4",
]
data_deps = [
"//starboard/loader_app($starboard_toolchain)",
"//third_party/crashpad/handler:crashpad_handler(//$starboard_path/toolchain:native_target)",
"//third_party/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/cwrappers",
"//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 || is_host_win) {
public_deps += [ "//third_party/llvm-project/libunwind:unwind" ]
}
} else {
public_deps += [
":starboard_static($starboard_toolchain)",
"//starboard/common",
]
if (!sb_is_modular || sb_is_evergreen) {
if (sb_is_evergreen_compatible &&
current_toolchain == starboard_toolchain) {
public_deps += [ "//third_party/crashpad/wrapper" ]
} else {
public_deps += [ "//third_party/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" ]
}
}
}
}
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",
"byte_swap.h",
"condition_variable.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",
"mutex.h",
"once.h",
"player.h",
"queue.h",
"socket.h",
"socket_waiter.h",
"storage.h",
"string.h",
"system.h",
"thread.h",
"time.h",
"time_zone.h",
"types.h",
"user.h",
"window.h",
]
if (is_internal_build) {
public_deps = [ "//internal/starboard/private:private_starboard_headers" ]
}
}
if (current_toolchain == starboard_toolchain) {
# This is the default 'starboard_platform_target'; use default properties
starboard_platform_target("starboard") {
}
starboard_platform_target("starboard_static") {
target_type = "group"
}
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" ]
}
}
}