Giter Club home page Giter Club logo

Comments (10)

ruslo avatar ruslo commented on May 25, 2024

Try to install headers to include directory. Explanation: this is workaround script which expect only one file in lib folder (which should be the *.a library) so when there are some other files script can't decide what file is a library.

Just for your information there are few fixes in latest CMake version that allow creating frameworks without hacks/workarounds (just using CMake). I haven't tried it yet, but if it works okay --framework option will be removed.

from polly.

novocodev avatar novocodev commented on May 25, 2024

Still using make 3.3

cmake_minimum_required(VERSION 3.3)

I added the FRAMEWORK property

set_target_properties(
        foo PROPERTIES
        FRAMEWORK TRUE
        PUBLIC_HEADER public.h)

Then I built using the following command

./buildtools/polly/bin/build.py --clear --toolchain xcode

This created a Framework with 'public.h' in the Headers folder located at:

_builds/xcode/Debug/foo.framework

But this only appears to be a MAC OS X framework not a fat Framework, I ran the file command:

file _builds/xcode/Debug/foo.framework/foo

result was:

Mach-O 64-bit dynamically linked shared library x86_64

I also tried --toolchain ios-9-2 but the framework still appears to be created only for x86_64

from polly.

ruslo avatar ruslo commented on May 25, 2024

But this only appears to be a MAC OS X framework not a fat Framework

This is by design. Fat library created only for iOS.

I also tried --toolchain ios-9-2 but the framework still appears to be created only for x86_64

I will test latest CMake version with few improvements, may be will create an example.

from polly.

ruslo avatar ruslo commented on May 25, 2024

What is the correct way to configure the public headers for a framework build

Okay, I think I know what is the problem here. --framework option expect headers be located in directory <install-prefix>/include/<frameworkname>. I.e. if you have library libfoo.dylib installed, then headers should be located in <install-prefix>/include/foo and will be moved to foo.framework/Headers. The reason of this is that project which uses foo should do #include <foo/*.hpp> in both variants. I've added warning to build.py script, so you should see next message:

Warning: no headers found for framework (dir: /.../_install/ios-9-1-armv7/include/boo)

Which can be fixed by next CMake code:

install(FILES boo.hpp DESTINATION include/boo)

I also tried --toolchain ios-9-2 but the framework still appears to be created only for x86_64

Are you sure you're using patched CMake version?

from polly.

ruslo avatar ruslo commented on May 25, 2024

Example with framework and native Xcode project updated:

from polly.

novocodev avatar novocodev commented on May 25, 2024

Great! I have successfully built and linked the ios-dynamic-framework project.

I did have to use patched CMake version, I tried with the latest 3.5.0-rc2 CMake but that failed to build the Fat framework bundle.

I'm going to try and replicate the project setup to my own library repo.

from polly.

ruslo avatar ruslo commented on May 25, 2024

but that failed to build the Fat framework bundle

With CMake 3.5+ you have to use CMAKE_IOS_INSTALL_COMBINED=YES and CMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO and run install (no need to use --framework, now it's --install). However dynamic framework will not be signed properly so the last time I've tried it I failed to run bundle on real device.

from polly.

novocodev avatar novocodev commented on May 25, 2024

I have replicated the demo project setup on my own repo, I did not copy over the custom jenkins.py as I am just trying to build a dynamic library component, I am calling build.py directly with:

./buildtools/polly/bin/build.py --clear --toolchain ios-9-2 --framework --config Release

The build is successful and the lib binary now reports as a Fat lib and the public header is copied over to the framework/Headers folder.

I have noticed that if I build with --config Debug, that 'd' gets appended to the project name for all folders and files and it also causes the public header not to get copied to framework/Headers (unless I install it to an include/'d' folder.

Is there a way to prevent the 'd' suffix getting added and maybe create the framework under a debug or release folder depending on the --config value.

from polly.

ruslo avatar ruslo commented on May 25, 2024

Is there a way to prevent the 'd' suffix getting added

Set it in command line -DCMAKE_DEBUG_POSTFIX="", in terms of build.py script it will be --fwd CMAKE_DEBUG_POSTFIX=""

from polly.

novocodev avatar novocodev commented on May 25, 2024

Both iOS and OSX framework builds are working, thanks.

from polly.

Related Issues (20)

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.