mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
273 lines
5.7 KiB
Plaintext
273 lines
5.7 KiB
Plaintext
# 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_root/common/config.gni")
|
|
import("$flutter_root/shell/gpu/gpu.gni")
|
|
import("$flutter_root/shell/platform/embedder/embedder.gni")
|
|
import("$flutter_root/testing/testing.gni")
|
|
|
|
shell_gpu_configuration("embedder_gpu_configuration") {
|
|
enable_software = true
|
|
enable_vulkan = false
|
|
enable_gl = true
|
|
}
|
|
|
|
source_set("embedder") {
|
|
sources = [
|
|
"embedder.cc",
|
|
"embedder.h",
|
|
"embedder_engine.cc",
|
|
"embedder_engine.h",
|
|
"embedder_external_texture_gl.cc",
|
|
"embedder_external_texture_gl.h",
|
|
"embedder_include.c",
|
|
"embedder_surface.cc",
|
|
"embedder_surface.h",
|
|
"embedder_surface_gl.cc",
|
|
"embedder_surface_gl.h",
|
|
"embedder_surface_software.cc",
|
|
"embedder_surface_software.h",
|
|
"platform_view_embedder.cc",
|
|
"platform_view_embedder.h",
|
|
"vsync_waiter_embedder.cc",
|
|
"vsync_waiter_embedder.h",
|
|
]
|
|
|
|
deps = [
|
|
":embedder_gpu_configuration",
|
|
"$flutter_root/assets",
|
|
"$flutter_root/common",
|
|
"$flutter_root/flow",
|
|
"$flutter_root/fml",
|
|
"$flutter_root/shell/common",
|
|
"//third_party/dart/runtime/bin:dart_io_api",
|
|
"//third_party/skia",
|
|
"//third_party/tonic",
|
|
]
|
|
|
|
if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
|
|
deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
|
|
} else {
|
|
deps += [
|
|
"$flutter_root/lib/snapshot",
|
|
"//third_party/dart/runtime:libdart_jit",
|
|
]
|
|
}
|
|
|
|
public_configs = [ "$flutter_root:config" ]
|
|
}
|
|
|
|
test_fixtures("fixtures") {
|
|
fixtures = [ "fixtures/simple_main.dart" ]
|
|
}
|
|
|
|
executable("embedder_unittests") {
|
|
testonly = true
|
|
|
|
include_dirs = [ "." ]
|
|
|
|
sources = [
|
|
"tests/embedder_unittests.cc",
|
|
]
|
|
|
|
deps = [
|
|
":embedder",
|
|
":fixtures",
|
|
"$flutter_root/testing",
|
|
]
|
|
|
|
if (is_linux) {
|
|
ldflags = [ "-rdynamic" ]
|
|
}
|
|
}
|
|
|
|
test_fixtures("fixtures_a11y") {
|
|
fixtures = [ "fixtures/a11y_main.dart" ]
|
|
}
|
|
|
|
executable("embedder_a11y_unittests") {
|
|
testonly = true
|
|
|
|
include_dirs = [ "." ]
|
|
|
|
sources = [
|
|
"tests/embedder_a11y_unittests.cc",
|
|
]
|
|
|
|
deps = [
|
|
":embedder",
|
|
":fixtures_a11y",
|
|
"$flutter_root/lib/ui:ui",
|
|
"$flutter_root/shell/common",
|
|
"$flutter_root/testing",
|
|
"//third_party/skia",
|
|
"//third_party/tonic",
|
|
]
|
|
|
|
if (is_linux) {
|
|
ldflags = [ "-rdynamic" ]
|
|
}
|
|
}
|
|
|
|
shared_library("flutter_engine_library") {
|
|
visibility = [ ":*" ]
|
|
|
|
output_name = "flutter_engine"
|
|
|
|
deps = [
|
|
":embedder",
|
|
]
|
|
|
|
public_configs = [ "$flutter_root:config" ]
|
|
}
|
|
|
|
copy("copy_headers") {
|
|
visibility = [ ":*" ]
|
|
sources = [
|
|
"embedder.h",
|
|
]
|
|
outputs = [
|
|
"$root_out_dir/flutter_embedder.h",
|
|
]
|
|
}
|
|
|
|
if (is_mac && !embedder_for_target) {
|
|
_flutter_embedder_framework_dir = "$root_out_dir/FlutterEmbedder.framework"
|
|
|
|
copy("copy_dylib") {
|
|
visibility = [ ":*" ]
|
|
sources = [
|
|
"$root_out_dir/libflutter_engine.dylib",
|
|
]
|
|
outputs = [
|
|
"$_flutter_embedder_framework_dir/Versions/A/FlutterEmbedder",
|
|
]
|
|
deps = [
|
|
":flutter_engine_library",
|
|
]
|
|
}
|
|
|
|
copy("copy_framework_headers") {
|
|
visibility = [ ":*" ]
|
|
sources = [
|
|
"embedder.h",
|
|
]
|
|
outputs = [
|
|
"$_flutter_embedder_framework_dir/Versions/A/Headers/FlutterEmbedder.h",
|
|
]
|
|
}
|
|
|
|
copy("copy_icu") {
|
|
visibility = [ ":*" ]
|
|
sources = [
|
|
"//third_party/icu/flutter/icudtl.dat",
|
|
]
|
|
outputs = [
|
|
"$_flutter_embedder_framework_dir/Versions/A/Resources/icudtl.dat",
|
|
]
|
|
}
|
|
|
|
copy("copy_info_plist") {
|
|
visibility = [ ":*" ]
|
|
sources = [
|
|
"assets/EmbedderInfo.plist",
|
|
]
|
|
outputs = [
|
|
"$_flutter_embedder_framework_dir/Versions/A/Resources/Info.plist",
|
|
]
|
|
}
|
|
|
|
copy("copy_module_map") {
|
|
visibility = [ ":*" ]
|
|
sources = [
|
|
"assets/embedder.modulemap",
|
|
]
|
|
outputs = [
|
|
"$_flutter_embedder_framework_dir/Versions/A/Modules/module.modulemap",
|
|
]
|
|
}
|
|
|
|
action("install_dylib") {
|
|
visibility = [ ":*" ]
|
|
stamp_file = "$root_build_dir/flutter_embedder_install_name_stamp"
|
|
script = "$flutter_root/sky/tools/change_install_name.py"
|
|
|
|
inputs = [
|
|
"$_flutter_embedder_framework_dir/Versions/A/FlutterEmbedder",
|
|
]
|
|
|
|
outputs = [
|
|
stamp_file,
|
|
]
|
|
|
|
args = [
|
|
"--dylib",
|
|
"FlutterEmbedder.framework/Versions/A/FlutterEmbedder",
|
|
"--install_name",
|
|
"@rpath/FlutterEmbedder.framework/Versions/A/FlutterEmbedder",
|
|
"--stamp",
|
|
rebase_path(stamp_file),
|
|
]
|
|
|
|
deps = [
|
|
":copy_dylib",
|
|
]
|
|
}
|
|
|
|
action("generate_symlinks") {
|
|
visibility = [ ":*" ]
|
|
script = "//build/config/mac/package_framework.py"
|
|
outputs = [
|
|
"$root_build_dir/FlutterEmbedder.stamp",
|
|
]
|
|
args = [
|
|
"--framework",
|
|
"FlutterEmbedder.framework",
|
|
"--version",
|
|
"A",
|
|
"--contents",
|
|
"FlutterEmbedder",
|
|
"Resources",
|
|
"Headers",
|
|
"Modules",
|
|
"--stamp",
|
|
"FlutterEmbedder.stamp",
|
|
]
|
|
deps = [
|
|
":copy_framework_headers",
|
|
":copy_icu",
|
|
":copy_info_plist",
|
|
":copy_module_map",
|
|
":install_dylib",
|
|
]
|
|
}
|
|
|
|
group("flutter_embedder_framework") {
|
|
visibility = [ ":*" ]
|
|
deps = [
|
|
":generate_symlinks",
|
|
]
|
|
}
|
|
}
|
|
|
|
group("flutter_engine") {
|
|
deps = []
|
|
|
|
build_embedder_api =
|
|
current_toolchain == host_toolchain || embedder_for_target
|
|
|
|
if (build_embedder_api) {
|
|
# All platforms require the embedder dylib and headers.
|
|
deps += [
|
|
":copy_headers",
|
|
":flutter_engine_library",
|
|
]
|
|
|
|
# For the Mac, the dylib is packaged in a framework with the appropriate headers.
|
|
if (is_mac && !embedder_for_target) {
|
|
deps += [ ":flutter_embedder_framework" ]
|
|
}
|
|
}
|
|
}
|