BUILD.gn 5.0 KB
Newer Older
1 2 3 4 5 6
# Copyright 2016 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.

assert(is_ios)

7
import("$flutter_root/common/config.gni")
8 9
import("//build/config/ios/ios_sdk.gni")

10 11
_flutter_framework_dir = "$root_out_dir/Flutter.framework"

12 13 14 15 16 17 18 19 20
shared_library("flutter_framework_dylib") {
  visibility = [ ":*" ]

  output_name = "Flutter"

  sources = [
    "framework/Headers/Flutter.h",
    "framework/Headers/FlutterAppDelegate.h",
    "framework/Headers/FlutterDartProject.h",
21
    "framework/Headers/FlutterPlugin.h",
22
    "framework/Headers/FlutterViewController.h",
23
    "framework/Headers/FlutterNavigationController.h",
24
    "framework/Source/FlutterAppDelegate.mm",
25
    "framework/Source/FlutterDartProject.mm",
26
    "framework/Source/FlutterDartProject_Internal.h",
27 28
    "framework/Source/FlutterDartSource.h",
    "framework/Source/FlutterDartSource.mm",
29 30
    "framework/Source/FlutterPlatformPlugin.h",
    "framework/Source/FlutterPlatformPlugin.mm",
31 32 33
    "framework/Source/FlutterTextInputDelegate.h",
    "framework/Source/FlutterTextInputPlugin.h",
    "framework/Source/FlutterTextInputPlugin.mm",
34 35 36
    "framework/Source/FlutterView.h",
    "framework/Source/FlutterView.mm",
    "framework/Source/FlutterViewController.mm",
37
    "framework/Source/FlutterNavigationController.mm",
38 39
    "framework/Source/accessibility_bridge.h",
    "framework/Source/accessibility_bridge.mm",
40 41
    "framework/Source/flutter_main_ios.h",
    "framework/Source/flutter_main_ios.mm",
42 43
    "framework/Source/flutter_touch_mapper.h",
    "framework/Source/flutter_touch_mapper.mm",
44 45
    "framework/Source/platform_message_router.h",
    "framework/Source/platform_message_router.mm",
46 47
    "framework/Source/vsync_waiter_ios.h",
    "framework/Source/vsync_waiter_ios.mm",
48 49 50 51 52 53 54 55
    "ios_gl_context.h",
    "ios_gl_context.mm",
    "ios_surface.h",
    "ios_surface.mm",
    "ios_surface_gl.h",
    "ios_surface_gl.mm",
    "ios_surface_software.h",
    "ios_surface_software.mm",
56 57 58
    "platform_view_ios.h",
    "platform_view_ios.mm",
  ]
59

60
  deps = [
61 62 63 64 65 66 67 68 69
    "$flutter_root/flow",
    "$flutter_root/fml",
    "$flutter_root/glue",
    "$flutter_root/lib/ui",
    "$flutter_root/shell/common",
    "$flutter_root/shell/gpu",
    "$flutter_root/shell/platform/darwin/common",
    "$flutter_root/sky/engine/platform",
    "$flutter_root/sky/engine/wtf",
70
    "//garnet/public/lib/fxl",
71
    "//third_party/skia",
72
  ]
73
  if (flutter_runtime_mode == "debug") {
74
    deps += [ "//third_party/dart/runtime:libdart_jit" ]
75
  } else {
76
    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
77
  }
78

79 80 81 82
  public_configs = [
    "$flutter_root:config",
  ]

83
  defines = [ "FLUTTER_FRAMEWORK" ]
84 85 86 87 88 89 90 91 92 93

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

94 95
copy("framework_dylib") {
  visibility = [ ":*" ]
96 97 98 99 100 101
  sources = [
    "$root_out_dir/libFlutter.dylib",
  ]
  outputs = [
    "$_flutter_framework_dir/Flutter",
  ]
102 103 104 105 106 107 108 109 110

  deps = [
    ":flutter_framework_dylib",
  ]
}

action("framework_install_name") {
  visibility = [ ":*" ]
  stamp_file = "$root_out_dir/flutter_install_name_stamp"
111
  script = "$flutter_root/sky/tools/change_install_name.py"
112

113 114 115 116 117 118
  inputs = [
    "$_flutter_framework_dir/Flutter",
  ]
  outputs = [
    stamp_file,
  ]
119 120 121 122 123 124 125 126 127 128 129

  args = [
    "--dylib",
    rebase_path("$_flutter_framework_dir/Flutter"),
    "--install_name",
    "@rpath/Flutter.framework/Flutter",
    "--stamp",
    rebase_path(stamp_file),
  ]

  deps = [
130
    ":framework_dylib",
131 132 133 134 135
  ]
}

copy("framework_info_plist") {
  visibility = [ ":*" ]
136 137 138 139 140 141
  sources = [
    "framework/Info.plist",
  ]
  outputs = [
    "$_flutter_framework_dir/Info.plist",
  ]
142 143 144 145
}

copy("framework_module_map") {
  visibility = [ ":*" ]
146 147 148 149 150 151
  sources = [
    "framework/module.modulemap",
  ]
  outputs = [
    "$_flutter_framework_dir/Modules/module.modulemap",
  ]
152
}
153

154 155 156 157 158 159
copy("framework_headers") {
  visibility = [ ":*" ]
  sources = [
    "framework/Headers/Flutter.h",
    "framework/Headers/FlutterAppDelegate.h",
    "framework/Headers/FlutterDartProject.h",
160
    "framework/Headers/FlutterPlugin.h",
161
    "framework/Headers/FlutterViewController.h",
162
    "framework/Headers/FlutterNavigationController.h",
163
  ]
164 165 166
  outputs = [
    "$_flutter_framework_dir/Headers/{{source_file_part}}",
  ]
167 168 169 170

  deps = [
    "$flutter_root/shell/platform/darwin/common",
  ]
171 172 173 174 175 176
}

copy("framework_icu") {
  visibility = [ ":*" ]
  set_sources_assignment_filter([])
  sources = [
177
    "//third_party/icu/ios/icudtl.dat",
178 179
  ]
  set_sources_assignment_filter(sources_assignment_filter)
180 181 182
  outputs = [
    "$_flutter_framework_dir/{{source_file_part}}",
  ]
183 184
}

185 186 187 188 189 190 191 192 193 194
copy("framework_podspec") {
  visibility = [ ":*" ]
  sources = [
    "framework/Flutter.podspec",
  ]
  outputs = [
    "$root_out_dir/Flutter.podspec",
  ]
}

195
group("flutter_framework") {
196 197 198 199 200 201 202
  public_deps = [
    ":framework_dylib",
    ":framework_headers",
    ":framework_icu",
    ":framework_info_plist",
    ":framework_install_name",
    ":framework_module_map",
203
    ":framework_podspec",
204 205
  ]
}