BUILD.gn 13.5 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
    "rasterizer.cc",
    "rasterizer.h",
28 29 30 31
    "shell.cc",
    "shell.h",
    "shell_view.cc",
    "shell_view.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/tonic",
A
Adam Barth 已提交
56
    "//lib/ftl",
A
Adam Barth 已提交
57 58 59 60 61 62
    "//mojo/common",
    "//mojo/data_pipe_utils",
    "//mojo/message_pump",
    "//mojo/public/cpp/application",
    "//mojo/public/interfaces/application",
    "//mojo/services/asset_bundle/interfaces",
A
Adam Barth 已提交
63
    "//mojo/services/gfx/composition/interfaces",
A
Adam Barth 已提交
64
    "//mojo/services/navigation/interfaces",
A
Adam Barth 已提交
65
    "//mojo/services/vsync/interfaces",
A
Adam Barth 已提交
66 67 68
    "//services/asset_bundle:lib",
    "//skia",
    "//sky/engine",
A
Adam Barth 已提交
69
    "//sky/engine/bindings",
J
Jason Simmons 已提交
70
    "//sky/engine/core:core",
A
Adam Barth 已提交
71
    "//sky/engine/wtf",
A
Adam Barth 已提交
72
    "//sky/services/editing:interfaces",
A
Adam Barth 已提交
73
    "//sky/services/engine:interfaces",
74
    "//sky/services/platform",
A
Adam Barth 已提交
75
    "//sky/services/pointer:interfaces",
F
Florian Loitsch 已提交
76
    "//sky/services/rasterizer:interfaces",
H
Hixie 已提交
77
    "//sky/services/semantics:interfaces",
A
Adam Barth 已提交
78 79 80 81 82 83
    "//sky/shell/dart",
  ]
}

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

  deps = [
91
    ":common",
A
Adam Barth 已提交
92 93 94 95 96
  ]
}

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

  deps = [
A
Adam Barth 已提交
104
    "//mojo/gpu",
A
Adam Barth 已提交
105
    "//mojo/public/c/gpu",
A
Adam Barth 已提交
106 107
    "//mojo/skia",
    ":common",
A
Adam Barth 已提交
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
  ]
}

if (is_linux || is_mac) {

  source_set("testing") {
    sources = [
      "testing/test_runner.cc",
      "testing/test_runner.h",
      "testing/testing.cc",
      "testing/testing.h",
    ]

    deps = [
      ":common",
    ]
  }

126 127
}

128 129 130
if (is_android) {
  import("//build/config/android/config.gni")
  import("//build/config/android/rules.gni")
131

132 133
  generate_jni("jni_headers") {
    sources = [
134 135
      "platform/android/io/flutter/view/FlutterView.java",
      "platform/android/io/flutter/view/FlutterMain.java",
136 137 138
    ]
    jni_package = "sky/shell"
  }
139

140 141
  shared_library("sky_shell") {
    sources = [
142 143
      "platform/android/flutter_main.cc",
      "platform/android/flutter_main.h",
144 145 146
      "platform/android/library_loader.cc",
      "platform/android/platform_view_android.cc",
      "platform/android/platform_view_android.h",
147
    ]
148

A
Adam Barth 已提交
149
    deps = [
150 151 152 153
      ":common",
      ":gpu_direct",
      ":jni_headers",
      "//flutter/lib/jni",
A
Adam Barth 已提交
154
      "//mojo/android:libsystem_java",
155
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
156 157 158
      "//mojo/edk/system",
    ]

159
    ldflags = [
160
      "-landroid",
161
      "-lEGL",
162
      "-lGLESv2",
163
    ]
164
  }
165

166 167
  android_library("java") {
    java_files = [
168 169 170 171 172 173 174 175
      "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",
176 177
      "platform/android/org/domokit/sky/shell/SkyActivity.java",
      "platform/android/org/domokit/sky/shell/SkyApplication.java",
178
    ]
179

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

  copy_ex("assets") {
    clear_dir = true
    dest = "$root_build_dir/sky_shell/assets"
    sources = [
      "$root_build_dir/icudtl.dat",
    ]
    deps = [
216
      "//third_party/icu:icudata",
217 218
    ]
  }
A
Adam Barth 已提交
219 220 221

  android_apk("shell") {
    apk_name = "SkyShell"
222
    android_manifest = "platform/android/AndroidManifest.xml"
A
Adam Barth 已提交
223 224 225 226

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

I
Ian Fischer 已提交
227
    extensions_to_not_compress = ".flx"
A
Adam Barth 已提交
228

229 230
    flutter_dist_jar = "$root_build_dir/flutter.jar"

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

242 243
  shared_library("flutter_framework_dylib") {
    output_name = "Flutter"
244

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

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

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

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

A
Adam Barth 已提交
312 313
  group("flutter_framework") {
    framework_dir = "$root_out_dir/Flutter.framework"
314

A
Adam Barth 已提交
315 316 317
    copy("framework_dylib") {
      sources = [ "$root_out_dir/libFlutter.dylib" ]
      outputs = [ "$framework_dir/Flutter" ]
318

A
Adam Barth 已提交
319 320 321 322
      deps = [
        ":flutter_framework_dylib",
      ]
    }
323

A
Adam Barth 已提交
324 325 326
    action("framework_install_name") {
      stamp_file = "$root_out_dir/flutter_install_name_stamp"
      script = "//sky/tools/change_install_name.py"
327

A
Adam Barth 已提交
328 329
      inputs = [ "$framework_dir/Flutter" ]
      outputs = [ stamp_file ]
330

A
Adam Barth 已提交
331 332 333 334 335 336 337 338
      args = [
        "--dylib",
        rebase_path("$framework_dir/Flutter"),
        "--install_name",
        "@rpath/Flutter.framework/Flutter",
        "--stamp",
        rebase_path(stamp_file),
      ]
339

A
Adam Barth 已提交
340 341 342 343
      deps = [
        ":framework_dylib"
      ]
    }
344

A
Adam Barth 已提交
345 346 347 348
    copy("framework_info_plist") {
      sources = [ "platform/ios/framework/Info.plist" ]
      outputs = [ "$framework_dir/Info.plist" ]
    }
349

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

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

A
Adam Barth 已提交
368 369 370 371 372 373 374 375
    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}}" ]
    }
376

377 378
    public_deps = [
      ":framework_dylib",
379 380
      ":framework_headers",
      ":framework_icu",
381
      ":framework_info_plist",
382
      ":framework_install_name",
383 384 385 386
      ":framework_module_map",
    ]
  }

387
  group("shell") {
388
  }
389
} else if (is_linux) {
A
Adam Barth 已提交
390 391 392 393
  executable("shell") {
    output_name = "sky_shell"

    sources = [
394
      "platform/linux/main_linux.cc",
A
Adam Barth 已提交
395
    ]
A
Adam Barth 已提交
396

A
Adam Barth 已提交
397 398
    deps = [
      "//mojo/common",
399
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
400 401 402 403 404
      "//mojo/edk/system",
      ":common",
      ":gpu_direct",
      ":testing",
    ]
A
Adam Barth 已提交
405

406 407 408 409
    ldflags = [
      "-lGL",
    ]

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

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

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

    deps = [
      "//mojo/common",
455
      "//mojo/edk/base_edk",
A
Adam Barth 已提交
456 457 458 459 460 461
      "//mojo/edk/system",
      "//sky/services/ns_net",
      ":common",
      ":gpu_direct",
      ":testing",
    ]
462 463
  }

464 465 466 467 468 469 470 471
  executable("shell_standalone") {
    output_name = "sky_shell"
    deps = [
      ":mac_scaffolding",
    ]
  }

  mac_app("shell_application") {
E
Eric Seidel 已提交
472
    app_name = "SkyShell"
473
    info_plist = "platform/mac/Info.plist"
474

475
    xibs = [ "platform/mac/sky_mac.xib" ]
476

A
Adam Barth 已提交
477 478 479 480 481 482 483
    resource_copy_mac("sky_resources") {
      resources = [
        "//third_party/icu/android/icudtl.dat",
      ]
      bundle_directory = "."
    }

484
    deps = [
485
      ":mac_scaffolding",
486 487
      ":sky_resources",
    ]
A
Adam Barth 已提交
488
  }
489 490 491 492 493 494 495

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