blob: fd952772db90a00ef4eb0171230e0fba14dcc71f [file] [log] [blame]
# Copyright 2015 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/ui.gni")
import("//mojo/dart/embedder/embedder.gni")
dart_embedder_resources("generate_sky_embedder_diagnostic_server_resources_cc") {
inputs = [
"//sky/shell/diagnostic/diagnostic_server.dart"
]
root_prefix = "//sky/shell/diagnostic/"
output = "$target_gen_dir/sky_embedder_diagnostic_server_resources.cc"
table_name = "sky_embedder_diagnostic_server"
}
source_set("common") {
sources = [
"$target_gen_dir/sky_embedder_diagnostic_server_resources.cc",
"diagnostic/diagnostic_server.cc",
"diagnostic/diagnostic_server.h",
"gpu/picture_serializer.cc",
"gpu/picture_serializer.h",
"platform_view.cc",
"platform_view.h",
"platform_view_service_protocol.cc",
"platform_view_service_protocol.h",
"rasterizer.cc",
"rasterizer.h",
"shell.cc",
"shell.h",
"switches.cc",
"switches.h",
"tracing_controller.cc",
"tracing_controller.h",
"ui/animator.cc",
"ui/animator.h",
"ui/engine.cc",
"ui/engine.h",
"ui/flutter_font_selector.cc",
"ui/flutter_font_selector.h",
"ui/platform_impl.cc",
"ui/platform_impl.h",
"ui_delegate.cc",
"ui_delegate.h",
]
public_deps = [
":generate_sky_embedder_diagnostic_server_resources_cc",
"//base:i18n",
"//base",
"//build/config/sanitizers:deps",
"//dart/runtime:libdart",
"//flow",
"//flutter/assets",
"//flutter/lib/ui",
"//flutter/tonic",
"//glue",
"//lib/ftl",
"//lib/tonic",
"//mojo/common",
"//mojo/data_pipe_utils",
"//mojo/message_pump",
"//mojo/public/cpp/application",
"//mojo/public/cpp/bindings:utility",
"//mojo/public/interfaces/application",
"//mojo/services/asset_bundle/interfaces",
"//mojo/services/gfx/composition/interfaces",
"//mojo/services/navigation/interfaces",
"//mojo/services/vsync/interfaces",
"//skia",
"//sky/engine",
"//sky/engine/bindings",
"//sky/engine/core:core",
"//sky/engine/wtf",
"//sky/services/editing:interfaces",
"//sky/services/engine:interfaces",
"//sky/services/platform",
"//sky/services/pointer:interfaces",
"//sky/services/rasterizer:interfaces",
"//sky/services/semantics:interfaces",
]
}
source_set("gpu_direct") {
sources = [
"gpu/direct/ganesh_canvas.cc",
"gpu/direct/ganesh_canvas.h",
"gpu/direct/rasterizer_direct.cc",
"gpu/direct/rasterizer_direct.h",
]
deps = [
":common",
]
}
source_set("gpu_mojo") {
sources = [
"gpu/mojo/gl_texture_recycler.cc",
"gpu/mojo/gl_texture_recycler.h",
"gpu/mojo/rasterizer_mojo.cc",
"gpu/mojo/rasterizer_mojo.h",
]
deps = [
"//mojo/gpu",
"//mojo/public/c/gpu",
"//mojo/skia",
":common",
]
}
if (is_linux || is_mac) {
source_set("testing") {
sources = [
"testing/platform_view_test.cc",
"testing/platform_view_test.h",
"testing/test_runner.cc",
"testing/test_runner.h",
"testing/testing.cc",
"testing/testing.h",
]
deps = [
":common",
]
}
}
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
generate_jni("jni_headers") {
sources = [
"platform/android/io/flutter/view/FlutterView.java",
"platform/android/io/flutter/view/FlutterMain.java",
]
jni_package = "sky/shell"
}
shared_library("sky_shell") {
sources = [
"platform/android/flutter_main.cc",
"platform/android/flutter_main.h",
"platform/android/library_loader.cc",
"platform/android/platform_view_android.cc",
"platform/android/platform_view_android.h",
]
deps = [
":common",
":gpu_direct",
":jni_headers",
"//flutter/lib/jni",
"//mojo/android:libsystem_java",
"//mojo/edk/base_edk",
"//mojo/edk/system",
]
ldflags = [
"-landroid",
"-lEGL",
"-lGLESv2",
]
}
android_library("java") {
java_files = [
"platform/android/io/flutter/view/AccessibilityBridge.java",
"platform/android/io/flutter/view/FlutterMain.java",
"platform/android/io/flutter/view/FlutterView.java",
"platform/android/io/flutter/view/ResourceCleaner.java",
"platform/android/io/flutter/view/ResourceExtractor.java",
"platform/android/io/flutter/view/ServiceFactory.java",
"platform/android/io/flutter/view/ServiceProviderImpl.java",
"platform/android/io/flutter/view/ServiceRegistry.java",
"platform/android/org/domokit/sky/shell/SkyActivity.java",
"platform/android/org/domokit/sky/shell/SkyApplication.java",
]
deps = [
"//base:base_java",
"//mojo/android:system_java",
"//mojo/public/interfaces/application:application_java",
"//mojo/public/java:bindings",
"//mojo/public/java:system",
"//mojo/services/network/interfaces:interfaces_java",
"//mojo/services/sensors/interfaces:interfaces_java",
"//mojo/services/vsync/interfaces:interfaces_java",
"//services/sensors:sensors_lib",
"//sky/services/activity:activity_lib",
"//sky/services/activity:interfaces_java",
"//sky/services/common:common_lib",
"//sky/services/editing:editing_lib",
"//sky/services/editing:interfaces_java",
"//sky/services/engine:interfaces_java",
"//sky/services/media:interfaces_java",
"//sky/services/media:media_lib",
"//sky/services/oknet",
"//sky/services/platform:interfaces_java",
"//sky/services/platform:platform_lib",
"//sky/services/pointer:interfaces_java",
"//sky/services/raw_keyboard:interfaces_java",
"//sky/services/raw_keyboard:raw_keyboard_lib",
"//sky/services/semantics:interfaces_java",
"//sky/services/vsync:vsync_lib",
]
}
copy_ex("assets") {
clear_dir = true
dest = "$root_build_dir/sky_shell/assets"
sources = [
"$root_build_dir/icudtl.dat",
]
deps = [
"//third_party/icu:icudata",
]
}
android_apk("shell") {
apk_name = "SkyShell"
android_manifest = "platform/android/AndroidManifest.xml"
native_libs = [ "libsky_shell.so" ]
asset_location = "$root_build_dir/sky_shell/assets"
extensions_to_not_compress = ".flx"
flutter_dist_jar = "$root_build_dir/flutter.jar"
deps = [
"//base:base_java",
":assets",
":java",
":sky_shell",
]
}
} else if (is_ios) {
import("//build/config/ios/rules.gni")
import("//build/config/ios/ios_sdk.gni")
shared_library("flutter_framework_dylib") {
output_name = "Flutter"
sources = [
"platform/ios/framework/Headers/Flutter.h",
"platform/ios/framework/Headers/FlutterAppDelegate.h",
"platform/ios/framework/Headers/FlutterAsyncMessageListener.h",
"platform/ios/framework/Headers/FlutterDartProject.h",
"platform/ios/framework/Headers/FlutterMacros.h",
"platform/ios/framework/Headers/FlutterMessageListener.h",
"platform/ios/framework/Headers/FlutterViewController.h",
"platform/ios/framework/Source/accessibility_bridge.h",
"platform/ios/framework/Source/accessibility_bridge.mm",
"platform/ios/framework/Source/application_messages_impl.h",
"platform/ios/framework/Source/application_messages_impl.mm",
"platform/ios/framework/Source/flutter_touch_mapper.h",
"platform/ios/framework/Source/flutter_touch_mapper.mm",
"platform/ios/framework/Source/FlutterAppDelegate.mm",
"platform/ios/framework/Source/FlutterDartProject.mm",
"platform/ios/framework/Source/FlutterDartProject_Internal.h",
"platform/ios/framework/Source/FlutterDartSource.h",
"platform/ios/framework/Source/FlutterDartSource.mm",
"platform/ios/framework/Source/FlutterDynamicServiceLoader.h",
"platform/ios/framework/Source/FlutterDynamicServiceLoader.mm",
"platform/ios/framework/Source/FlutterView.h",
"platform/ios/framework/Source/FlutterView.mm",
"platform/ios/framework/Source/FlutterViewController.mm",
"platform/ios/platform_view_ios.h",
"platform/ios/platform_view_ios.mm",
]
set_sources_assignment_filter([])
sources += [
"platform/mac/platform_mac.h",
"platform/mac/platform_mac.mm",
"platform/mac/platform_service_provider.cc",
"platform/mac/platform_service_provider.h",
"platform/mac/view_service_provider.cc",
"platform/mac/view_service_provider.h",
]
set_sources_assignment_filter(sources_assignment_filter)
deps = [
"//mojo/edk/base_edk",
"//mojo/edk/system",
"//skia",
"//sky/services/activity",
"//sky/services/dynamic:embedder",
"//sky/services/editing",
"//sky/services/media",
"//sky/services/ns_net",
"//sky/services/semantics",
"//sky/services/vsync",
":common",
":gpu_direct",
]
defines = [
"FLUTTER_FRAMEWORK"
]
libs = [
"UIKit.framework",
"OpenGLES.framework",
"AVFoundation.framework",
"AudioToolbox.framework",
"QuartzCore.framework",
]
}
group("flutter_framework") {
framework_dir = "$root_out_dir/Flutter.framework"
copy("framework_dylib") {
sources = [ "$root_out_dir/libFlutter.dylib" ]
outputs = [ "$framework_dir/Flutter" ]
deps = [
":flutter_framework_dylib",
]
}
action("framework_install_name") {
stamp_file = "$root_out_dir/flutter_install_name_stamp"
script = "//sky/tools/change_install_name.py"
inputs = [ "$framework_dir/Flutter" ]
outputs = [ stamp_file ]
args = [
"--dylib",
rebase_path("$framework_dir/Flutter"),
"--install_name",
"@rpath/Flutter.framework/Flutter",
"--stamp",
rebase_path(stamp_file),
]
deps = [
":framework_dylib"
]
}
copy("framework_info_plist") {
sources = [ "platform/ios/framework/Info.plist" ]
outputs = [ "$framework_dir/Info.plist" ]
}
copy("framework_module_map") {
sources = [ "platform/ios/framework/module.modulemap" ]
outputs = [ "$framework_dir/Modules/module.modulemap" ]
}
copy("framework_headers") {
sources = [
"platform/ios/framework/Headers/Flutter.h",
"platform/ios/framework/Headers/FlutterAppDelegate.h",
"platform/ios/framework/Headers/FlutterAsyncMessageListener.h",
"platform/ios/framework/Headers/FlutterDartProject.h",
"platform/ios/framework/Headers/FlutterMacros.h",
"platform/ios/framework/Headers/FlutterMessageListener.h",
"platform/ios/framework/Headers/FlutterViewController.h",
]
outputs = [ "$framework_dir/Headers/{{source_file_part}}" ]
}
copy("framework_icu") {
set_sources_assignment_filter([])
sources = [
"//third_party/icu/android/icudtl.dat",
]
set_sources_assignment_filter(sources_assignment_filter)
outputs = [ "$framework_dir/{{source_file_part}}" ]
}
public_deps = [
":framework_dylib",
":framework_headers",
":framework_icu",
":framework_info_plist",
":framework_install_name",
":framework_module_map",
]
}
group("shell") {
}
} else if (is_linux) {
executable("shell") {
output_name = "sky_shell"
sources = [
"platform/linux/main_linux.cc",
]
deps = [
"//mojo/common",
"//mojo/edk/base_edk",
"//mojo/edk/system",
":common",
":gpu_direct",
":testing",
]
ldflags = [
"-lGL",
]
if (use_glfw) {
sources += [
"//sky/shell/platform/glfw/init_glfw.cc",
"//sky/shell/platform/glfw/init_glfw.h",
"//sky/shell/platform/glfw/message_pump_glfw.cc",
"//sky/shell/platform/glfw/message_pump_glfw.h",
"//sky/shell/platform/glfw/platform_view_glfw.cc",
"//sky/shell/platform/glfw/platform_view_glfw.h",
"//sky/shell/platform/glfw/window_impl.cc",
"//sky/shell/platform/glfw/window_impl.h",
]
deps += [
"//sky/services/raw_keyboard:interfaces",
"//third_party/glfw",
"//ui/gl",
]
} else {
sources += [ "platform/linux/platform_view_linux.cc" ]
}
}
} else if (is_mac) {
import("//build/config/mac/rules.gni")
source_set("mac_scaffolding") {
sources = [
"platform/mac/main_mac.mm",
"platform/mac/platform_mac.h",
"platform/mac/platform_mac.mm",
"platform/mac/platform_service_provider.cc",
"platform/mac/platform_service_provider.h",
"platform/mac/platform_view_mac.h",
"platform/mac/platform_view_mac.mm",
"platform/mac/sky_app_delegate.h",
"platform/mac/sky_app_delegate.m",
"platform/mac/sky_application.h",
"platform/mac/sky_application.mm",
"platform/mac/sky_window.h",
"platform/mac/sky_window.mm",
"platform/mac/view_service_provider.cc",
"platform/mac/view_service_provider.h",
]
deps = [
"//mojo/common",
"//mojo/edk/base_edk",
"//mojo/edk/system",
"//sky/services/ns_net",
"//sky/services/vsync",
":common",
":gpu_direct",
":testing",
]
}
executable("shell_standalone") {
output_name = "sky_shell"
deps = [
":mac_scaffolding",
]
}
mac_app("shell_application") {
app_name = "SkyShell"
info_plist = "platform/mac/Info.plist"
xibs = [ "platform/mac/sky_mac.xib" ]
resource_copy_mac("sky_resources") {
resources = [
"//third_party/icu/android/icudtl.dat",
]
bundle_directory = "."
}
deps = [
":mac_scaffolding",
":sky_resources",
]
}
group("shell") {
deps = [
":shell_application",
":shell_standalone",
]
}
} else {
assert(false, "Unsupported platform")
}