Android-Clang.cmake 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #=============================================================================
  2. # Copyright 2015-2016 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # This module is shared by multiple languages; use include blocker.
  14. if(__ANDROID_COMPILER_CLANG)
  15. return()
  16. endif()
  17. set(__ANDROID_COMPILER_CLANG 1)
  18. # Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
  19. # implemented in the CMake VS IDE generators. Avoid interfering with
  20. # that functionality for now. Later we may try to integrate this.
  21. if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
  22. macro(__android_compiler_clang lang)
  23. endmacro()
  24. return()
  25. endif()
  26. # Commonly used Android toolchain files that pre-date CMake upstream support
  27. # set CMAKE_SYSTEM_VERSION to 1. Avoid interfering with them.
  28. if(CMAKE_SYSTEM_VERSION EQUAL 1)
  29. macro(__android_compiler_clang lang)
  30. endmacro()
  31. return()
  32. endif()
  33. include(Platform/Android-Common)
  34. # The NDK toolchain configuration files at:
  35. #
  36. # <ndk>/[build/core/]toolchains/*-clang*/setup.mk
  37. #
  38. # contain logic to set LLVM_TRIPLE for Clang-based toolchains for each target.
  39. # We need to produce the same target here to produce compatible binaries.
  40. include(Platform/Android/abi-${CMAKE_ANDROID_ARCH_ABI}-Clang)
  41. macro(__android_compiler_clang lang)
  42. __android_compiler_common(${lang})
  43. if(NOT CMAKE_${lang}_COMPILER_TARGET)
  44. set(CMAKE_${lang}_COMPILER_TARGET "${_ANDROID_ABI_CLANG_TARGET}")
  45. endif()
  46. endmacro()