android.cmake 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #[=======================================================================[.rst:
  2. Android
  3. -------
  4. This file contains functions for options and configuration for targeting the
  5. Android platform
  6. Configuration of the Android toolchain is done using toolchain files,
  7. CMakePresets, or variables on the command line.
  8. The `Android SDK`_ provides toolchain files to help with configuration.
  9. CMake has its own `built-in support`_ for cross compiling to the
  10. Android platforms.
  11. .. warning::
  12. Android does not support or test the CMake built-in workflow, recommend
  13. using their toolchain file.
  14. .. _Android SDK:https://developer.android.com/ndk/guides/cmake
  15. .. _built-in support:https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-android
  16. There is further information and examples in the doc/cmake.rst file.
  17. ]=======================================================================]
  18. #[============================[ Android Options ]============================]
  19. function(android_options)
  20. #[[ Options from SCons
  21. The options below are managed by CMake toolchain files, doc.cmake.rst has
  22. more information
  23. android_api_level : Target Android API level.
  24. Default = 21
  25. ANDROID_HOME : Path to your Android SDK installation.
  26. Default = os.environ.get("ANDROID_HOME", os.environ.get("ANDROID_SDK_ROOT")
  27. ]]
  28. endfunction()
  29. #[===========================[ Target Generation ]===========================]
  30. function(android_generate)
  31. target_compile_definitions(godot-cpp PUBLIC ANDROID_ENABLED UNIX_ENABLED)
  32. common_compiler_flags()
  33. endfunction()