diff options
Diffstat (limited to 'Tests/RunCMake/Android/RunCMakeTest.cmake')
-rw-r--r-- | Tests/RunCMake/Android/RunCMakeTest.cmake | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/Tests/RunCMake/Android/RunCMakeTest.cmake b/Tests/RunCMake/Android/RunCMakeTest.cmake index 234525a..81dd090 100644 --- a/Tests/RunCMake/Android/RunCMakeTest.cmake +++ b/Tests/RunCMake/Android/RunCMakeTest.cmake @@ -33,12 +33,18 @@ function(run_Android case) endforeach() endfunction() +set(RunCMake_GENERATOR_PLATFORM_OLD "${RunCMake_GENERATOR_PLATFORM}") + +if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") +endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSROOT=${CMAKE_CURRENT_SOURCE_DIR} ) run_cmake(BadSYSROOT) unset(RunCMake_TEST_OPTIONS) +set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") foreach(ndk IN LISTS TEST_ANDROID_NDK) # Load available toolchain versions and abis. @@ -82,6 +88,9 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) if(_versions MATCHES "clang") set(_versions "clang" ${_versions}) endif() + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(_versions "clang") + endif() list(REMOVE_DUPLICATES _versions) list(SORT _versions) set(_versions ";${_versions}") @@ -89,44 +98,58 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) list(REMOVE_DUPLICATES _abis_${vers}) endforeach() + set(ndk_arg -DCMAKE_ANDROID_NDK=${ndk}) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(ndk_arg) + endif() + # Test failure cases. message(STATUS "ndk='${ndk}'") + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARCH_ABI=badabi ) run_cmake(ndk-badabi) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "x86") + endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_ANDROID_ARM_MODE=0 ) run_cmake(ndk-badarm) + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "ARM") + endif() if("armeabi" IN_LIST _abis_) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_ARM_NEON=0 ) run_cmake(ndk-badneon) endif() set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=badver ) run_cmake(ndk-badver) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=1.0 ) run_cmake(ndk-badvernum) set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=Android - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_STL_TYPE=badstl ) run_cmake(ndk-badstl) @@ -143,6 +166,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) run_cmake(ndk-sysroot-armeabi) unset(RunCMake_TEST_OPTIONS) endif() + set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") # Find available STLs. set(stl_types @@ -169,11 +193,18 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) armeabi-v6 armeabi-v7a arm64-v8a - mips - mips64 x86 x86_64 ) + if(NOT RunCMake_GENERATOR MATCHES "Visual Studio") + list(APPEND abi_names mips mips64) + endif() + set(abi_to_arch_armeabi ARM) + set(abi_to_arch_armeabi-v6 ARM) + set(abi_to_arch_armeabi-v7a ARM) + set(abi_to_arch_arm64-v8a ARM64) + set(abi_to_arch_x86 x86) + set(abi_to_arch_x86_64 x64) # Test all combinations. foreach(vers IN LISTS _versions) @@ -193,7 +224,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) endif() message(STATUS "ndk='${ndk}' vers='${vers}' stl='${stl}'${config_status}") set(RunCMake_TEST_OPTIONS - -DCMAKE_ANDROID_NDK=${ndk} + ${ndk_arg} -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=${vers} -DCMAKE_ANDROID_STL_TYPE=${stl} "${build_type_arg}" @@ -205,6 +236,9 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) endif() # Run the tests for this combination. + if(RunCMake_GENERATOR MATCHES "Visual Studio") + set(RunCMake_GENERATOR_PLATFORM "${abi_to_arch_${abi}}") + endif() 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 @@ -214,6 +248,7 @@ foreach(ndk IN LISTS TEST_ANDROID_NDK) run_Android(ndk-${abi}-neon -DCMAKE_ANDROID_ARCH_ABI=${abi} -DCMAKE_ANDROID_ARM_NEON=1) endif() endif() + set(RunCMake_GENERATOR_PLATFORM "${RunCMake_GENERATOR_PLATFORM_OLD}") endforeach() unset(RunCMake_TEST_OPTIONS) endforeach() |