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.

A
Adam Barth 已提交
5
import("//build/config/ui.gni")
6 7 8 9 10 11 12 13 14 15
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"
}
A
Adam Barth 已提交
16

17 18
source_set("common") {
  sources = [
19
    "$target_gen_dir/sky_embedder_diagnostic_server_resources.cc",
20 21
    "diagnostic/diagnostic_server.cc",
    "diagnostic/diagnostic_server.h",
22 23
    "gpu/picture_serializer.cc",
    "gpu/picture_serializer.h",
24 25
    "platform_view.cc",
    "platform_view.h",
26 27
    "platform_view_service_protocol.cc",
    "platform_view_service_protocol.h",
28 29
    "rasterizer.cc",
    "rasterizer.h",
30 31
    "shell.cc",
    "shell.h",
32 33
    "switches.cc",
    "switches.h",
34 35
    "tracing_controller.cc",
    "tracing_controller.h",
36 37 38 39
    "ui/animator.cc",
    "ui/animator.h",
    "ui/engine.cc",
    "ui/engine.h",
J
Jason Simmons 已提交
40 41
    "ui/flutter_font_selector.cc",
    "ui/flutter_font_selector.h",
A
Adam Barth 已提交
42 43
    "ui/platform_impl.cc",
    "ui/platform_impl.h",
44 45 46 47
    "ui_delegate.cc",
    "ui_delegate.h",
  ]

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

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

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

source_set("gpu_mojo") {
  sources = [
A
Adam Barth 已提交
100 101
    "gpu/mojo/gl_texture_recycler.cc",
    "gpu/mojo/gl_texture_recycler.h",
A
Adam Barth 已提交
102 103 104 105 106
    "gpu/mojo/rasterizer_mojo.cc",
    "gpu/mojo/rasterizer_mojo.h",
  ]

  deps = [
A
Adam Barth 已提交
107
    "//mojo/gpu",
A
Adam Barth 已提交
108
    "//mojo/public/c/gpu",
A
Adam Barth 已提交
109 110
    "//mojo/skia",
    ":common",
A
Adam Barth 已提交
111 112 113 114 115 116 117
  ]
}

if (is_linux || is_mac) {

  source_set("testing") {
    sources = [
118 119
      "testing/platform_view_test.cc",
      "testing/platform_view_test.h",
A
Adam Barth 已提交
120 121 122 123 124 125 126 127 128 129 130
      "testing/test_runner.cc",
      "testing/test_runner.h",
      "testing/testing.cc",
      "testing/testing.h",
    ]

    deps = [
      ":common",
    ]
  }

131 132
}

133 134 135
if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
136

137 138
  generate_jni("jni_headers") {
    sources = [
139 140
      "platform/android/io/flutter/view/FlutterView.java",
      "platform/android/io/flutter/view/FlutterMain.java",
141 142 143
    ]
    jni_package = "sky/shell"
  }
144

145 146
  shared_library("sky_shell") {
    sources = [
147 148
      "platform/android/flutter_main.cc",
      "platform/android/flutter_main.h",
149 150 151
      "platform/android/library_loader.cc",
      "platform/android/platform_view_android.cc",
      "platform/android/platform_view_android.h",
152
    ]
153

A
Adam Barth 已提交
154
    deps = [
155 156 157 158
      ":common",
      ":gpu_direct",
      ":jni_headers",
      "//flutter/lib/jni",
A
Adam Barth 已提交
159
      "//mojo/android:libsystem_java",
160
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
161 162 163
      "//mojo/edk/system",
    ]

164
    ldflags = [
165
      "-landroid",
166
      "-lEGL",
167
      "-lGLESv2",
168
    ]
169
  }
170

171 172
  android_library("java") {
    java_files = [
173 174 175 176 177 178 179 180
      "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",
181 182
      "platform/android/org/domokit/sky/shell/SkyActivity.java",
      "platform/android/org/domokit/sky/shell/SkyApplication.java",
183
    ]
184

185 186 187 188 189 190
    deps = [
      "//base:base_java",
      "//mojo/android:system_java",
      "//mojo/public/interfaces/application:application_java",
      "//mojo/public/java:bindings",
      "//mojo/public/java:system",
191
      "//mojo/services/network/interfaces:interfaces_java",
192
      "//mojo/services/sensors/interfaces:interfaces_java",
A
Adam Barth 已提交
193
      "//mojo/services/vsync/interfaces:interfaces_java",
A
Adam Barth 已提交
194
      "//services/sensors:sensors_lib",
195 196
      "//sky/services/activity:activity_lib",
      "//sky/services/activity:interfaces_java",
197
      "//sky/services/common:common_lib",
A
Adam Barth 已提交
198 199
      "//sky/services/editing:editing_lib",
      "//sky/services/editing:interfaces_java",
A
Adam Barth 已提交
200
      "//sky/services/engine:interfaces_java",
A
Adam Barth 已提交
201 202
      "//sky/services/media:interfaces_java",
      "//sky/services/media:media_lib",
203
      "//sky/services/oknet",
204 205
      "//sky/services/platform:interfaces_java",
      "//sky/services/platform:platform_lib",
206
      "//sky/services/pointer:interfaces_java",
207
      "//sky/services/raw_keyboard:interfaces_java",
208
      "//sky/services/raw_keyboard:raw_keyboard_lib",
H
Hixie 已提交
209
      "//sky/services/semantics:interfaces_java",
210
      "//sky/services/vsync:vsync_lib",
211 212 213 214 215 216 217 218 219 220
    ]
  }

  copy_ex("assets") {
    clear_dir = true
    dest = "$root_build_dir/sky_shell/assets"
    sources = [
      "$root_build_dir/icudtl.dat",
    ]
    deps = [
221
      "//third_party/icu:icudata",
222 223
    ]
  }
A
Adam Barth 已提交
224 225 226

  android_apk("shell") {
    apk_name = "SkyShell"
227
    android_manifest = "platform/android/AndroidManifest.xml"
A
Adam Barth 已提交
228 229 230 231

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

I
Ian Fischer 已提交
232
    extensions_to_not_compress = ".flx"
A
Adam Barth 已提交
233

234 235
    flutter_dist_jar = "$root_build_dir/flutter.jar"

A
Adam Barth 已提交
236
    deps = [
237
      "//base:base_java",
A
Adam Barth 已提交
238 239 240 241 242
      ":assets",
      ":java",
      ":sky_shell",
    ]
  }
243 244 245 246
} else if (is_ios) {
  import("//build/config/ios/rules.gni")
  import("//build/config/ios/ios_sdk.gni")

247 248
  shared_library("flutter_framework_dylib") {
    output_name = "Flutter"
249

A
Adam Barth 已提交
250 251 252 253 254 255 256 257 258 259 260 261
    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",
262 263
      "platform/ios/framework/Source/flutter_touch_mapper.h",
      "platform/ios/framework/Source/flutter_touch_mapper.mm",
A
Adam Barth 已提交
264 265 266 267 268 269 270 271 272 273
      "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",
274 275
      "platform/ios/platform_view_ios.h",
      "platform/ios/platform_view_ios.mm",
A
Adam Barth 已提交
276 277 278 279 280 281 282 283 284 285 286 287
    ]

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

289
    deps = [
A
Adam Barth 已提交
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
      "//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"
306 307 308 309 310 311 312 313 314 315 316
    ]

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

A
Adam Barth 已提交
317 318
  group("flutter_framework") {
    framework_dir = "$root_out_dir/Flutter.framework"
319

A
Adam Barth 已提交
320 321 322
    copy("framework_dylib") {
      sources = [ "$root_out_dir/libFlutter.dylib" ]
      outputs = [ "$framework_dir/Flutter" ]
323

A
Adam Barth 已提交
324 325 326 327
      deps = [
        ":flutter_framework_dylib",
      ]
    }
328

A
Adam Barth 已提交
329 330 331
    action("framework_install_name") {
      stamp_file = "$root_out_dir/flutter_install_name_stamp"
      script = "//sky/tools/change_install_name.py"
332

A
Adam Barth 已提交
333 334
      inputs = [ "$framework_dir/Flutter" ]
      outputs = [ stamp_file ]
335

A
Adam Barth 已提交
336 337 338 339 340 341 342 343
      args = [
        "--dylib",
        rebase_path("$framework_dir/Flutter"),
        "--install_name",
        "@rpath/Flutter.framework/Flutter",
        "--stamp",
        rebase_path(stamp_file),
      ]
344

A
Adam Barth 已提交
345 346 347 348
      deps = [
        ":framework_dylib"
      ]
    }
349

A
Adam Barth 已提交
350 351 352 353
    copy("framework_info_plist") {
      sources = [ "platform/ios/framework/Info.plist" ]
      outputs = [ "$framework_dir/Info.plist" ]
    }
354

A
Adam Barth 已提交
355 356 357 358
    copy("framework_module_map") {
      sources = [ "platform/ios/framework/module.modulemap" ]
      outputs = [ "$framework_dir/Modules/module.modulemap" ]
    }
359

A
Adam Barth 已提交
360 361 362 363 364 365 366 367 368 369 370 371
    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}}" ]
    }
372

A
Adam Barth 已提交
373 374 375 376 377 378 379 380
    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}}" ]
    }
381

382 383
    public_deps = [
      ":framework_dylib",
384 385
      ":framework_headers",
      ":framework_icu",
386
      ":framework_info_plist",
387
      ":framework_install_name",
388 389 390 391
      ":framework_module_map",
    ]
  }

392
  group("shell") {
393
  }
394
} else if (is_linux) {
A
Adam Barth 已提交
395 396 397 398
  executable("shell") {
    output_name = "sky_shell"

    sources = [
399
      "platform/linux/main_linux.cc",
A
Adam Barth 已提交
400
    ]
A
Adam Barth 已提交
401

A
Adam Barth 已提交
402 403
    deps = [
      "//mojo/common",
404
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
405 406 407 408 409
      "//mojo/edk/system",
      ":common",
      ":gpu_direct",
      ":testing",
    ]
A
Adam Barth 已提交
410

411 412 413 414
    ldflags = [
      "-lGL",
    ]

A
Adam Barth 已提交
415 416 417 418
    if (use_glfw) {
      sources += [
        "//sky/shell/platform/glfw/init_glfw.cc",
        "//sky/shell/platform/glfw/init_glfw.h",
A
Adam Barth 已提交
419 420
        "//sky/shell/platform/glfw/message_pump_glfw.cc",
        "//sky/shell/platform/glfw/message_pump_glfw.h",
A
Adam Barth 已提交
421 422 423 424 425 426
        "//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",
      ]

427
      deps += [
428
        "//sky/services/raw_keyboard:interfaces",
429 430 431
        "//third_party/glfw",
        "//ui/gl",
      ]
A
Adam Barth 已提交
432 433 434
    } else {
      sources += [ "platform/linux/platform_view_linux.cc" ]
    }
435 436 437 438
  }
} else if (is_mac) {
  import("//build/config/mac/rules.gni")

439 440
  source_set("mac_scaffolding") {
    sources = [
441 442 443
      "platform/mac/main_mac.mm",
      "platform/mac/platform_mac.h",
      "platform/mac/platform_mac.mm",
444 445
      "platform/mac/platform_service_provider.cc",
      "platform/mac/platform_service_provider.h",
446 447 448 449 450 451 452 453
      "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",
454 455
      "platform/mac/view_service_provider.cc",
      "platform/mac/view_service_provider.h",
A
Adam Barth 已提交
456 457 458 459
    ]

    deps = [
      "//mojo/common",
460
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
461 462
      "//mojo/edk/system",
      "//sky/services/ns_net",
463
      "//sky/services/vsync",
A
Adam Barth 已提交
464 465 466 467
      ":common",
      ":gpu_direct",
      ":testing",
    ]
468 469
  }

470 471 472 473 474 475 476 477
  executable("shell_standalone") {
    output_name = "sky_shell"
    deps = [
      ":mac_scaffolding",
    ]
  }

  mac_app("shell_application") {
E
Eric Seidel 已提交
478
    app_name = "SkyShell"
479
    info_plist = "platform/mac/Info.plist"
480

481
    xibs = [ "platform/mac/sky_mac.xib" ]
482

A
Adam Barth 已提交
483 484 485 486 487 488 489
    resource_copy_mac("sky_resources") {
      resources = [
        "//third_party/icu/android/icudtl.dat",
      ]
      bundle_directory = "."
    }

490
    deps = [
491
      ":mac_scaffolding",
492 493
      ":sky_resources",
    ]
A
Adam Barth 已提交
494
  }
495 496 497 498 499 500 501

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