BUILD.gn 13.7 KB
Newer Older
1 2 3 4
# 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.

5 6 7 8
import("//mojo/dart/embedder/embedder.gni")

dart_embedder_resources("generate_sky_embedder_diagnostic_server_resources_cc") {
  inputs = [
9
    "//flutter/sky/shell/diagnostic/diagnostic_server.dart"
10
  ]
11
  root_prefix = "//flutter/sky/shell/diagnostic/"
12 13 14
  output = "$target_gen_dir/sky_embedder_diagnostic_server_resources.cc"
  table_name = "sky_embedder_diagnostic_server"
}
A
Adam Barth 已提交
15

16 17
source_set("common") {
  sources = [
18
    "$target_gen_dir/sky_embedder_diagnostic_server_resources.cc",
19 20
    "diagnostic/diagnostic_server.cc",
    "diagnostic/diagnostic_server.h",
21 22
    "gpu/picture_serializer.cc",
    "gpu/picture_serializer.h",
23 24
    "platform_view.cc",
    "platform_view.h",
25 26
    "platform_view_service_protocol.cc",
    "platform_view_service_protocol.h",
27 28
    "rasterizer.cc",
    "rasterizer.h",
29 30
    "shell.cc",
    "shell.h",
31 32
    "switches.cc",
    "switches.h",
33 34
    "systrace_logger.cc",
    "systrace_logger.h",
35 36
    "tracing_controller.cc",
    "tracing_controller.h",
37 38 39 40 41 42 43 44
    "ui/animator.cc",
    "ui/animator.h",
    "ui/engine.cc",
    "ui/engine.h",
    "ui_delegate.cc",
    "ui_delegate.h",
  ]

45
  public_deps = [
46
    "//base",
47
    "//base:i18n",
A
Adam Barth 已提交
48
    "//build/config/sanitizers:deps",
49
    "//dart/runtime:libdart",
50
    "//flutter/assets",
51
    "//flutter/common",
52 53
    "//flutter/flow",
    "//flutter/glue",
54 55 56 57 58 59 60
    "//flutter/lib/ui",
    "//flutter/runtime",
    "//flutter/services/editing:interfaces",
    "//flutter/services/engine:interfaces",
    "//flutter/services/platform",
    "//flutter/services/pointer:interfaces",
    "//flutter/services/semantics:interfaces",
61
    "//flutter/services/vsync:vsync_lib_fallback",
62 63 64 65
    "//flutter/skia",
    "//flutter/sky/engine",
    "//flutter/sky/engine/core:core",
    "//flutter/sky/engine/wtf",
66
    "//flutter/synchronization",
A
Adam Barth 已提交
67
    "//lib/ftl",
68
    "//lib/tonic",
A
Adam Barth 已提交
69
    "//mojo/application",
A
Adam Barth 已提交
70 71 72 73
    "//mojo/common",
    "//mojo/data_pipe_utils",
    "//mojo/message_pump",
    "//mojo/public/cpp/application",
M
mikejurka 已提交
74
    "//mojo/public/cpp/bindings:utility",
A
Adam Barth 已提交
75 76
    "//mojo/public/interfaces/application",
    "//mojo/services/asset_bundle/interfaces",
A
Adam Barth 已提交
77
    "//mojo/services/gfx/composition/interfaces",
A
Adam Barth 已提交
78
    "//mojo/services/navigation/interfaces",
A
Adam Barth 已提交
79
    "//mojo/services/vsync/interfaces",
80
    ":generate_sky_embedder_diagnostic_server_resources_cc",
A
Adam Barth 已提交
81 82 83 84 85
  ]
}

source_set("gpu_direct") {
  sources = [
86 87
    "gpu/direct/ganesh_canvas.cc",
    "gpu/direct/ganesh_canvas.h",
88 89
    "gpu/direct/rasterizer_direct.cc",
    "gpu/direct/rasterizer_direct.h",
A
Adam Barth 已提交
90 91 92
  ]

  deps = [
93
    ":common",
A
Adam Barth 已提交
94 95 96 97 98 99 100
  ]
}

if (is_linux || is_mac) {

  source_set("testing") {
    sources = [
101 102
      "testing/platform_view_test.cc",
      "testing/platform_view_test.h",
A
Adam Barth 已提交
103 104 105 106 107 108 109 110 111 112 113
      "testing/test_runner.cc",
      "testing/test_runner.h",
      "testing/testing.cc",
      "testing/testing.h",
    ]

    deps = [
      ":common",
    ]
  }

114 115
}

116 117 118
if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
119

120 121
  generate_jni("jni_headers") {
    sources = [
122 123
      "platform/android/io/flutter/view/FlutterView.java",
      "platform/android/io/flutter/view/FlutterMain.java",
124 125 126
    ]
    jni_package = "sky/shell"
  }
127

128 129
  shared_library("sky_shell") {
    sources = [
130 131
      "platform/android/flutter_main.cc",
      "platform/android/flutter_main.h",
132 133 134
      "platform/android/library_loader.cc",
      "platform/android/platform_view_android.cc",
      "platform/android/platform_view_android.h",
135
    ]
136

A
Adam Barth 已提交
137
    deps = [
138
      "//flutter/lib/jni",
139
      "//flutter/vulkan",
A
Adam Barth 已提交
140
      "//mojo/android:libsystem_java",
141
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
142
      "//mojo/edk/system",
143 144 145
      ":common",
      ":gpu_direct",
      ":jni_headers",
A
Adam Barth 已提交
146 147
    ]

148
    ldflags = [
149
      "-landroid",
150
      "-lEGL",
151
      "-lGLESv2",
152
    ]
153
  }
154

155 156
  android_library("java") {
    java_files = [
157 158 159 160 161 162 163 164
      "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",
165 166
      "platform/android/org/domokit/sky/shell/SkyActivity.java",
      "platform/android/org/domokit/sky/shell/SkyApplication.java",
167
    ]
168

169 170 171 172 173 174
    deps = [
      "//base:base_java",
      "//mojo/android:system_java",
      "//mojo/public/interfaces/application:application_java",
      "//mojo/public/java:bindings",
      "//mojo/public/java:system",
175
      "//mojo/services/network/interfaces:interfaces_java",
176
      "//mojo/services/sensors/interfaces:interfaces_java",
A
Adam Barth 已提交
177
      "//mojo/services/vsync/interfaces:interfaces_java",
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
      "//flutter/services/sensors:sensors_lib",
      "//flutter/services/activity:activity_lib",
      "//flutter/services/activity:interfaces_java",
      "//flutter/services/common:common_lib",
      "//flutter/services/editing:editing_lib",
      "//flutter/services/editing:interfaces_java",
      "//flutter/services/engine:interfaces_java",
      "//flutter/services/media:interfaces_java",
      "//flutter/services/media:media_lib",
      "//flutter/services/oknet",
      "//flutter/services/platform:interfaces_java",
      "//flutter/services/platform:platform_lib",
      "//flutter/services/pointer:interfaces_java",
      "//flutter/services/raw_keyboard:interfaces_java",
      "//flutter/services/raw_keyboard:raw_keyboard_lib",
      "//flutter/services/semantics:interfaces_java",
      "//flutter/services/vsync:vsync_lib",
195 196 197 198 199 200 201 202 203 204
    ]
  }

  copy_ex("assets") {
    clear_dir = true
    dest = "$root_build_dir/sky_shell/assets"
    sources = [
      "$root_build_dir/icudtl.dat",
    ]
    deps = [
205
      "//third_party/icu:icudata",
206 207
    ]
  }
A
Adam Barth 已提交
208 209 210

  android_apk("shell") {
    apk_name = "SkyShell"
211
    android_manifest = "platform/android/AndroidManifest.xml"
A
Adam Barth 已提交
212 213 214 215

    native_libs = [ "libsky_shell.so" ]
    asset_location = "$root_build_dir/sky_shell/assets"

I
Ian Fischer 已提交
216
    extensions_to_not_compress = ".flx"
A
Adam Barth 已提交
217

218 219
    flutter_dist_jar = "$root_build_dir/flutter.jar"

A
Adam Barth 已提交
220
    deps = [
221
      "//base:base_java",
A
Adam Barth 已提交
222 223 224 225 226
      ":assets",
      ":java",
      ":sky_shell",
    ]
  }
227 228 229 230
} else if (is_ios) {
  import("//build/config/ios/rules.gni")
  import("//build/config/ios/ios_sdk.gni")

231 232
  shared_library("flutter_framework_dylib") {
    output_name = "Flutter"
233

A
Adam Barth 已提交
234 235 236 237 238 239 240 241 242 243 244 245
    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",
246 247
      "platform/ios/framework/Source/flutter_touch_mapper.h",
      "platform/ios/framework/Source/flutter_touch_mapper.mm",
A
Adam Barth 已提交
248 249 250 251 252 253 254 255 256 257
      "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",
258 259
      "platform/ios/platform_view_ios.h",
      "platform/ios/platform_view_ios.mm",
A
Adam Barth 已提交
260 261 262 263 264 265 266 267 268 269 270 271
    ]

    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)
272

273
    deps = [
A
Adam Barth 已提交
274 275
      "//mojo/edk/base_edk",
      "//mojo/edk/system",
276 277 278 279 280 281 282 283
      "//flutter/skia",
      "//flutter/services/activity",
      "//flutter/services/dynamic:embedder",
      "//flutter/services/editing",
      "//flutter/services/media",
      "//flutter/services/ns_net",
      "//flutter/services/semantics",
      "//flutter/services/vsync",
A
Adam Barth 已提交
284 285 286 287 288 289
      ":common",
      ":gpu_direct",
    ]

    defines = [
      "FLUTTER_FRAMEWORK"
290 291 292 293 294 295 296 297 298 299 300
    ]

    libs = [
      "UIKit.framework",
      "OpenGLES.framework",
      "AVFoundation.framework",
      "AudioToolbox.framework",
      "QuartzCore.framework",
    ]
  }

A
Adam Barth 已提交
301 302
  group("flutter_framework") {
    framework_dir = "$root_out_dir/Flutter.framework"
303

A
Adam Barth 已提交
304 305 306
    copy("framework_dylib") {
      sources = [ "$root_out_dir/libFlutter.dylib" ]
      outputs = [ "$framework_dir/Flutter" ]
307

A
Adam Barth 已提交
308 309 310 311
      deps = [
        ":flutter_framework_dylib",
      ]
    }
312

A
Adam Barth 已提交
313 314
    action("framework_install_name") {
      stamp_file = "$root_out_dir/flutter_install_name_stamp"
315
      script = "//flutter/sky/tools/change_install_name.py"
316

A
Adam Barth 已提交
317 318
      inputs = [ "$framework_dir/Flutter" ]
      outputs = [ stamp_file ]
319

A
Adam Barth 已提交
320 321 322 323 324 325 326 327
      args = [
        "--dylib",
        rebase_path("$framework_dir/Flutter"),
        "--install_name",
        "@rpath/Flutter.framework/Flutter",
        "--stamp",
        rebase_path(stamp_file),
      ]
328

A
Adam Barth 已提交
329 330 331 332
      deps = [
        ":framework_dylib"
      ]
    }
333

A
Adam Barth 已提交
334 335 336 337
    copy("framework_info_plist") {
      sources = [ "platform/ios/framework/Info.plist" ]
      outputs = [ "$framework_dir/Info.plist" ]
    }
338

A
Adam Barth 已提交
339 340 341 342
    copy("framework_module_map") {
      sources = [ "platform/ios/framework/module.modulemap" ]
      outputs = [ "$framework_dir/Modules/module.modulemap" ]
    }
343

A
Adam Barth 已提交
344 345 346 347 348 349 350 351 352 353 354 355
    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}}" ]
    }
356

A
Adam Barth 已提交
357 358 359 360 361 362 363 364
    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}}" ]
    }
365

366 367
    public_deps = [
      ":framework_dylib",
368 369
      ":framework_headers",
      ":framework_icu",
370
      ":framework_info_plist",
371
      ":framework_install_name",
372 373 374 375
      ":framework_module_map",
    ]
  }

376
  group("shell") {
377
  }
378
} else if (is_linux) {
A
Adam Barth 已提交
379 380 381 382
  executable("shell") {
    output_name = "sky_shell"

    sources = [
383
      "platform/linux/main_linux.cc",
A
Adam Barth 已提交
384
    ]
A
Adam Barth 已提交
385

A
Adam Barth 已提交
386 387
    deps = [
      "//mojo/common",
388
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
389 390 391 392 393
      "//mojo/edk/system",
      ":common",
      ":gpu_direct",
      ":testing",
    ]
A
Adam Barth 已提交
394

395 396 397 398
    ldflags = [
      "-lGL",
    ]

A
Adam Barth 已提交
399 400
    if (use_glfw) {
      sources += [
401 402 403 404 405 406 407 408
        "//flutter/sky/shell/platform/glfw/init_glfw.cc",
        "//flutter/sky/shell/platform/glfw/init_glfw.h",
        "//flutter/sky/shell/platform/glfw/message_pump_glfw.cc",
        "//flutter/sky/shell/platform/glfw/message_pump_glfw.h",
        "//flutter/sky/shell/platform/glfw/platform_view_glfw.cc",
        "//flutter/sky/shell/platform/glfw/platform_view_glfw.h",
        "//flutter/sky/shell/platform/glfw/window_impl.cc",
        "//flutter/sky/shell/platform/glfw/window_impl.h",
A
Adam Barth 已提交
409 410
      ]

411
      deps += [
412
        "//flutter/services/raw_keyboard:interfaces",
413 414 415
        "//third_party/glfw",
        "//ui/gl",
      ]
A
Adam Barth 已提交
416 417 418
    } else {
      sources += [ "platform/linux/platform_view_linux.cc" ]
    }
419 420 421 422
  }
} else if (is_mac) {
  import("//build/config/mac/rules.gni")

423 424
  source_set("mac_scaffolding") {
    sources = [
425 426 427
      "platform/mac/main_mac.mm",
      "platform/mac/platform_mac.h",
      "platform/mac/platform_mac.mm",
428 429
      "platform/mac/platform_service_provider.cc",
      "platform/mac/platform_service_provider.h",
430 431 432 433 434 435 436 437
      "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",
438 439
      "platform/mac/view_service_provider.cc",
      "platform/mac/view_service_provider.h",
A
Adam Barth 已提交
440 441 442 443
    ]

    deps = [
      "//mojo/common",
444
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
445
      "//mojo/edk/system",
446 447
      "//flutter/services/ns_net",
      "//flutter/services/vsync",
A
Adam Barth 已提交
448 449 450 451
      ":common",
      ":gpu_direct",
      ":testing",
    ]
452 453
  }

454 455 456 457 458 459 460 461
  executable("shell_standalone") {
    output_name = "sky_shell"
    deps = [
      ":mac_scaffolding",
    ]
  }

  mac_app("shell_application") {
E
Eric Seidel 已提交
462
    app_name = "SkyShell"
463
    info_plist = "platform/mac/Info.plist"
464

465
    xibs = [ "platform/mac/sky_mac.xib" ]
466

A
Adam Barth 已提交
467 468 469 470 471 472 473
    resource_copy_mac("sky_resources") {
      resources = [
        "//third_party/icu/android/icudtl.dat",
      ]
      bundle_directory = "."
    }

474
    deps = [
475
      ":mac_scaffolding",
476 477
      ":sky_resources",
    ]
A
Adam Barth 已提交
478
  }
479 480 481 482 483 484 485

  group("shell") {
    deps = [
      ":shell_application",
      ":shell_standalone",
    ]
  }
486 487
} else {
  assert(false, "Unsupported platform")
A
Adam Barth 已提交
488
}