/ios-cmake

A CMake toolchain file for iOS and tvOS development (this is a fork of a similar project found on code.google.com)

Primary LanguageCMakeBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

A CMake toolchain file for iOS and tvOS development

ios-cmake

Build Status

Tested with the following combinations:

  • XCode 5.x, iOS SDK 7
  • XCode 6.1.x, iOS SDK 8.1
  • XCode 8.2.x, iOS SDK 10.2
  • XCode 9.2.x, iOS SDK 11.2

Example usage

NOTE: 64-bit simulator ONLY! Change the -DIOS_PLATFORM to applicable value if targeting other platform.

cd example
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64
make
make install

This will create an XCode project in build directory where the example can be modified.

Options

  • Set -DIOS_PLATFORM to "SIMULATOR" (example above) to build for iOS simulator 32 bit (i386)
  • Set -DIOS_PLATFORM to "SIMULATOR64" to build for iOS simulator 64 bit (x86_64)
  • Set -DIOS_PLATFORM to "OS" to build for Device (armv7, armv7s, arm64)
  • Set -DIOS_PLATFORM to "TVOS" to build for tvOS (arm64)
  • Set -DIOS_PLATFORM to "SIMULATOR_TVOS" to build for tvOS Simulator (x86_64)

Additional Options

-DENABLE_BITCODE=(BOOL) - Enabled by default, specify FALSE or 0 to disable

-DENABLE_ARC=(BOOL) - Enabled by default, specify FALSE or 0 to disable

-DIOS_ARCH=(STRING) - Valid values are: armv7, armv7s, arm64, i386, x86_64. By default builds for all valid architectures based off DIOS_PLATFORM (see above)

The resulting binary will be a fat library. To combine all platforms into the same, use the LIPO tool. More information on this is available on the net.

Thanks To

  • natbro for adding tvOS support