# 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) import("$flutter_root/common/config.gni") import("//build/config/ios/ios_sdk.gni") _flutter_framework_dir = "$root_out_dir/Flutter.framework" # 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", "framework/Headers/FlutterHeadlessDartRunner.h", "framework/Headers/FlutterMacros.h", "framework/Headers/FlutterNavigationController.h", "framework/Headers/FlutterPlugin.h", "framework/Headers/FlutterTexture.h", "framework/Headers/FlutterViewController.h", ] _flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers" shared_library("create_flutter_framework_dylib") { visibility = [ ":*" ] output_name = "Flutter" sources = [ "framework/Source/FlutterAppDelegate.mm", "framework/Source/FlutterChannels.mm", "framework/Source/FlutterCodecs.mm", "framework/Source/FlutterDartProject.mm", "framework/Source/FlutterDartProject_Internal.h", "framework/Source/FlutterHeadlessDartRunner.mm", "framework/Source/FlutterDartSource.h", "framework/Source/FlutterDartSource.mm", "framework/Source/FlutterNavigationController.mm", "framework/Source/FlutterPlatformPlugin.h", "framework/Source/FlutterPlatformPlugin.mm", "framework/Source/FlutterStandardCodec.mm", "framework/Source/FlutterStandardCodec_Internal.h", "framework/Source/FlutterTextInputDelegate.h", "framework/Source/FlutterTextInputPlugin.h", "framework/Source/FlutterTextInputPlugin.mm", "framework/Source/FlutterView.h", "framework/Source/FlutterView.mm", "framework/Source/FlutterViewController.mm", "framework/Source/accessibility_bridge.h", "framework/Source/accessibility_bridge.mm", "framework/Source/flutter_main_ios.h", "framework/Source/flutter_main_ios.mm", "framework/Source/flutter_touch_mapper.h", "framework/Source/flutter_touch_mapper.mm", "framework/Source/platform_message_router.h", "framework/Source/platform_message_router.mm", "framework/Source/vsync_waiter_ios.h", "framework/Source/vsync_waiter_ios.mm", "ios_external_texture_gl.h", "ios_external_texture_gl.mm", "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", "platform_view_ios.h", "platform_view_ios.mm", ] sources += _flutter_framework_headers deps = [ "$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", "//garnet/public/lib/fxl", "//third_party/skia", ] if (flutter_runtime_mode == "debug") { deps += [ "//third_party/dart/runtime:libdart_jit" ] } else { deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] } public_configs = [ "$flutter_root:config" ] defines = [ "FLUTTER_FRAMEWORK" ] libs = [ "CoreMedia.framework", "CoreVideo.framework", "UIKit.framework", "OpenGLES.framework", "AudioToolbox.framework", "QuartzCore.framework", ] } copy("copy_framework_dylib") { visibility = [ ":*" ] sources = [ "$root_out_dir/libFlutter.dylib", ] outputs = [ "$_flutter_framework_dir/Flutter", ] deps = [ ":create_flutter_framework_dylib", ] } action("copy_dylib_and_update_framework_install_name") { visibility = [ ":*" ] stamp_file = "$root_out_dir/flutter_install_name_stamp" script = "$flutter_root/sky/tools/change_install_name.py" inputs = [ "$_flutter_framework_dir/Flutter", ] outputs = [ stamp_file, ] args = [ "--dylib", rebase_path("$_flutter_framework_dir/Flutter"), "--install_name", "@rpath/Flutter.framework/Flutter", "--stamp", rebase_path(stamp_file), ] deps = [ ":copy_framework_dylib", ] } copy("copy_framework_info_plist") { visibility = [ ":*" ] sources = [ "framework/Info.plist", ] outputs = [ "$_flutter_framework_dir/Info.plist", ] } copy("copy_framework_module_map") { visibility = [ ":*" ] sources = [ "framework/module.modulemap", ] outputs = [ "$_flutter_framework_dir/Modules/module.modulemap", ] } action("copy_framework_headers") { script = "$flutter_root/sky/tools/install_framework_headers.py" visibility = [ ":*" ] 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) } copy("copy_framework_icu") { visibility = [ ":*" ] set_sources_assignment_filter([]) sources = [ "//third_party/icu/ios/icudtl.dat", ] set_sources_assignment_filter(sources_assignment_filter) outputs = [ "$_flutter_framework_dir/{{source_file_part}}", ] } copy("copy_framework_podspec") { visibility = [ ":*" ] sources = [ "framework/Flutter.podspec", ] outputs = [ "$root_out_dir/Flutter.podspec", ] } shared_library("copy_and_verify_framework_headers") { visibility = [ ":*" ] include_dirs = [ "$_flutter_framework_headers_copy_dir" ] sources = [ "framework/Source/FlutterUmbrellaImport.m", ] deps = [ ":copy_framework_headers", ] } group("flutter_framework") { 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", ] }