How to build Boost-Libraries for iPhone

2019-01-11 03:47发布

问题:

Can someone tell me, where to find a detailed guide, how to build the Boost-Libraries for using it on the iPhone-Device.

I've allready build the libs for Mac and can use them in my project (only on iPhone-Simulator). While building the project for iPhone-Device, XCode haunts me a warning: "file is not of required architecture" ond some other errors.

Please Help

回答1:

Start a new project in Xcode using the iPhone Static Library project template. Then import the source and headers, and compile it that way. The result should be an iPhone compatible static library



回答2:

I started here: http://lists.boost.org/boost-build/2009/02/21326.php

With most of Boost you probably don't need to actually compile it, just include the useful headers. In my case, I just did the compiler define in my own Xcode project.



回答3:

Hey I have updated Pete Goodliffes script in my openFrameworks addon:

  • It currently has arm64, armv7, i386, x86_64
  • Boost 1.59.0 or previous
  • libc++ / std=c++11 -- Now optional release for libstdc++
  • Precompiled and Script to build yourself (so if you need libstdc++ quite easy to change)
    • Supports Xcode 7

[https://github.com/danoli3/ofxiOSBoost][1]



回答4:

We use boost too. To simplify its inclusion into new applications I have created a Xcode project you can drop into your workspace to include boost. It is based on a Makefile so you need the Xcode commandline tools installed.

The project is here https://github.com/Cogosense/iOSBoostFramework.

Clone the project into your workspace, then click on Menu File->"Add Files to workspace". Select iOSBoostFramework/iOSBoostFramework.xcodeproj in the file finder and click add.

The Makefile in the iOSBoostFramework directory controls what is built and how it is built. There is support for Xcode workspace dependencies, bitcode generation, and only the target architectures selected by Xcode are built.

The following libraries are built test, thread, atomic, signals, filesystem, regex, program_options, system date_time, serialization, exception, locale, and random.

All the separate libraries and architectures are combined, the final build output is a FAT boost.framework Framework bundle which can be linked into the application.

The version of boost is specified in the Makefile (currently 1.64.0), it is downloaded, built for all active architectures and installed in the BUILT_PRODUCTS_DIR specified by xcode.