BUILD.gn 6.5 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
# The headers that will be copied to the Flutter.framework and be accessed
# from outside the Flutter engine source root.
_flutter_framework_headers = [
  "framework/Headers/Flutter.h",
  "framework/Headers/FlutterAppDelegate.h",
  "framework/Headers/FlutterBinaryMessenger.h",
  "framework/Headers/FlutterChannels.h",
  "framework/Headers/FlutterCodecs.h",
  "framework/Headers/FlutterDartProject.h",
21
  "framework/Headers/FlutterHeadlessDartRunner.h",
22 23 24
  "framework/Headers/FlutterMacros.h",
  "framework/Headers/FlutterNavigationController.h",
  "framework/Headers/FlutterPlugin.h",
25
  "framework/Headers/FlutterTexture.h",
26 27 28 29 30 31
  "framework/Headers/FlutterViewController.h",
]

_flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers"

shared_library("create_flutter_framework_dylib") {
32 33 34 35 36 37
  visibility = [ ":*" ]

  output_name = "Flutter"

  sources = [
    "framework/Source/FlutterAppDelegate.mm",
38 39
    "framework/Source/FlutterChannels.mm",
    "framework/Source/FlutterCodecs.mm",
40
    "framework/Source/FlutterDartProject.mm",
41
    "framework/Source/FlutterDartProject_Internal.h",
42
    "framework/Source/FlutterHeadlessDartRunner.mm",
43
    "framework/Source/FlutterNavigationController.mm",
44 45
    "framework/Source/FlutterPlatformPlugin.h",
    "framework/Source/FlutterPlatformPlugin.mm",
46 47
    "framework/Source/FlutterStandardCodec.mm",
    "framework/Source/FlutterStandardCodec_Internal.h",
48 49 50
    "framework/Source/FlutterTextInputDelegate.h",
    "framework/Source/FlutterTextInputPlugin.h",
    "framework/Source/FlutterTextInputPlugin.mm",
51 52 53
    "framework/Source/FlutterView.h",
    "framework/Source/FlutterView.mm",
    "framework/Source/FlutterViewController.mm",
54
    "framework/Source/FlutterViewController_Internal.h",
55 56
    "framework/Source/accessibility_bridge.h",
    "framework/Source/accessibility_bridge.mm",
Y
Yegor 已提交
57 58
    "framework/Source/accessibility_text_entry.h",
    "framework/Source/accessibility_text_entry.mm",
59 60
    "framework/Source/flutter_touch_mapper.h",
    "framework/Source/flutter_touch_mapper.mm",
61 62
    "framework/Source/platform_message_response_darwin.h",
    "framework/Source/platform_message_response_darwin.mm",
63 64
    "framework/Source/platform_message_router.h",
    "framework/Source/platform_message_router.mm",
65 66
    "framework/Source/vsync_waiter_ios.h",
    "framework/Source/vsync_waiter_ios.mm",
67 68
    "ios_external_texture_gl.h",
    "ios_external_texture_gl.mm",
69 70 71 72 73 74 75 76
    "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",
77 78 79
    "platform_view_ios.h",
    "platform_view_ios.mm",
  ]
80

81 82
  sources += _flutter_framework_headers

83
  deps = [
84 85 86 87
    "$flutter_root/flow",
    "$flutter_root/fml",
    "$flutter_root/glue",
    "$flutter_root/lib/ui",
88
    "$flutter_root/runtime",
89 90 91 92 93
    "$flutter_root/shell/common",
    "$flutter_root/shell/gpu",
    "$flutter_root/shell/platform/darwin/common",
    "$flutter_root/sky/engine/platform",
    "$flutter_root/sky/engine/wtf",
94
    "//garnet/public/lib/fxl",
95
    "//third_party/skia",
96
  ]
97
  if (flutter_runtime_mode == "debug") {
98 99 100 101
    deps += [
      "$flutter_root/lib/snapshot",
      "//third_party/dart/runtime:libdart_jit",
    ]
102
  } else {
103
    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
104
  }
105

106
  public_configs = [ "$flutter_root:config" ]
107

108
  defines = [ "FLUTTER_FRAMEWORK" ]
109 110

  libs = [
111 112
    "CoreMedia.framework",
    "CoreVideo.framework",
113 114 115 116 117 118 119
    "UIKit.framework",
    "OpenGLES.framework",
    "AudioToolbox.framework",
    "QuartzCore.framework",
  ]
}

120
copy("copy_framework_dylib") {
121
  visibility = [ ":*" ]
122

123 124 125 126 127 128
  sources = [
    "$root_out_dir/libFlutter.dylib",
  ]
  outputs = [
    "$_flutter_framework_dir/Flutter",
  ]
129 130

  deps = [
131
    ":create_flutter_framework_dylib",
132 133 134
  ]
}

135
action("copy_dylib_and_update_framework_install_name") {
136 137
  visibility = [ ":*" ]
  stamp_file = "$root_out_dir/flutter_install_name_stamp"
138
  script = "$flutter_root/sky/tools/change_install_name.py"
139

140 141 142 143 144 145
  inputs = [
    "$_flutter_framework_dir/Flutter",
  ]
  outputs = [
    stamp_file,
  ]
146 147 148 149 150 151 152 153 154 155 156

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

  deps = [
157
    ":copy_framework_dylib",
158 159 160
  ]
}

161
copy("copy_framework_info_plist") {
162
  visibility = [ ":*" ]
163 164 165 166 167 168
  sources = [
    "framework/Info.plist",
  ]
  outputs = [
    "$_flutter_framework_dir/Info.plist",
  ]
169 170
}

171
copy("copy_framework_module_map") {
172
  visibility = [ ":*" ]
173 174 175 176 177 178
  sources = [
    "framework/module.modulemap",
  ]
  outputs = [
    "$_flutter_framework_dir/Modules/module.modulemap",
  ]
179
}
180

181 182
action("copy_framework_headers") {
  script = "$flutter_root/sky/tools/install_framework_headers.py"
183
  visibility = [ ":*" ]
184 185 186 187 188 189 190 191 192 193 194
  sources = _flutter_framework_headers
  outputs = []
  foreach(header, _flutter_framework_headers) {
    header_basename = rebase_path(header, "framework/headers")
    outputs += [ "$_flutter_framework_headers_copy_dir/$header_basename" ]
  }
  args = [
           "--location",
           rebase_path("$_flutter_framework_headers_copy_dir"),
           "--headers",
         ] + rebase_path(_flutter_framework_headers)
195 196
}

197
copy("copy_framework_icu") {
198 199 200
  visibility = [ ":*" ]
  set_sources_assignment_filter([])
  sources = [
201
    "//third_party/icu/ios/icudtl.dat",
202 203
  ]
  set_sources_assignment_filter(sources_assignment_filter)
204 205 206
  outputs = [
    "$_flutter_framework_dir/{{source_file_part}}",
  ]
207 208
}

209
copy("copy_framework_podspec") {
210 211 212 213 214 215 216 217 218
  visibility = [ ":*" ]
  sources = [
    "framework/Flutter.podspec",
  ]
  outputs = [
    "$root_out_dir/Flutter.podspec",
  ]
}

219 220 221 222 223 224 225 226 227 228
copy("copy_license") {
  visibility = [ ":*" ]
  sources = [
    "//LICENSE",
  ]
  outputs = [
    "$root_out_dir/LICENSE",
  ]
}

229 230 231 232 233 234 235 236 237 238 239
shared_library("copy_and_verify_framework_headers") {
  visibility = [ ":*" ]
  include_dirs = [ "$_flutter_framework_headers_copy_dir" ]
  sources = [
    "framework/Source/FlutterUmbrellaImport.m",
  ]
  deps = [
    ":copy_framework_headers",
  ]
}

240
group("flutter_framework") {
241 242 243 244 245 246 247
  deps = [
    ":copy_and_verify_framework_headers",
    ":copy_dylib_and_update_framework_install_name",
    ":copy_framework_icu",
    ":copy_framework_info_plist",
    ":copy_framework_module_map",
    ":copy_framework_podspec",
248
    ":copy_license",
249 250
  ]
}