From 9dfa087e92ec0a6af2e2f0ffd46ed742d3a94aa6 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 8 Mar 2016 12:34:24 -0800 Subject: [PATCH] iOS: Export symbols for public API from the framework dylib --- sky/shell/BUILD.gn | 96 +++++++++++-------- sky/shell/platform/ios/public/FlutterMacros.h | 18 ++++ .../ios/public/FlutterViewController.h | 3 + 3 files changed, 79 insertions(+), 38 deletions(-) create mode 100644 sky/shell/platform/ios/public/FlutterMacros.h diff --git a/sky/shell/BUILD.gn b/sky/shell/BUILD.gn index 01f7713b7c6..ca12e944af2 100644 --- a/sky/shell/BUILD.gn +++ b/sky/shell/BUILD.gn @@ -233,52 +233,72 @@ if (is_android) { import("//build/config/ios/ios_sdk.gni") import("//sky/build/sky_precompilation_sdk.gni") - source_set("ios_scaffolding") { - sources = [ - "platform/ios/flutter_app_delegate.h", - "platform/ios/flutter_app_delegate.mm", - "platform/ios/flutter_dynamic_service_loader.h", - "platform/ios/flutter_dynamic_service_loader.mm", - "platform/ios/flutter_touch_mapper.h", - "platform/ios/flutter_touch_mapper.mm", - "platform/ios/flutter_view.h", - "platform/ios/flutter_view.mm", - "platform/ios/flutter_view_controller.mm", - "platform/ios/main_ios.mm", - "platform/ios/public/FlutterViewController.h", - ] + template("scaffolding") { + assert(defined(invoker.is_framework), + "Must specific if the scaffolding is exposed as a framework") - set_sources_assignment_filter([]) - sources += [ - "platform/mac/platform_mac.h", - "platform/mac/platform_mac.mm", - "platform/mac/platform_service_provider.cc", - "platform/mac/platform_service_provider.h", - "platform/mac/platform_view_mac.h", - "platform/mac/platform_view_mac.mm", - ] - set_sources_assignment_filter(sources_assignment_filter) + source_set(target_name) { + sources = [ + "platform/ios/flutter_app_delegate.h", + "platform/ios/flutter_app_delegate.mm", + "platform/ios/flutter_dynamic_service_loader.h", + "platform/ios/flutter_dynamic_service_loader.mm", + "platform/ios/flutter_touch_mapper.h", + "platform/ios/flutter_touch_mapper.mm", + "platform/ios/flutter_view.h", + "platform/ios/flutter_view.mm", + "platform/ios/flutter_view_controller.mm", + "platform/ios/main_ios.mm", + "platform/ios/public/FlutterMacros.h", + "platform/ios/public/FlutterViewController.h", + ] - deps = [ - "//mojo/edk/base_edk", - "//mojo/edk/system", - "//sky/services/activity", - "//sky/services/dynamic:embedder", - "//sky/services/editing", - "//sky/services/media", - "//sky/services/ns_net", - "//sky/services/vsync", - "//ui/gl", - ":common", - ":gpu_direct", - ] + set_sources_assignment_filter([]) + sources += [ + "platform/mac/platform_mac.h", + "platform/mac/platform_mac.mm", + "platform/mac/platform_service_provider.cc", + "platform/mac/platform_service_provider.h", + "platform/mac/platform_view_mac.h", + "platform/mac/platform_view_mac.mm", + ] + set_sources_assignment_filter(sources_assignment_filter) + + deps = [ + "//mojo/edk/base_edk", + "//mojo/edk/system", + "//sky/services/activity", + "//sky/services/dynamic:embedder", + "//sky/services/editing", + "//sky/services/media", + "//sky/services/ns_net", + "//sky/services/vsync", + "//ui/gl", + ":common", + ":gpu_direct", + ] + + if (invoker.is_framework) { + defines = [ + "FLUTTER_FRAMEWORK" + ] + } + } + } + + scaffolding("ios_scaffolding") { + is_framework = false } shared_library("flutter_framework") { output_name = "libFlutter" + scaffolding("framework_scaffolding") { + is_framework = true + } + deps = [ - ":ios_scaffolding" + ":framework_scaffolding" ] libs = [ diff --git a/sky/shell/platform/ios/public/FlutterMacros.h b/sky/shell/platform/ios/public/FlutterMacros.h new file mode 100644 index 00000000000..06da54a873e --- /dev/null +++ b/sky/shell/platform/ios/public/FlutterMacros.h @@ -0,0 +1,18 @@ +// 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. + +#ifndef FLUTTER_FLUTTERMACROS_H_ +#define FLUTTER_FLUTTERMACROS_H_ + +#if defined(FLUTTER_FRAMEWORK) + +#define FLUTTER_EXPORT __attribute__((visibility("default"))) + +#else // defined(FLUTTER_SDK) + +#define FLUTTER_EXPORT + +#endif // defined(FLUTTER_SDK) + +#endif // FLUTTER_FLUTTERMACROS_H_ diff --git a/sky/shell/platform/ios/public/FlutterViewController.h b/sky/shell/platform/ios/public/FlutterViewController.h index e3506ba0cf2..d34c9119177 100644 --- a/sky/shell/platform/ios/public/FlutterViewController.h +++ b/sky/shell/platform/ios/public/FlutterViewController.h @@ -5,8 +5,11 @@ #ifndef FLUTTER_FLUTTERVIEWCONTROLLER_H_ #define FLUTTER_FLUTTERVIEWCONTROLLER_H_ +#include "FlutterMacros.h" + #import +FLUTTER_EXPORT @interface FlutterViewController : UIViewController /**