# Copyright 2013 The Flutter 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("//build/config/ios/ios_sdk.gni") import("//flutter/build/darwin/ios_app.gni") import("//flutter/common/config.gni") import("//flutter/shell/gpu/gpu.gni") import("//flutter/shell/platform/darwin/common/framework_shared.gni") import("//flutter/testing/testing.gni") _flutter_framework_dir = "$root_out_dir/Flutter.framework" shell_gpu_configuration("ios_gpu_configuration") { enable_software = true enable_gl = true enable_vulkan = false enable_metal = shell_enable_metal } # 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/FlutterCallbackCache.h", "framework/Headers/FlutterDartProject.h", "framework/Headers/FlutterEngine.h", "framework/Headers/FlutterHeadlessDartRunner.h", "framework/Headers/FlutterPlatformViews.h", "framework/Headers/FlutterPlugin.h", "framework/Headers/FlutterPluginAppLifeCycleDelegate.h", "framework/Headers/FlutterViewController.h", ] _flutter_framework_headers_copy_dir = "$_flutter_framework_dir/Headers" shared_library("create_flutter_framework_dylib") { visibility = [ ":*" ] output_name = "Flutter" ldflags = [ "-Wl,-install_name,@rpath/Flutter.framework/Flutter" ] public = _flutter_framework_headers sources = [ "framework/Source/FlutterAppDelegate.mm", "framework/Source/FlutterBinaryMessengerRelay.mm", "framework/Source/FlutterCallbackCache.mm", "framework/Source/FlutterCallbackCache_Internal.h", "framework/Source/FlutterDartProject.mm", "framework/Source/FlutterDartProject_Internal.h", "framework/Source/FlutterEngine.mm", "framework/Source/FlutterEngine_Internal.h", "framework/Source/FlutterHeadlessDartRunner.mm", "framework/Source/FlutterObservatoryPublisher.h", "framework/Source/FlutterObservatoryPublisher.mm", "framework/Source/FlutterOverlayView.h", "framework/Source/FlutterOverlayView.mm", "framework/Source/FlutterPlatformPlugin.h", "framework/Source/FlutterPlatformPlugin.mm", "framework/Source/FlutterPlatformViews.mm", "framework/Source/FlutterPlatformViews_Internal.h", "framework/Source/FlutterPlatformViews_Internal.mm", "framework/Source/FlutterPluginAppLifeCycleDelegate.mm", "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/FlutterViewController_Internal.h", "framework/Source/accessibility_bridge.h", "framework/Source/accessibility_bridge.mm", "framework/Source/accessibility_text_entry.h", "framework/Source/accessibility_text_entry.mm", "framework/Source/platform_message_response_darwin.h", "framework/Source/platform_message_response_darwin.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_context.h", "ios_context.mm", "ios_context_gl.h", "ios_context_gl.mm", "ios_context_software.h", "ios_context_software.mm", "ios_external_texture_gl.h", "ios_external_texture_gl.mm", "ios_render_target_gl.h", "ios_render_target_gl.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", "rendering_api_selection.h", "rendering_api_selection.mm", ] sources += _flutter_framework_headers deps = [ ":ios_gpu_configuration", "//flutter/common", "//flutter/flow", "//flutter/fml", "//flutter/lib/ui", "//flutter/runtime", "//flutter/runtime:libdart", "//flutter/shell/common", "//flutter/shell/platform/darwin/common", "//flutter/shell/platform/darwin/common:framework_shared", "//third_party/skia", ] public_configs = [ "//flutter:config" ] defines = [ "FLUTTER_FRAMEWORK=1" ] if (shell_enable_metal) { defines += [ "FLUTTER_SHELL_ENABLE_METAL=1" ] sources += [ "ios_context_metal.h", "ios_context_metal.mm", "ios_external_texture_metal.h", "ios_external_texture_metal.mm", "ios_surface_metal.h", "ios_surface_metal.mm", ] } libs = [ "CoreMedia.framework", "CoreVideo.framework", "UIKit.framework", "OpenGLES.framework", "AudioToolbox.framework", "QuartzCore.framework", ] } copy("copy_dylib") { visibility = [ ":*" ] sources = [ "$root_out_dir/libFlutter.dylib", ] outputs = [ "$_flutter_framework_dir/Flutter", ] deps = [ ":create_flutter_framework_dylib", ] } action("copy_framework_info_plist") { script = "//flutter/build/copy_info_plist.py" visibility = [ ":*" ] sources = [ "framework/Info.plist", ] outputs = [ "$_flutter_framework_dir/Info.plist", ] args = [ rebase_path(sources[0]), rebase_path(outputs[0]), "--bitcode=$flutter_enable_bitcode", ] } copy("copy_framework_module_map") { visibility = [ ":*" ] sources = [ "framework/module.modulemap", ] outputs = [ "$_flutter_framework_dir/Modules/module.modulemap", ] } action("copy_framework_headers") { script = "//flutter/sky/tools/install_framework_headers.py" visibility = [ ":*" ] sources = get_path_info(_flutter_framework_headers, "abspath") + framework_shared_headers outputs = [] foreach(header, sources) { header_basename = get_path_info(header, "file") outputs += [ "$_flutter_framework_headers_copy_dir/$header_basename" ] } args = [ "--location", rebase_path("$_flutter_framework_headers_copy_dir"), "--headers", ] + rebase_path(sources, "", "//") } copy("copy_framework_icu") { visibility = [ ":*" ] sources = [ "//third_party/icu/flutter/icudtl.dat", ] outputs = [ "$_flutter_framework_dir/{{source_file_part}}", ] } copy("copy_framework_podspec") { visibility = [ ":*" ] sources = [ "framework/Flutter.podspec", ] outputs = [ "$root_out_dir/Flutter.podspec", ] } copy("copy_license") { visibility = [ ":*" ] sources = [ "//LICENSE", ] outputs = [ "$root_out_dir/LICENSE", ] } shared_library("copy_and_verify_framework_headers") { visibility = [ ":*" ] include_dirs = [ "$_flutter_framework_headers_copy_dir" ] sources = [ "framework/Source/FlutterUmbrellaImport.m", ] deps = [ ":copy_framework_headers", ] } test_fixtures("flutter_tests_fixtures") { fixtures = [] } ios_app("FlutterTests") { testonly = true info_plist = "FlutterTestsInfo.plist" sources = [ "flutter_unittests.mm", ] libs = [ "Foundation.framework" ] deps = [ ":flutter_tests_fixtures", "//flutter/runtime:libdart", "//flutter/testing", ] } group("flutter_framework") { deps = [ ":copy_and_verify_framework_headers", ":copy_dylib", ":copy_framework_icu", ":copy_framework_info_plist", ":copy_framework_module_map", ":copy_framework_podspec", ":copy_license", ] }