android-ndk-common.cmake 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright 2021 The Draco Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not
  4. # use this file except in compliance with the License. You may obtain a copy of
  5. # the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations under
  13. # the License.
  14. if(DRACO_CMAKE_TOOLCHAINS_ANDROID_NDK_COMMON_CMAKE_)
  15. return()
  16. endif()
  17. set(DRACO_CMAKE_TOOLCHAINS_ANDROID_NDK_COMMON_CMAKE_ 1)
  18. # Toolchain files do not have access to cached variables:
  19. # https://gitlab.kitware.com/cmake/cmake/issues/16170. Set an intermediate
  20. # environment variable when loaded the first time.
  21. if(DRACO_ANDROID_NDK_PATH)
  22. set(ENV{DRACO_ANDROID_NDK_PATH} "${DRACO_ANDROID_NDK_PATH}")
  23. else()
  24. set(DRACO_ANDROID_NDK_PATH "$ENV{DRACO_ANDROID_NDK_PATH}")
  25. endif()
  26. set(CMAKE_SYSTEM_NAME Android)
  27. if(NOT CMAKE_ANDROID_STL_TYPE)
  28. set(CMAKE_ANDROID_STL_TYPE c++_static)
  29. endif()
  30. if(NOT CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION)
  31. set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
  32. endif()