docs/README-cmake.md
changeset 13087 76ff33e9a6b4
parent 10486 5bf595c48fd4
child 13088 d55db8d27108
equal deleted inserted replaced
13086:144fc4e62b72 13087:76ff33e9a6b4
    13 
    13 
    14 * FreeBSD
    14 * FreeBSD
    15 * Linux
    15 * Linux
    16 * VS.NET 2010
    16 * VS.NET 2010
    17 * MinGW and Msys
    17 * MinGW and Msys
    18 * OS X with support for XCode
    18 * macOS, iOS, and tvOS, with support for XCode
    19 
    19 
    20 
    20 
    21 ================================================================================
    21 ================================================================================
    22 Usage
    22 Usage
    23 ================================================================================
    23 ================================================================================
    28     mkdir build
    28     mkdir build
    29     cd build
    29     cd build
    30     cmake ../sdl
    30     cmake ../sdl
    31 
    31 
    32 This will build the static and dynamic versions of SDL in the ~/build directory.
    32 This will build the static and dynamic versions of SDL in the ~/build directory.
       
    33 
       
    34 
       
    35 ================================================================================
       
    36 Usage, iOS/tvOS
       
    37 ================================================================================
       
    38 
       
    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.
       
    41 
       
    42 When using a recent version of CMake (3.14+), it should be possible to:
       
    43 
       
    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)
       
    47 
       
    48 To use, set the following CMake variables when running CMake's configuration stage:
       
    49 
       
    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")
       
    54 
       
    55 
       
    56 ### Examples (for iOS/tvOS):
       
    57 
       
    58 - for iOS-Simulator, using the latest, installed SDK:
       
    59 
       
    60     `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
       
    61 
       
    62 - for iOS-Device, using the latest, installed SDK, 64-bit only
       
    63 
       
    64     `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
       
    65 
       
    66 - for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
       
    67 
       
    68     `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
       
    69 
       
    70 - for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
       
    71 
       
    72     `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
       
    73 
       
    74 - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
       
    75 
       
    76     `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
       
    77 
       
    78 - for tvOS-Simulator, using the latest, installed SDK:
       
    79 
       
    80 	`cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
       
    81 
       
    82 - for tvOS-Device, using the latest, installed SDK:
       
    83 
       
    84 	`cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`