1#------------------------------------------------------------------------- 2# drawElements CMake utilities 3# ---------------------------- 4# 5# Copyright 2016 The Android Open Source Project 6# 7# Licensed under the Apache License, Version 2.0 (the "License"); 8# you may not use this file except in compliance with the License. 9# You may obtain a copy of the License at 10# 11# http://www.apache.org/licenses/LICENSE-2.0 12# 13# Unless required by applicable law or agreed to in writing, software 14# distributed under the License is distributed on an "AS IS" BASIS, 15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16# See the License for the specific language governing permissions and 17# limitations under the License. 18# 19#------------------------------------------------------------------------- 20 21# Delegate most things to the NDK's cmake toolchain script 22 23if (NOT DEFINED ANDROID_NDK_PATH) 24 message(FATAL_ERROR "Please provide ANDROID_NDK_PATH") 25endif () 26 27set(ANDROID_PLATFORM "android-${DE_ANDROID_API}") 28set(ANDROID_STL c++_static) 29set(ANDROID_CPP_FEATURES "rtti exceptions") 30 31include(${ANDROID_NDK_PATH}/build/cmake/android.toolchain.cmake) 32 33# The try_compile() used to verify the C/C++ compilers are sane tries to 34# generate an executable, but doesn't seem to use the right compiler/linker 35# options when cross-compiling, so it fails even when building an actual 36# shared library or executable succeeds. 37# 38# I don't know why this doesn't affect simpler projects that use the NDK 39# toolchain. 40set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) 41 42# Set variables used by other parts of dEQP's build scripts 43 44set(DE_OS "DE_OS_ANDROID") 45 46if (NOT DEFINED DE_COMPILER) 47 set(DE_COMPILER "DE_COMPILER_CLANG") 48endif () 49 50if (ANDROID_ABI STREQUAL "x86") 51 set(DE_CPU "DE_CPU_X86") 52elseif (ANDROID_ABI STREQUAL "armeabi" OR 53 ANDROID_ABI STREQUAL "armeabi-v7a") 54 set(DE_CPU "DE_CPU_ARM") 55elseif (ANDROID_ABI STREQUAL "arm64-v8a") 56 set(DE_CPU "DE_CPU_ARM_64") 57elseif (ANDROID_ABI STREQUAL "x86_64") 58 set(DE_CPU "DE_CPU_X86_64") 59else () 60 message(FATAL_ERROR "Unknown ABI \"${ANDROID_ABI}\"") 61endif () 62