blob: e9e5965dffda0f62b8bba11b28d94239ae7e4823 [file] [log] [blame]
# Copyright 2013 The Flutter 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("//flutter/common/config.gni")
import("//flutter/shell/gpu/gpu.gni")
import("//flutter/testing/testing.gni")
import("//flutter/vulkan/config.gni")
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
import("//flutter/tools/fuchsia/fuchsia_archive.gni")
}
config("vulkan_config") {
if (is_fuchsia) {
include_dirs = [ "$fuchsia_sdk_root/vulkan/include" ]
} else {
include_dirs = [ "//third_party/vulkan/src" ]
}
if (is_fuchsia) {
defines = [ "VK_USE_PLATFORM_FUCHSIA=1" ]
}
}
# Template to generate a dart embedder resource.cc file.
# Required invoker inputs:
# String output (name of output file)
# List inputs (list of input files to be included)
# String table_name (name of symbol for resource table)
# String root_prefix (base directory of resources)
# Optional invoker inputs:
# String input_directory (directory of resources that are recursively added)
# List deps
# List datadeps
template("dart_embedder_resources") {
action(target_name) {
script = "//third_party/dart/runtime/tools/create_resources.py"
deps = []
if (defined(invoker.deps)) {
deps += invoker.deps
}
datadeps = []
if (defined(invoker.datadeps)) {
datadeps = invoker.datadeps
}
output = invoker.output
outputs = [
output,
]
inputs = [ script ] + invoker.inputs
root_prefix = rebase_path(invoker.root_prefix)
args = [
"--output",
rebase_path(output),
"--outer_namespace",
"flutter",
"--inner_namespace",
"runtime",
"--table_name",
invoker.table_name,
"--root_prefix",
root_prefix,
]
if (defined(invoker.input_directory)) {
args += [
"--client_root",
rebase_path(invoker.input_directory),
]
}
args += rebase_path(invoker.inputs)
}
}
source_set("common") {
sources = [
"animator.cc",
"animator.h",
"canvas_spy.cc",
"canvas_spy.h",
"engine.cc",
"engine.h",
"isolate_configuration.cc",
"isolate_configuration.h",
"persistent_cache.cc",
"persistent_cache.h",
"pipeline.cc",
"pipeline.h",
"platform_view.cc",
"platform_view.h",
"pointer_data_dispatcher.cc",
"pointer_data_dispatcher.h",
"rasterizer.cc",
"rasterizer.h",
"renderer_context_manager.cc",
"renderer_context_manager.h",
"run_configuration.cc",
"run_configuration.h",
"shell.cc",
"shell.h",
"shell_io_manager.cc",
"shell_io_manager.h",
"skia_event_tracer_impl.cc",
"skia_event_tracer_impl.h",
"surface.cc",
"surface.h",
"switches.cc",
"switches.h",
"thread_host.cc",
"thread_host.h",
"vsync_waiter.cc",
"vsync_waiter.h",
"vsync_waiter_fallback.cc",
"vsync_waiter_fallback.h",
]
deps = [
"//flutter/assets",
"//flutter/common",
"//flutter/flow",
"//flutter/fml",
"//flutter/lib/ui",
"//flutter/runtime",
"//flutter/shell/profiling",
"//third_party/dart/runtime:dart_api",
"//third_party/skia",
]
public_deps = [
"//flutter/shell/version",
"//flutter/third_party/tonic",
"//flutter/third_party/txt",
"//third_party/rapidjson",
]
public_configs = [ "//flutter:config" ]
}
template("shell_host_executable") {
executable(target_name) {
testonly = true
deps = []
ldflags = []
forward_variables_from(invoker, "*")
deps += [
":common",
"//flutter/fml",
"//flutter/lib/snapshot",
"//flutter/runtime",
"//flutter/runtime:libdart",
"//flutter/third_party/tonic",
"//third_party/skia",
]
public_configs = [ "//flutter:export_dynamic_symbols" ]
}
}
if (enable_unittests) {
declare_args() {
test_enable_vulkan = is_fuchsia
test_enable_gl = !is_fuchsia
test_enable_software = true
test_enable_metal = false
}
shell_gpu_configuration("shell_unittests_gpu_configuration") {
enable_software = test_enable_software
enable_vulkan = test_enable_vulkan
enable_gl = test_enable_gl
enable_metal = test_enable_metal
}
test_fixtures("shell_unittests_fixtures") {
dart_main = "fixtures/shell_test.dart"
fixtures = [ "fixtures/shelltest_screenshot.png" ]
}
shell_host_executable("shell_unittests") {
sources = [
"animator_unittests.cc",
"canvas_spy_unittests.cc",
"input_events_unittests.cc",
"persistent_cache_unittests.cc",
"pipeline_unittests.cc",
"renderer_context_manager_unittests.cc",
"renderer_context_test.cc",
"renderer_context_test.h",
"shell_test.cc",
"shell_test.h",
"shell_test_external_view_embedder.cc",
"shell_test_external_view_embedder.h",
"shell_test_platform_view.cc",
"shell_test_platform_view.h",
"shell_unittests.cc",
"vsync_waiters_test.cc",
"vsync_waiters_test.h",
]
deps = [
":shell_unittests_fixtures",
":shell_unittests_gpu_configuration",
"//flutter/assets",
"//flutter/common",
"//flutter/flow",
"//flutter/fml/dart",
"//flutter/lib/ui:ui",
"//flutter/shell",
"//flutter/testing",
"//flutter/testing:dart",
]
if (!defined(defines)) {
defines = []
}
# SwiftShader only supports x86/x64_64
if (target_cpu == "x86" || target_cpu == "x64") {
if (test_enable_gl) {
sources += [
"shell_test_platform_view_gl.cc",
"shell_test_platform_view_gl.h",
]
deps += [ "//flutter/testing:opengl" ]
defines += [ "SHELL_ENABLE_GL" ]
}
if (test_enable_vulkan) {
sources += [
"shell_test_platform_view_vulkan.cc",
"shell_test_platform_view_vulkan.h",
]
deps += [
"//flutter/testing:vulkan",
"//flutter/vulkan",
]
defines += [ "SHELL_ENABLE_VULKAN" ]
}
}
}
if (is_fuchsia) {
fuchsia_test_archive("shell_tests") {
deps = [
":shell_unittests",
":shell_unittests_fixtures",
]
binary = "shell_unittests"
# TODO(gw280): https://github.com/flutter/flutter/issues/50294
# Right now we need to manually specify all the fixtures that are
# declared in the test_fixtures() call above.
resources = [
{
path = "$target_gen_dir/assets/kernel_blob.bin"
dest = "assets/kernel_blob.bin"
},
{
path = "$target_gen_dir/assets/shelltest_screenshot.png"
dest = "assets/shelltest_screenshot.png"
},
]
if (test_enable_vulkan) {
libraries = vulkan_validation_libs
resources += vulkan_icds
}
}
}
shell_host_executable("shell_benchmarks") {
sources = [
"shell_benchmarks.cc",
]
deps = [
":shell_unittests_fixtures",
"//flutter/benchmarking",
"//flutter/testing:dart",
"//flutter/testing:testing_lib",
]
}
}