BUILD.gn 7.1 KB
Newer Older
M
Michael Goderbauer 已提交
1
# Copyright 2013 The Flutter Authors. All rights reserved.
2 3 4 5 6 7
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

assert(is_ios)

import("//build/config/ios/ios_sdk.gni")
8
import("$flutter_root/common/config.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",
D
Dan Field 已提交
29
  "framework/Headers/FlutterEngine.h",
30
  "framework/Headers/FlutterHeadlessDartRunner.h",
31
  "framework/Headers/FlutterMacros.h",
32
  "framework/Headers/FlutterPlatformViews.h",
33
  "framework/Headers/FlutterPlugin.h",
34
  "framework/Headers/FlutterPluginAppLifeCycleDelegate.h",
35
  "framework/Headers/FlutterTexture.h",
36 37 38 39 40 41
  "framework/Headers/FlutterViewController.h",
]

_flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers"

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

  output_name = "Flutter"

  sources = [
    "framework/Source/FlutterAppDelegate.mm",
48 49
    "framework/Source/FlutterAppDelegate_Internal.h",
    "framework/Source/FlutterCallbackCache.mm",
50
    "framework/Source/FlutterCallbackCache_Internal.h",
51 52
    "framework/Source/FlutterChannels.mm",
    "framework/Source/FlutterCodecs.mm",
53
    "framework/Source/FlutterDartProject.mm",
54
    "framework/Source/FlutterDartProject_Internal.h",
D
Dan Field 已提交
55 56
    "framework/Source/FlutterEngine.mm",
    "framework/Source/FlutterEngine_Internal.h",
57
    "framework/Source/FlutterHeadlessDartRunner.mm",
58 59
    "framework/Source/FlutterObservatoryPublisher.h",
    "framework/Source/FlutterObservatoryPublisher.mm",
60 61
    "framework/Source/FlutterOverlayView.h",
    "framework/Source/FlutterOverlayView.mm",
62 63
    "framework/Source/FlutterPlatformPlugin.h",
    "framework/Source/FlutterPlatformPlugin.mm",
64
    "framework/Source/FlutterPlatformViews.mm",
65
    "framework/Source/FlutterPlatformViews_Internal.h",
66
    "framework/Source/FlutterPlatformViews_Internal.mm",
67
    "framework/Source/FlutterPluginAppLifeCycleDelegate.mm",
68 69
    "framework/Source/FlutterStandardCodec.mm",
    "framework/Source/FlutterStandardCodec_Internal.h",
70 71 72
    "framework/Source/FlutterTextInputDelegate.h",
    "framework/Source/FlutterTextInputPlugin.h",
    "framework/Source/FlutterTextInputPlugin.mm",
73 74 75
    "framework/Source/FlutterView.h",
    "framework/Source/FlutterView.mm",
    "framework/Source/FlutterViewController.mm",
76
    "framework/Source/FlutterViewController_Internal.h",
77 78
    "framework/Source/accessibility_bridge.h",
    "framework/Source/accessibility_bridge.mm",
Y
Yegor 已提交
79 80
    "framework/Source/accessibility_text_entry.h",
    "framework/Source/accessibility_text_entry.mm",
81 82
    "framework/Source/platform_message_response_darwin.h",
    "framework/Source/platform_message_response_darwin.mm",
83 84
    "framework/Source/platform_message_router.h",
    "framework/Source/platform_message_router.mm",
85 86
    "framework/Source/vsync_waiter_ios.h",
    "framework/Source/vsync_waiter_ios.mm",
87 88
    "ios_external_texture_gl.h",
    "ios_external_texture_gl.mm",
89 90
    "ios_gl_context.h",
    "ios_gl_context.mm",
91 92
    "ios_gl_render_target.h",
    "ios_gl_render_target.mm",
93 94 95 96 97 98
    "ios_surface.h",
    "ios_surface.mm",
    "ios_surface_gl.h",
    "ios_surface_gl.mm",
    "ios_surface_software.h",
    "ios_surface_software.mm",
99 100 101
    "platform_view_ios.h",
    "platform_view_ios.mm",
  ]
102

103 104
  sources += _flutter_framework_headers

105
  deps = [
106
    ":ios_gpu_configuration",
J
Jason Simmons 已提交
107
    "$flutter_root/common",
108 109 110
    "$flutter_root/flow",
    "$flutter_root/fml",
    "$flutter_root/lib/ui",
111
    "$flutter_root/runtime",
112
    "$flutter_root/runtime:libdart",
113 114
    "$flutter_root/shell/common",
    "$flutter_root/shell/platform/darwin/common",
115
    "//third_party/skia",
116 117
  ]

118
  public_configs = [ "$flutter_root:config" ]
119

120
  defines = [ "FLUTTER_FRAMEWORK" ]
121 122

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

132
copy("copy_framework_dylib") {
133
  visibility = [ ":*" ]
134

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

  deps = [
143
    ":create_flutter_framework_dylib",
144 145 146
  ]
}

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

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

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

  deps = [
169
    ":copy_framework_dylib",
170 171 172
  ]
}

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

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

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

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

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

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

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

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