CMake: fix running Android tests

Android *.so files need to CXX visibility to default after
qt_set_common_target_properties() which was setting it to hidden.

Also, pass the correct androidtestrunner arguments for cmake check
target

Fixes: QTBUG-88228
Change-Id: Ia29cdc9e65153c9669f3ec06f74a46f8fcd8c507
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Assam Boudjelthia 2020-11-12 13:55:25 +02:00
parent 1777ddc234
commit 29b17fa335
2 changed files with 9 additions and 8 deletions

View File

@ -24,12 +24,6 @@ function(qt_internal_add_executable name)
qt_android_apply_arch_suffix("${name}")
qt_android_generate_deployment_settings("${name}")
qt_android_add_apk_target("${name}")
# On our qmake builds we don't compile the executables with
# visibility=hidden. Not having this flag set will cause the
# executable to have main() hidden and can then no longer be loaded
# through dlopen()
set_property(TARGET ${name} PROPERTY C_VISIBILITY_PRESET default)
set_property(TARGET ${name} PROPERTY CXX_VISIBILITY_PRESET default)
else()
add_executable("${name}" ${arg_EXE_FLAGS})
endif()
@ -77,6 +71,14 @@ function(qt_internal_add_executable name)
endif()
qt_set_common_target_properties(${name})
if(ANDROID)
# On our qmake builds we don't compile the executables with
# visibility=hidden. Not having this flag set will cause the
# executable to have main() hidden and can then no longer be loaded
# through dlopen()
set_property(TARGET ${name} PROPERTY C_VISIBILITY_PRESET default)
set_property(TARGET ${name} PROPERTY CXX_VISIBILITY_PRESET default)
endif()
qt_autogen_tools_initial_setup(${name})
qt_skip_warnings_are_errors_when_repo_unclean("${name}")

View File

@ -140,9 +140,8 @@ function(qt_internal_android_add_test target)
add_test(NAME "${target}"
COMMAND "${test_runner}"
--androiddeployqt "${deployment_tool} --input ${deployment_file}"
--adb "${ANDROID_SDK_ROOT}/platform-tools/adb"
--path "${apk_dir}"
--adb "${ANDROID_SDK_ROOT}/platform-tools/adb"
--skip-install-root
--make "${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target ${target}_make_apk"
--apk "${apk_dir}/${target}.apk"