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