🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.2 KiB

  1. CMake
  2. ================================================================================
  3. (www.cmake.org)
  4. SDL's build system was traditionally based on autotools. Over time, this
  5. approach has suffered from several issues across the different supported
  6. platforms.
  7. To solve these problems, a new build system based on CMake is under development.
  8. It works in parallel to the legacy system, so users can experiment with it
  9. without complication.
  10. While still experimental, the build system should be usable on the following
  11. platforms:
  12. * FreeBSD
  13. * Linux
  14. * VS.NET 2010
  15. * MinGW and Msys
  16. * macOS, iOS, and tvOS, with support for XCode
  17. ================================================================================
  18. Usage
  19. ================================================================================
  20. Assuming the source for SDL is located at ~/sdl
  21. cd ~
  22. mkdir build
  23. cd build
  24. cmake ../sdl
  25. This will build the static and dynamic versions of SDL in the ~/build directory.
  26. ================================================================================
  27. Usage, iOS/tvOS
  28. ================================================================================
  29. CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
  30. using Xcode or Make, possibly among other build-systems.
  31. When using a recent version of CMake (3.14+), it should be possible to:
  32. - build SDL for iOS, both static and dynamic
  33. - build SDL test apps (as iOS/tvOS .app bundles)
  34. - generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
  35. To use, set the following CMake variables when running CMake's configuration stage:
  36. - `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
  37. - `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
  38. `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
  39. - `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
  40. ### Examples (for iOS/tvOS):
  41. - for iOS-Simulator, using the latest, installed SDK:
  42. `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
  43. - for iOS-Device, using the latest, installed SDK, 64-bit only
  44. `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64`
  45. - for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
  46. `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"`
  47. - for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
  48. `cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64`
  49. - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
  50. `cmake ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
  51. - for tvOS-Simulator, using the latest, installed SDK:
  52. `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64`
  53. - for tvOS-Device, using the latest, installed SDK:
  54. `cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`