3
0

Configurations_android.cmake 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  9. include(cmake/Platform/Common/Configurations_common.cmake)
  10. include(cmake/Platform/Common/Clang/Configurations_clang.cmake)
  11. set(_android_api_define)
  12. if(${LY_TOOLCHAIN_NDK_PKG_MAJOR} VERSION_LESS "23")
  13. set(_android_api_define __ANDROID_API__=${LY_TOOLCHAIN_NDK_API_LEVEL})
  14. endif()
  15. ly_append_configurations_options(
  16. DEFINES
  17. LINUX64
  18. _LINUX
  19. LINUX
  20. ANDROID
  21. MOBILE
  22. _HAS_C9X
  23. ENABLE_TYPE_INFO
  24. NDK_REV_MAJOR=${LY_TOOLCHAIN_NDK_PKG_MAJOR}
  25. NDK_REV_MINOR=${LY_TOOLCHAIN_NDK_PKG_MINOR}
  26. ${_android_api_define}
  27. COMPILATION
  28. -femulated-tls # All accesses to TLS variables are converted to calls to __emutls_get_address in the runtime library
  29. -ffast-math # Allow aggressive, lossy floating-point optimizations,
  30. -fno-aligned-allocation # Disable use of C++17 aligned_alloc for operator new/delete
  31. COMPILATION_DEBUG
  32. -gdwarf-2 # DWARF 2 debugging information
  33. COMPILATION_PROFILE
  34. -g # debugging information
  35. -gdwarf-2 # DWARF 2 debugging information
  36. LINK_NON_STATIC
  37. -rdynamic # add ALL symbols to the dynamic symbol table
  38. -Wl,--no-undefined # tell the gcc linker to fail if it finds undefined references
  39. -Wl,--gc-sections # discards unused sections
  40. -landroid # Android Library
  41. -llog # log library for android
  42. -lc++_shared
  43. -ldl # Dynamic
  44. -stdlib=libc++
  45. -u ANativeActivity_onCreate
  46. LINK_NON_STATIC_DEBUG
  47. -Wl,--build-id # Android Studio needs the libraries to have an id in order to match them with what"s running on the device.
  48. -shared
  49. LINK_NON_STATIC_PROFILE
  50. -Wl,--build-id # Android Studio needs the libraries to have an id in order to match them with what"s running on the device.
  51. -shared
  52. )
  53. ly_set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fms-extensions -fno-aligned-allocation -stdlib=libc++")
  54. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
  55. ly_set(CMAKE_CXX_EXTENSIONS OFF)
  56. include(cmake/Platform/Common/TargetIncludeSystemDirectories_supported.cmake)
  57. else()
  58. message(FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} not supported in ${PAL_PLATFORM_NAME}")
  59. endif()