Giter Club home page Giter Club logo

ios-dynamic-framework's Introduction

  • Static libraries: foo, boo
  • Shared library bar (depends on foo and boo) -> Framework
  • Application baz load shared library bar (not working for iOS, TODO)
  • Native Xcode iOS project DynamicFrameworkUsageExample use bar.framework

Usage:

> ./jenkins.py --toolchain ios-8-2
> ls _framework/*/bar.framework

Adding framework to Xcode project

  • Open your Xcode project
  • Remove old bar.framework link if it's left from previous build
  • Add framework to the project: "File" -> "Add Files to ..." -> choose bar.framework
  • Copy framework: "Build Phases" -> "New Copy Files Phase" -> Set "Destination" to "Frameworks" -> "+" -> choose bar.framework -> "Add"
  • Modify Search Paths -> Framework Search Paths to relative path accodring to toolchain name you're using. E.g. ../_framework/ios-8-4 if you are using --toolchain ios-8-4 (if it's not set by Xcode automatically)

Note: dynamic frameworks available since iOS 8.0 (Xcode 6), see New Features in Xcode 6.

Headers

Project Bar installs bar.hpp header to <install-prefix>/include/bar/bar.hpp. So bar.hpp can be included by C++ directive #include <bar/bar.hpp> if used in a plain non-framework configuration. For frameworks location will be bar.framework/Headers/bar.hpp and can be included by the same C++ directive #include <bar/bar.hpp>.

Visibility

Default

Export all symbols (default):

> ./jenkins.py --toolchain ios-8-2-arm64
> nm -gU _framework/ios-8-2-arm64/bar.framework/bar
... T __Z3barv
... T __Z3boov # from static library boo
... T __Z3foov # from static library foo

File with exports

Exported symbols can be listed explicitly in file using -exported_symbols_list option:

> cat Bar/libbar.exports
__Z3barv
> ./jenkins.py --toolchain ios-8-2 --export-file
> nm -gU _framework/ios-8-2/bar.framework/bar
... T __Z3barv

Toolchain

Explicit export (export only BAR_EXPORT, all other symbols are hidden):

> ./jenkins.py --toolchain ios-8-2-arm64-hid
> nm -gU _framework/ios-8-2-arm64-hid/bar.framework/bar
... T __Z3barv # only bar visible

(achieved by adding -fvisibility=hidded and -fvisibility-inlines-hidded to CMAKE_CXX_FLAGS in toolchain)

foo and boo exist but not visible:

> otool -vt _framework/ios-8-2-arm64-hid/bar.framework/bar | grep "^__Z3\(foo\|boo\)"
__Z3foov:
__Z3boov:

App Store Submittion

Exclude simulator architectures (i386, x86_64) from framework by adding extra option --device (this will add --framework-device to build.py script) and open Xcode project:

> ./jenkins.py --device --toolchain ios-8-2
> open DynamicFrameworkUsageExample/DynamicFrameworkUsageExample.xcodeproj

Build, archive and submit application.

More

ios-dynamic-framework's People

Contributors

ruslo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.