diff options
Diffstat (limited to 'Tests/RunCMake')
52 files changed, 568 insertions, 0 deletions
diff --git a/Tests/RunCMake/Android/BadSYSROOT-result.txt b/Tests/RunCMake/Android/BadSYSROOT-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/BadSYSROOT-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/BadSYSROOT-stderr.txt b/Tests/RunCMake/Android/BadSYSROOT-stderr.txt new file mode 100644 index 0000000..e17ca03 --- /dev/null +++ b/Tests/RunCMake/Android/BadSYSROOT-stderr.txt @@ -0,0 +1,20 @@ +^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\): + The value of CMAKE_SYSROOT: + + .* + + does not match any of the forms: + + <ndk>/platforms/android-<api>/arch-<arch> + <standalone-toolchain>/sysroot + + where: + + <ndk> = Android NDK directory \(with forward slashes\) + <api> = Android API version number \(decimal digits\) + <arch> = Android ARCH name \(lower case\) + <standalone-toolchain> = Path to standalone toolchain prefix + +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:2 \(project\)$ diff --git a/Tests/RunCMake/Android/BadSYSROOT.cmake b/Tests/RunCMake/Android/BadSYSROOT.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Android/BadSYSROOT.cmake diff --git a/Tests/RunCMake/Android/CMakeLists.txt b/Tests/RunCMake/Android/CMakeLists.txt new file mode 100644 index 0000000..dc92486 --- /dev/null +++ b/Tests/RunCMake/Android/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.6) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake new file mode 100644 index 0000000..39b77cd --- /dev/null +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -0,0 +1,218 @@ +cmake_minimum_required(VERSION 3.6) + +include(RunCMake) +foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) + string(REPLACE "|" ";" ${v} "${${v}}") +endforeach() + +function(run_Android case) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + ${RunCMake_TEST_OPTIONS} + ${ARGN} + ) + + # Use a single build tree for a few tests without cleaning. + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + run_cmake(${case}) + run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .) +endfunction() + +set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_SYSROOT=${CMAKE_CURRENT_SOURCE_DIR} + ) +run_cmake(BadSYSROOT) +unset(RunCMake_TEST_OPTIONS) + +foreach(ndk IN LISTS TEST_ANDROID_NDK) + # Load available toolchain versions and abis. + file(GLOB _config_mks + "${ndk}/build/core/toolchains/*/config.mk" + "${ndk}/toolchains/*/config.mk" + ) + set(_versions "") + set(_latest_gcc 0) + set(_latest_clang "") + set(_latest_clang_vers 0) + foreach(config_mk IN LISTS _config_mks) + file(STRINGS "${config_mk}" _abis REGEX "^TOOLCHAIN_ABIS +:= +[^ ].*( |$)") + if(_abis AND "${config_mk}" MATCHES [[-((clang)?([0-9]\.[0-9]|))/config\.mk$]]) + set(_version "${CMAKE_MATCH_1}") + set(_is_clang "${CMAKE_MATCH_2}") + set(_cur_vers "${CMAKE_MATCH_3}") + if(_is_clang) + if(_latest_clang_vers STREQUAL "") + # already the latest possible + elseif(_cur_vers STREQUAL "" OR _cur_vers VERSION_GREATER _latest_clang_vers) + set(_latest_clang_vers "${_cur_vers}") + set(_latest_clang "${_version}") + endif() + else() + if(_version VERSION_GREATER _latest_gcc) + set(_latest_gcc ${_version}) + endif() + endif() + list(APPEND _versions "${_version}") + string(REGEX MATCHALL "[a-z][a-z0-9_-]+" _abis "${_abis}") + list(APPEND _abis_${_version} ${_abis}) + endif() + endforeach() + set(_abis_ ${_abis_${_latest_gcc}}) + set(_abis_clang ${_abis_${_latest_clang}}) + if(_versions MATCHES "clang") + set(_versions "clang" ${_versions}) + endif() + list(REMOVE_DUPLICATES _versions) + list(SORT _versions) + set(_versions ";${_versions}") + foreach(vers IN LISTS _versions) + list(REMOVE_DUPLICATES _abis_${vers}) + endforeach() + + # Test failure cases. + message(STATUS "ndk='${ndk}'") + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_ARCH_ABI=badabi + ) + run_cmake(ndk-badabi) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_ARCH_ABI=x86 + -DCMAKE_ANDROID_ARM_MODE=0 + ) + run_cmake(ndk-badarm) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_ARM_NEON=0 + ) + run_cmake(ndk-badneon) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=badver + ) + run_cmake(ndk-badver) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=1.0 + ) + run_cmake(ndk-badvernum) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_STL_TYPE=badstl + ) + run_cmake(ndk-badstl) + unset(RunCMake_TEST_OPTIONS) + + # Find a sysroot to test. + file(GLOB _sysroots "${ndk}/platforms/android-[0-9][0-9]/arch-arm") + if(_sysroots) + list(GET _sysroots 0 _sysroot) + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_SYSROOT=${_sysroot} + ) + run_cmake(ndk-sysroot-armeabi) + unset(RunCMake_TEST_OPTIONS) + endif() + + # Find available STLs. + set(stl_types + none + system + gnustl_static + gnustl_shared + ) + + if(IS_DIRECTORY "${ndk}/sources/cxx-stl/gabi++/libs") + list(APPEND stl_types gabi++_static gabi++_shared) + endif() + if(IS_DIRECTORY "${ndk}/sources/cxx-stl/stlport/libs") + list(APPEND stl_types stlport_static stlport_shared) + endif() + if(IS_DIRECTORY "${ndk}/sources/cxx-stl/llvm-libc++/libs") + list(APPEND stl_types c++_static c++_shared) + endif() + + # List possible ABIs. + set(abi_names + armeabi + armeabi-v6 + armeabi-v7a + arm64-v8a + mips + mips64 + x86 + x86_64 + ) + + # Test all combinations. + foreach(vers IN LISTS _versions) + foreach(stl IN LISTS stl_types) + foreach(config Release Debug) + # Test this combination for all available abis. + message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}' config='${config}'") + set(RunCMake_TEST_OPTIONS + -DCMAKE_ANDROID_NDK=${ndk} + -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=${vers} + -DCMAKE_ANDROID_STL_TYPE=${stl} + -DCMAKE_BUILD_TYPE=${config} + ) + foreach(abi IN LISTS abi_names) + # Skip ABIs not supported by this compiler. + if(NOT ";${_abis_${vers}};" MATCHES ";${abi};") + continue() + endif() + + # Skip combinations that seem to be broken. + if("${stl};${abi}" MATCHES [[^c\+\+_static;armeabi]]) + continue() + endif() + + # Run the tests for this combination. + if("${abi}" STREQUAL "armeabi") + run_Android(ndk-armeabi-thumb) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi -DCMAKE_ANDROID_ARM_MODE=0 + run_Android(ndk-armeabi-arm -DCMAKE_ANDROID_ARM_MODE=1) # default: -DCMAKE_ANDROID_ARCH_ABI=armeabi + else() + run_Android(ndk-${abi} -DCMAKE_ANDROID_ARCH_ABI=${abi}) + if("${abi}" STREQUAL "armeabi-v7a") + run_Android(ndk-${abi}-neon -DCMAKE_ANDROID_ARCH_ABI=${abi} -DCMAKE_ANDROID_ARM_NEON=1) + endif() + endif() + endforeach() + unset(RunCMake_TEST_OPTIONS) + endforeach() + endforeach() + endforeach() +endforeach() + +foreach(toolchain IN LISTS TEST_ANDROID_STANDALONE_TOOLCHAIN) + message(STATUS "toolchain='${toolchain}'") + + set(RunCMake_TEST_OPTIONS + -DCMAKE_SYSTEM_NAME=Android + -DCMAKE_SYSROOT=${toolchain}/sysroot + ) + run_cmake(standalone-sysroot) + unset(RunCMake_TEST_OPTIONS) + + foreach(config Release Debug) + message(STATUS "toolchain='${toolchain}' config='${config}'") + set(RunCMake_TEST_OPTIONS + -DCMAKE_ANDROID_STANDALONE_TOOLCHAIN=${toolchain} + -DCMAKE_BUILD_TYPE=${config} + ) + run_Android(standalone) + unset(RunCMake_TEST_OPTIONS) + endforeach() +endforeach() diff --git a/Tests/RunCMake/Android/android.c b/Tests/RunCMake/Android/android.c new file mode 100644 index 0000000..30e8574 --- /dev/null +++ b/Tests/RunCMake/Android/android.c @@ -0,0 +1,6 @@ +#include "android.h" + +int main(void) +{ + return 0; +} diff --git a/Tests/RunCMake/Android/android.cxx b/Tests/RunCMake/Android/android.cxx new file mode 100644 index 0000000..e6a6cda --- /dev/null +++ b/Tests/RunCMake/Android/android.cxx @@ -0,0 +1,45 @@ +#include "android.h" + +#ifndef STL_NONE +#include <cmath> +#include <cstdio> +#ifndef STL_SYSTEM +#include <exception> +#include <typeinfo> +#ifndef STL_GABI +#include <iostream> +#include <string> +#endif +#endif +#endif + +int main() +{ +#if !defined(STL_NONE) + // Require -lm implied by linking as C++. + std::printf("%p\n", static_cast<double (*)(double)>(&std::sin)); +#endif +#if defined(STL_NONE) + return 0; +#elif defined(STL_SYSTEM) + return 0; +#else + try { + delete (new int); + } catch (std::exception const& e) { +#if defined(STL_GABI) + e.what(); + typeid(e).name(); +#else + std::cerr << e.what() << std::endl; + std::cerr << typeid(e).name() << std::endl; +#endif + } +#if defined(STL_GABI) + return 0; +#else + std::string s; + return static_cast<int>(s.size()); +#endif +#endif +} diff --git a/Tests/RunCMake/Android/android.h b/Tests/RunCMake/Android/android.h new file mode 100644 index 0000000..a5fd67e --- /dev/null +++ b/Tests/RunCMake/Android/android.h @@ -0,0 +1,103 @@ +#ifndef __ANDROID__ +#error "__ANDROID__ not defined" +#endif + +#include <android/api-level.h> + +#if API_LEVEL != __ANDROID_API__ +#error "API levels do not match" +#endif + +#ifdef COMPILER_IS_CLANG +#ifndef __clang__ +#error "COMPILER_IS_CLANG but __clang__ is not defined" +#endif +#else +#ifdef __clang__ +#error "!COMPILER_IS_CLANG but __clang__ is defined" +#endif +#endif + +#ifdef ARM_MODE +#if ARM_MODE == 1 && defined(__thumb__) +#error "ARM_MODE==1 but __thumb__ is defined" +#elif ARM_MODE == 0 && !defined(__thumb__) +#error "ARM_MODE==0 but __thumb__ is not defined" +#endif +#endif + +#ifdef ARM_NEON +#if ARM_NEON == 0 && defined(__ARM_NEON__) +#error "ARM_NEON==0 but __ARM_NEON__ is defined" +#elif ARM_NEON == 1 && !defined(__ARM_NEON__) +#error "ARM_NEON==1 but __ARM_NEON__ is not defined" +#endif +#endif + +#ifdef ABI_armeabi +#ifndef __ARM_EABI__ +#error "ABI_armeabi: __ARM_EABI__ not defined" +#endif +#if __ARM_ARCH != 5 +#error "ABI_armeabi: __ARM_ARCH is not 5" +#endif +#endif + +#ifdef ABI_armeabi_v6 +#ifndef __ARM_EABI__ +#error "ABI_armeabi_v6: __ARM_EABI__ not defined" +#endif +#if __ARM_ARCH != 6 +#error "ABI_armeabi_v6: __ARM_ARCH is not 6" +#endif +#endif + +#ifdef ABI_armeabi_v7a +#ifndef __ARM_EABI__ +#error "ABI_armeabi_v7a: __ARM_EABI__ not defined" +#endif +#if __ARM_ARCH != 7 +#error "ABI_armeabi_v7a: __ARM_ARCH is not 7" +#endif +#endif + +#ifdef ABI_arm64_v8a +#ifdef __ARM_EABI__ +#error "ABI_arm64_v8a: __ARM_EABI__ defined" +#endif +#ifndef __aarch64__ +#error "ABI_arm64_v8a: __aarch64__ not defined" +#endif +#endif + +#ifdef ABI_mips +#if __mips != 32 +#error "ABI_mips: __mips != 32" +#endif +#ifndef _ABIO32 +#error "ABI_mips: _ABIO32 not defined" +#endif +#endif + +#ifdef ABI_mips64 +#if __mips != 64 +#error "ABI_mips64: __mips != 64" +#endif +#ifndef _ABI64 +#error "ABI_mips: _ABI64 not defined" +#endif +#endif + +#ifdef ABI_x86 +#ifndef __i686__ +#error "ABI_x86: __i686__ not defined" +#endif +#endif + +#ifdef ABI_x86_64 +#ifndef __x86_64__ +#error "ABI_x86_64: __x86_64__ not defined" +#endif +#endif + +#include <stddef.h> diff --git a/Tests/RunCMake/Android/common.cmake b/Tests/RunCMake/Android/common.cmake new file mode 100644 index 0000000..a679f6c --- /dev/null +++ b/Tests/RunCMake/Android/common.cmake @@ -0,0 +1,56 @@ +enable_language(C) +enable_language(CXX) + +foreach(f + "${CMAKE_C_ANDROID_TOOLCHAIN_PREFIX}gcc${CMAKE_C_ANDROID_TOOLCHAIN_SUFFIX}" + "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}g++${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" + "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}cpp${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" + "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ar${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" + "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}ld${CMAKE_CXX_ANDROID_TOOLCHAIN_SUFFIX}" + ) + if(NOT EXISTS "${f}") + message(SEND_ERROR "Expected file does not exist:\n \"${f}\"") + endif() +endforeach() + +string(APPEND CMAKE_C_FLAGS " -Werror") +string(APPEND CMAKE_CXX_FLAGS " -Werror") +string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,-no-undefined") + +if(CMAKE_ANDROID_NDK) + if(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION MATCHES "clang") + add_definitions(-DCOMPILER_IS_CLANG) + endif() +elseif(CMAKE_ANDROID_STANDALONE_TOOLCHAIN) + execute_process( + COMMAND ${CMAKE_ANDROID_STANDALONE_TOOLCHAIN}/bin/clang --version + OUTPUT_VARIABLE _out + ERROR_VARIABLE _err + RESULT_VARIABLE _res + ) + if(_res EQUAL 0) + add_definitions(-DCOMPILER_IS_CLANG) + endif() +endif() + +if(CMAKE_ANDROID_STL_TYPE STREQUAL "none") + add_definitions(-DSTL_NONE) +elseif(CMAKE_ANDROID_STL_TYPE STREQUAL "system") + add_definitions(-DSTL_SYSTEM) +elseif(CMAKE_ANDROID_STL_TYPE MATCHES [[^gabi\+\+]]) + add_definitions(-DSTL_GABI) +endif() + +string(REPLACE "-" "_" abi "${CMAKE_ANDROID_ARCH_ABI}") +add_definitions(-DABI_${abi}) +add_definitions(-DAPI_LEVEL=${CMAKE_SYSTEM_VERSION}) +if(CMAKE_ANDROID_ARCH_ABI MATCHES "^armeabi") + add_definitions(-DARM_MODE=${CMAKE_ANDROID_ARM_MODE}) + message(STATUS "CMAKE_ANDROID_ARM_MODE=${CMAKE_ANDROID_ARM_MODE}") +endif() +if(CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a") + add_definitions(-DARM_NEON=${CMAKE_ANDROID_ARM_NEON}) + message(STATUS "CMAKE_ANDROID_ARM_NEON=${CMAKE_ANDROID_ARM_NEON}") +endif() +add_executable(android_c android.c) +add_executable(android_cxx android.cxx) diff --git a/Tests/RunCMake/Android/ndk-arm64-v8a-stdout.txt b/Tests/RunCMake/Android/ndk-arm64-v8a-stdout.txt new file mode 100644 index 0000000..8d0bdc2 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-arm64-v8a-stdout.txt @@ -0,0 +1,2 @@ +-- Android: Targeting API '[0-9]+' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' diff --git a/Tests/RunCMake/Android/ndk-arm64-v8a.cmake b/Tests/RunCMake/Android/ndk-arm64-v8a.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-arm64-v8a.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-armeabi-arm-stdout.txt b/Tests/RunCMake/Android/ndk-armeabi-arm-stdout.txt new file mode 100644 index 0000000..3741da3 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-arm-stdout.txt @@ -0,0 +1,3 @@ +-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi', and processor 'armv5te' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' +.*-- CMAKE_ANDROID_ARM_MODE=1 diff --git a/Tests/RunCMake/Android/ndk-armeabi-arm.cmake b/Tests/RunCMake/Android/ndk-armeabi-arm.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-arm.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-armeabi-thumb-stdout.txt b/Tests/RunCMake/Android/ndk-armeabi-thumb-stdout.txt new file mode 100644 index 0000000..ce0dea2 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-thumb-stdout.txt @@ -0,0 +1,3 @@ +-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi', and processor 'armv5te' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' +.*-- CMAKE_ANDROID_ARM_MODE=0 diff --git a/Tests/RunCMake/Android/ndk-armeabi-thumb.cmake b/Tests/RunCMake/Android/ndk-armeabi-thumb.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-thumb.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stdout.txt b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stdout.txt new file mode 100644 index 0000000..ac2bfd5 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon-stdout.txt @@ -0,0 +1,3 @@ +-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' +.*-- CMAKE_ANDROID_ARM_NEON=1 diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-neon.cmake b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-neon.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a-stdout.txt b/Tests/RunCMake/Android/ndk-armeabi-v7a-stdout.txt new file mode 100644 index 0000000..0edb4f7 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a-stdout.txt @@ -0,0 +1,3 @@ +-- Android: Targeting API '[0-9]+' with architecture 'arm', ABI 'armeabi-v7a', and processor 'armv7-a' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' +.*-- CMAKE_ANDROID_ARM_NEON=0 diff --git a/Tests/RunCMake/Android/ndk-armeabi-v7a.cmake b/Tests/RunCMake/Android/ndk-armeabi-v7a.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-armeabi-v7a.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-badabi-result.txt b/Tests/RunCMake/Android/ndk-badabi-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badabi-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/ndk-badabi-stderr.txt b/Tests/RunCMake/Android/ndk-badabi-stderr.txt new file mode 100644 index 0000000..c089235 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badabi-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\): + Android: Unknown ABI CMAKE_ANDROID_ARCH_ABI='badabi'. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/Android/ndk-badabi.cmake b/Tests/RunCMake/Android/ndk-badabi.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badabi.cmake diff --git a/Tests/RunCMake/Android/ndk-badarm-result.txt b/Tests/RunCMake/Android/ndk-badarm-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badarm-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/ndk-badarm-stderr.txt b/Tests/RunCMake/Android/ndk-badarm-stderr.txt new file mode 100644 index 0000000..f62bfc4 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badarm-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\): + Android: CMAKE_ANDROID_ARM_MODE is set but is valid only for 'armeabi' + architectures. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/Android/ndk-badarm.cmake b/Tests/RunCMake/Android/ndk-badarm.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badarm.cmake diff --git a/Tests/RunCMake/Android/ndk-badneon-result.txt b/Tests/RunCMake/Android/ndk-badneon-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badneon-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/ndk-badneon-stderr.txt b/Tests/RunCMake/Android/ndk-badneon-stderr.txt new file mode 100644 index 0000000..1f0bf00 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badneon-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at .*/Modules/Platform/Android-Determine.cmake:[0-9]+ \(message\): + Android: CMAKE_ANDROID_ARM_NEON is set but is valid only for 'armeabi-v7a' + architecture. +Call Stack \(most recent call first\): + .*/Modules/CMakeDetermineSystem.cmake:[0-9]+ \(include\) + CMakeLists.txt:[0-9]+ \(project\)$ diff --git a/Tests/RunCMake/Android/ndk-badneon.cmake b/Tests/RunCMake/Android/ndk-badneon.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badneon.cmake diff --git a/Tests/RunCMake/Android/ndk-badstl-result.txt b/Tests/RunCMake/Android/ndk-badstl-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badstl-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/ndk-badstl-stderr.txt b/Tests/RunCMake/Android/ndk-badstl-stderr.txt new file mode 100644 index 0000000..c61824e --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badstl-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error at .*/Modules/Platform/Android-Common.cmake:[0-9]+ \(message\): + The CMAKE_ANDROID_STL_TYPE 'badstl' is not one of the allowed values: + + .* + +Call Stack \(most recent call first\): +.* + ndk-badstl.cmake:1 \(enable_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Android/ndk-badstl.cmake b/Tests/RunCMake/Android/ndk-badstl.cmake new file mode 100644 index 0000000..fa2fc91 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badstl.cmake @@ -0,0 +1 @@ +enable_language(CXX) diff --git a/Tests/RunCMake/Android/ndk-badver-result.txt b/Tests/RunCMake/Android/ndk-badver-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badver-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/ndk-badver-stderr.txt b/Tests/RunCMake/Android/ndk-badver-stderr.txt new file mode 100644 index 0000000..df2c5e6 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badver-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at .*/Modules/Platform/Android/Determine-Compiler-NDK.cmake:[0-9]+ \(message\): + Android: The CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION value 'badver' is not one + of the allowed forms: + + <major>.<minor> = GCC of specified version + clang<major>.<minor> = Clang of specified version + clang = Clang of most recent available version + +Call Stack \(most recent call first\): +.* + ndk-badver.cmake:1 \(enable_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Android/ndk-badver.cmake b/Tests/RunCMake/Android/ndk-badver.cmake new file mode 100644 index 0000000..c00af08 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badver.cmake @@ -0,0 +1 @@ +enable_language(C) diff --git a/Tests/RunCMake/Android/ndk-badvernum-result.txt b/Tests/RunCMake/Android/ndk-badvernum-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badvernum-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Android/ndk-badvernum-stderr.txt b/Tests/RunCMake/Android/ndk-badvernum-stderr.txt new file mode 100644 index 0000000..25bbaf9 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badvernum-stderr.txt @@ -0,0 +1,13 @@ +^CMake Error at .*/Modules/Platform/Android/Determine-Compiler-NDK.cmake:[0-9]+ \(message\): + Android: No toolchain for ABI 'armeabi' found in the NDK: + + .* + + of the version specified by CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION: + + 1\.0 + +Call Stack \(most recent call first\): +.* + ndk-badvernum.cmake:1 \(enable_language\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Android/ndk-badvernum.cmake b/Tests/RunCMake/Android/ndk-badvernum.cmake new file mode 100644 index 0000000..c00af08 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-badvernum.cmake @@ -0,0 +1 @@ +enable_language(C) diff --git a/Tests/RunCMake/Android/ndk-mips-stdout.txt b/Tests/RunCMake/Android/ndk-mips-stdout.txt new file mode 100644 index 0000000..c744683 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-mips-stdout.txt @@ -0,0 +1,2 @@ +-- Android: Targeting API '[0-9]+' with architecture 'mips', ABI 'mips', and processor 'mips' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' diff --git a/Tests/RunCMake/Android/ndk-mips.cmake b/Tests/RunCMake/Android/ndk-mips.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-mips.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-mips64-stdout.txt b/Tests/RunCMake/Android/ndk-mips64-stdout.txt new file mode 100644 index 0000000..839ddfd --- /dev/null +++ b/Tests/RunCMake/Android/ndk-mips64-stdout.txt @@ -0,0 +1,2 @@ +-- Android: Targeting API '[0-9]+' with architecture 'mips64', ABI 'mips64', and processor 'mips64' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' diff --git a/Tests/RunCMake/Android/ndk-mips64.cmake b/Tests/RunCMake/Android/ndk-mips64.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-mips64.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-sysroot-armeabi-stdout.txt b/Tests/RunCMake/Android/ndk-sysroot-armeabi-stdout.txt new file mode 100644 index 0000000..d309e72 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-sysroot-armeabi-stdout.txt @@ -0,0 +1 @@ +-- Android: Targeting API '[0-9][0-9]' with architecture 'arm', ABI 'armeabi', and processor 'armv5te' diff --git a/Tests/RunCMake/Android/ndk-sysroot-armeabi.cmake b/Tests/RunCMake/Android/ndk-sysroot-armeabi.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-sysroot-armeabi.cmake diff --git a/Tests/RunCMake/Android/ndk-x86-stdout.txt b/Tests/RunCMake/Android/ndk-x86-stdout.txt new file mode 100644 index 0000000..2dbb2f0 --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86-stdout.txt @@ -0,0 +1,2 @@ +-- Android: Targeting API '[0-9]+' with architecture 'x86', ABI 'x86', and processor 'i686' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' diff --git a/Tests/RunCMake/Android/ndk-x86.cmake b/Tests/RunCMake/Android/ndk-x86.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/ndk-x86_64-stdout.txt b/Tests/RunCMake/Android/ndk-x86_64-stdout.txt new file mode 100644 index 0000000..a7ae91d --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86_64-stdout.txt @@ -0,0 +1,2 @@ +-- Android: Targeting API '[0-9]+' with architecture 'x86_64', ABI 'x86_64', and processor 'x86_64' +-- Android: Selected (Clang toolchain '[^']+' with )?GCC toolchain '[^']+' diff --git a/Tests/RunCMake/Android/ndk-x86_64.cmake b/Tests/RunCMake/Android/ndk-x86_64.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/ndk-x86_64.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/Android/standalone-stdout.txt b/Tests/RunCMake/Android/standalone-stdout.txt new file mode 100644 index 0000000..20b095c --- /dev/null +++ b/Tests/RunCMake/Android/standalone-stdout.txt @@ -0,0 +1 @@ +-- Android: Targeting API '[0-9]+' with architecture '[a-z0-9_-]+', ABI '[a-z0-9_-]+', and processor '[a-z0-9_-]+' diff --git a/Tests/RunCMake/Android/standalone-sysroot-stdout.txt b/Tests/RunCMake/Android/standalone-sysroot-stdout.txt new file mode 100644 index 0000000..20b095c --- /dev/null +++ b/Tests/RunCMake/Android/standalone-sysroot-stdout.txt @@ -0,0 +1 @@ +-- Android: Targeting API '[0-9]+' with architecture '[a-z0-9_-]+', ABI '[a-z0-9_-]+', and processor '[a-z0-9_-]+' diff --git a/Tests/RunCMake/Android/standalone-sysroot.cmake b/Tests/RunCMake/Android/standalone-sysroot.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/Android/standalone-sysroot.cmake diff --git a/Tests/RunCMake/Android/standalone.cmake b/Tests/RunCMake/Android/standalone.cmake new file mode 100644 index 0000000..a3185fe --- /dev/null +++ b/Tests/RunCMake/Android/standalone.cmake @@ -0,0 +1 @@ +include(common.cmake) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index dbd5530..323a36b 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -327,3 +327,24 @@ add_RunCMake_test_group(CPack "DEB;RPM;TGZ") # add a test to make sure symbols are exported from a shared library # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) + +if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) + if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja") + message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators") + endif() + foreach(v TEST_ANDROID_NDK TEST_ANDROID_STANDALONE_TOOLCHAIN) + if(CMake_${v}) + string(REPLACE ";" "|" ${v} "${CMake_${v}}") + list(APPEND Android_ARGS "-D${v}=${${v}}") + endif() + endforeach() + + add_RunCMake_test(Android) + + # This test can take a very long time due to lots of combinations. + # Use a long default timeout and provide an option to customize it. + if(NOT DEFINED CMake_TEST_ANDROID_TIMEOUT) + set(CMake_TEST_ANDROID_TIMEOUT 3000) + endif() + set_property(TEST RunCMake.Android PROPERTY TIMEOUT ${CMake_TEST_ANDROID_TIMEOUT}) +endif() |