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

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
  ]
}

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

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

if (is_linux || is_mac) {

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

    deps = [
      ":common",
    ]
  }

130 131
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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