Giter VIP home page Giter VIP logo

ios-autotools's Introduction

Autotools helpers for iOS

Helper tools for cross-compilation of autotools libraries for iOS (and simulator) on OS X. All libraries are static, since iOS does not support linking of custom dynamic libraries.

You will have to install automake, autoconf and libtool via your favorite mechanism (compile from source, homebrew, macports, ...).

Usage: iconfigure

To configure a library for a specific architecture run iconfigure in the directory containing the configure script.

iconfigure armv7|armv7s|arm64|i686|x86_64

This will set up the environment for cross-compiling for the specified architecture. You can then proceed as usual by running make and make install. make install will default to install your libraries system-wide in /opt/ so that you can use them in multiple projects.

All this can be configured by setting the following variables:

 SDKVERSION   e.g.: 7.1
 PREFIX       e.g.: /User/Home/project/staticlib

And the typical compiler flags:

CFLAGS CPPFLAGS CXXFLAGS LDFLAGS PKG_CONFIG_PATH

For more variables and their functionality see the usage instructions and/or read the source code.

For example to build a library locally in your project targeting the iOS SDK version 7.1 on armv7 run:

SDKVERSION=7.1 PREFIX=/User/Home/project/staticlib iconfigure armv7
make
make install

Usage: autoframework

To build an iOS framework for all architectures run autoframework in the directory containing the configure script.

This will create two directories Static and Frameworks. Static will contain one subdirectory for each architecture, each containing all installation targets for that architecture. Frameworks will contain the resulting multiarch framework.

autoframework MyLib libmylib.a

As with iconfigure there are a few optional settings:

ARCHS    e.g. armv7 armv7s
PREFIX   e.g. /User/Home/project

For example for building your framework locally for armv7 and armv7s you could run:

ARCHS="armv7 armv7s" PREFIX=/User/Home/project autoframework MyLib libmylib.a

External build system

While Xcode does not directly support autotools it has support for plain Makefiles. You can use this to build all your libraries within your project automatically.

Add a new External Build System target to your project (File > New > Target > OS X > Other > External Build System). Enter a name like StaticLibs and create a Makefile in the top level of your project:

ARCHS="armv7 armv7s arm64 i686 x86_64"
FRAMEWORKS = Frameworks/MyLib.framework

all: $(FRAMEWORKS)

Frameworks/MyLib.framework: mylib
  cd $< && ./autogen.sh
  # $(PROJECT_DIR)  set by Xcode
  # $(ARCHS)        set by Xcode, but sadly does not include all target architectures
  cd $< && PREFIX=$(PROJECT_DIR) ARCHS=$(ARCHS) autoframework MyLib libmylib.a

Be aware that Xcode itself does set the ARCHS variable to an incorrect value. We therefore have to override the value by manually specifying the desired architectures in the Makefile.

Now add the new target to the dependencies of your main project and build. You should now be able to either add your libraries either by adding the desired frameworks in Frameworks/ or by adding Static/{include,lib} to the paths in your main project and setting the appropriate linker flags.

Depending on where you installed your autotools suite you might have to adjust the PATH variable in your new target. Go to: Build Settings > + > Add User-Defined Setting and enter PATH with the value $PATH:/usr/local/bin (or wherever your tools are located).

License

ISC license, see the LICENSE file for more details.

Origins

Inspired by the initial iOS-autoconf scripts of intlres1 and sbooth.

ios-autotools's People

Contributors

szanni 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.