BUILD.gn 7.1 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
import("//build/config/ios/ios_sdk.gni")
9
import("$flutter_root/shell/gpu/gpu.gni")
10

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

13 14 15 16 17 18
shell_gpu_configuration("ios_gpu_configuration") {
  enable_software = true
  enable_gl = true
  enable_vulkan = false
}

19 20 21 22 23 24
# 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",
25
  "framework/Headers/FlutterCallbackCache.h",
26 27 28
  "framework/Headers/FlutterChannels.h",
  "framework/Headers/FlutterCodecs.h",
  "framework/Headers/FlutterDartProject.h",
29
  "framework/Headers/FlutterHeadlessDartRunner.h",
30 31 32
  "framework/Headers/FlutterMacros.h",
  "framework/Headers/FlutterNavigationController.h",
  "framework/Headers/FlutterPlugin.h",
33
  "framework/Headers/FlutterPluginAppLifeCycleDelegate.h",
34
  "framework/Headers/FlutterTexture.h",
35 36 37 38 39 40
  "framework/Headers/FlutterViewController.h",
]

_flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers"

shared_library("create_flutter_framework_dylib") {
41 42 43 44 45 46
  visibility = [ ":*" ]

  output_name = "Flutter"

  sources = [
    "framework/Source/FlutterAppDelegate.mm",
47 48
    "framework/Source/FlutterAppDelegate_Internal.h",
    "framework/Source/FlutterCallbackCache.mm",
49 50
    "framework/Source/FlutterChannels.mm",
    "framework/Source/FlutterCodecs.mm",
51
    "framework/Source/FlutterDartProject.mm",
52
    "framework/Source/FlutterDartProject_Internal.h",
53
    "framework/Source/FlutterHeadlessDartRunner.mm",
54
    "framework/Source/FlutterNavigationController.mm",
55 56
    "framework/Source/FlutterPlatformPlugin.h",
    "framework/Source/FlutterPlatformPlugin.mm",
57
    "framework/Source/FlutterPluginAppLifeCycleDelegate.mm",
58 59
    "framework/Source/FlutterStandardCodec.mm",
    "framework/Source/FlutterStandardCodec_Internal.h",
60 61 62
    "framework/Source/FlutterTextInputDelegate.h",
    "framework/Source/FlutterTextInputPlugin.h",
    "framework/Source/FlutterTextInputPlugin.mm",
63 64 65
    "framework/Source/FlutterView.h",
    "framework/Source/FlutterView.mm",
    "framework/Source/FlutterViewController.mm",
66
    "framework/Source/FlutterViewController_Internal.h",
67 68
    "framework/Source/accessibility_bridge.h",
    "framework/Source/accessibility_bridge.mm",
Y
Yegor 已提交
69 70
    "framework/Source/accessibility_text_entry.h",
    "framework/Source/accessibility_text_entry.mm",
71 72
    "framework/Source/flutter_touch_mapper.h",
    "framework/Source/flutter_touch_mapper.mm",
73 74
    "framework/Source/platform_message_response_darwin.h",
    "framework/Source/platform_message_response_darwin.mm",
75 76
    "framework/Source/platform_message_router.h",
    "framework/Source/platform_message_router.mm",
77 78
    "framework/Source/vsync_waiter_ios.h",
    "framework/Source/vsync_waiter_ios.mm",
79 80
    "headless_platform_view_ios.h",
    "headless_platform_view_ios.mm",
81 82
    "ios_external_texture_gl.h",
    "ios_external_texture_gl.mm",
83 84 85 86 87 88 89 90
    "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",
91 92 93
    "platform_view_ios.h",
    "platform_view_ios.mm",
  ]
94

95 96
  sources += _flutter_framework_headers

97
  deps = [
98
    ":ios_gpu_configuration",
J
Jason Simmons 已提交
99
    "$flutter_root/common",
100 101 102
    "$flutter_root/flow",
    "$flutter_root/fml",
    "$flutter_root/lib/ui",
103
    "$flutter_root/runtime",
104 105
    "$flutter_root/shell/common",
    "$flutter_root/shell/platform/darwin/common",
106
    "//third_party/skia",
J
Jason Simmons 已提交
107
    "//third_party/skia:gpu",
108
  ]
109 110 111
  if (flutter_runtime_mode == "debug" ||
      flutter_runtime_mode == "dynamic_profile" ||
      flutter_runtime_mode == "dynamic_release") {
112 113 114 115
    deps += [
      "$flutter_root/lib/snapshot",
      "//third_party/dart/runtime:libdart_jit",
    ]
116
  } else {
117
    deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
118
  }
119

120
  public_configs = [ "$flutter_root:config" ]
121

122
  defines = [ "FLUTTER_FRAMEWORK" ]
123 124

  libs = [
125 126
    "CoreMedia.framework",
    "CoreVideo.framework",
127 128 129 130 131 132 133
    "UIKit.framework",
    "OpenGLES.framework",
    "AudioToolbox.framework",
    "QuartzCore.framework",
  ]
}

134
copy("copy_framework_dylib") {
135
  visibility = [ ":*" ]
136

137 138 139 140 141 142
  sources = [
    "$root_out_dir/libFlutter.dylib",
  ]
  outputs = [
    "$_flutter_framework_dir/Flutter",
  ]
143 144

  deps = [
145
    ":create_flutter_framework_dylib",
146 147 148
  ]
}

149
action("copy_dylib_and_update_framework_install_name") {
150 151
  visibility = [ ":*" ]
  stamp_file = "$root_out_dir/flutter_install_name_stamp"
152
  script = "$flutter_root/sky/tools/change_install_name.py"
153

154 155 156 157 158 159
  inputs = [
    "$_flutter_framework_dir/Flutter",
  ]
  outputs = [
    stamp_file,
  ]
160 161 162 163 164 165 166 167 168 169 170

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

  deps = [
171
    ":copy_framework_dylib",
172 173 174
  ]
}

175
copy("copy_framework_info_plist") {
176
  visibility = [ ":*" ]
177 178 179 180 181 182
  sources = [
    "framework/Info.plist",
  ]
  outputs = [
    "$_flutter_framework_dir/Info.plist",
  ]
183 184
}

185
copy("copy_framework_module_map") {
186
  visibility = [ ":*" ]
187 188 189 190 191 192
  sources = [
    "framework/module.modulemap",
  ]
  outputs = [
    "$_flutter_framework_dir/Modules/module.modulemap",
  ]
193
}
194

195 196
action("copy_framework_headers") {
  script = "$flutter_root/sky/tools/install_framework_headers.py"
197
  visibility = [ ":*" ]
198 199 200 201 202 203 204 205 206 207 208
  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)
209 210
}

211
copy("copy_framework_icu") {
212 213 214
  visibility = [ ":*" ]
  set_sources_assignment_filter([])
  sources = [
215
    "//third_party/icu/flutter/icudtl.dat",
216 217
  ]
  set_sources_assignment_filter(sources_assignment_filter)
218 219 220
  outputs = [
    "$_flutter_framework_dir/{{source_file_part}}",
  ]
221 222
}

223
copy("copy_framework_podspec") {
224 225 226 227 228 229 230 231 232
  visibility = [ ":*" ]
  sources = [
    "framework/Flutter.podspec",
  ]
  outputs = [
    "$root_out_dir/Flutter.podspec",
  ]
}

233 234 235 236 237 238 239 240 241 242
copy("copy_license") {
  visibility = [ ":*" ]
  sources = [
    "//LICENSE",
  ]
  outputs = [
    "$root_out_dir/LICENSE",
  ]
}

243 244 245 246 247 248 249 250 251 252 253
shared_library("copy_and_verify_framework_headers") {
  visibility = [ ":*" ]
  include_dirs = [ "$_flutter_framework_headers_copy_dir" ]
  sources = [
    "framework/Source/FlutterUmbrellaImport.m",
  ]
  deps = [
    ":copy_framework_headers",
  ]
}

254
group("flutter_framework") {
255 256 257 258 259 260 261
  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",
262
    ":copy_license",
263 264
  ]
}