macos.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #[=======================================================================[.rst:
  2. MacOS
  3. -----
  4. This file contains functions for options and configuration for targeting the
  5. MacOS platform
  6. Universal Builds
  7. ----------------
  8. To build universal binaries, ie targeting both x86_64 and arm64, use
  9. the CMAKE_OSX_ARCHITECTURES variable prior to any project calls.
  10. https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_ARCHITECTURES.html
  11. ]=======================================================================]
  12. # Find Requirements
  13. if(APPLE)
  14. set(CMAKE_OSX_SYSROOT $ENV{SDKROOT})
  15. endif(APPLE)
  16. #[=============================[ MacOS Options ]=============================]
  17. function(macos_options)
  18. #[[ Options from SCons
  19. TODO macos_deployment_target: macOS deployment target
  20. Default: 'default'
  21. TODO macos_sdk_path: macOS SDK path
  22. Default: ''
  23. TODO osxcross_sdk: OSXCross SDK version
  24. Default: if has_osxcross(): "darwin16" else None
  25. ]]
  26. endfunction()
  27. #[===========================[ Target Generation ]===========================]
  28. function(macos_generate)
  29. target_compile_definitions(godot-cpp PUBLIC MACOS_ENABLED UNIX_ENABLED)
  30. common_compiler_flags()
  31. endfunction()