2 ================================================================================
5 SDL's build system was traditionally based on autotools. Over time, this
6 approach has suffered from several issues across the different supported
8 To solve these problems, a new build system based on CMake is under development.
9 It works in parallel to the legacy system, so users can experiment with it
11 While still experimental, the build system should be usable on the following
18 * macOS, iOS, and tvOS, with support for XCode
21 ================================================================================
23 ================================================================================
25 Assuming the source for SDL is located at ~/sdl
32 This will build the static and dynamic versions of SDL in the ~/build directory.
35 ================================================================================
37 ================================================================================
39 CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
40 using Xcode or Make, possibly among other build-systems.
42 When using a recent version of CMake (3.14+), it should be possible to:
44 - build SDL for iOS, both static and dynamic
45 - build SDL test apps (as iOS/tvOS .app bundles)
46 - generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
48 To use, set the following CMake variables when running CMake's configuration stage:
50 - `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
51 - `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
52 `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
53 - `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
56 ### Examples (for iOS/tvOS):
58 - for iOS-Simulator, using the latest, installed SDK:
60 `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
62 - for iOS-Device, using the latest, installed SDK, 64-bit only
64 `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
66 - for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
68 `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
70 - for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
72 `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
74 - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
76 `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
78 - for tvOS-Simulator, using the latest, installed SDK:
80 `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
82 - for tvOS-Device, using the latest, installed SDK:
84 `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`