Skip to content

A CMake toolchain file for iOS and tvOS C/C++/Obj-C++ development

License

Notifications You must be signed in to change notification settings

garryyan/ios-cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.4.x, iOS SDK 11.4
  • XCode 10.0.x, iOS SDK 12.0

Example usage

NOTE: The below commands will build for 64-bit simulator only. Change the -DIOS_PLATFORM to the applicable value if targeting another platform.

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

This will build and install the library for the given IOS_PLATFORM.

Options

  • Set -DIOS_PLATFORM to "SIMULATOR" to build for iOS simulator 32 bit (i386)
  • Set -DIOS_PLATFORM to "SIMULATOR64" (example above) 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 "OS64" to build for Device (arm64 only)
  • Set -DIOS_PLATFORM to "TVOS" to build for tvOS (arm64)
  • Set -DIOS_PLATFORM to "SIMULATOR_TVOS" to build for tvOS Simulator (x86_64)
  • Set -DIOS_PLATFORM to "WATCHOS" to build for watchOS (armv7k)
  • Set -DIOS_PLATFORM to "SIMULATOR_WATCHOS" to build for watchOS Simulator (i386)

Additional Options

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

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

-DENABLE_VISIBILITY=(BOOL) - Disabled by default, specify TRUE or 1 to enable symbol visibility support

-DIOS_ARCH=(STRING) - Valid values are: armv7, armv7s, arm64, i386, x86_64, armv7k, arm64_32. By default it will build for all valid architectures based on -DIOS_PLATFORM (see above)

The resulting binary will consist of only one platform. To combine all platforms into the same fat-library, use the LIPO tool. More information on this is available on the net.

Thanks To

Notes

Parts of the original toolchain comes from a similar project found on code.google.com

About

A CMake toolchain file for iOS and tvOS C/C++/Obj-C++ development

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CMake 81.5%
  • Objective-C 14.6%
  • C++ 1.7%
  • Shell 1.3%
  • Objective-C++ 0.9%