Android: activate tst_QPlugin
- Use QT_ANDROID_EXTRA_LIBS to correctly deploy libraries on Android. - Update the test code to use the application libraries directory instead of resources on Android. This allows to enable the test for Android in CMakeLists.txt Task-number: QTBUG-87438 Pick-to: 6.3 6.2 Change-Id: I2f6d2d4f3ab3872cf7d7fad1668b5c2c3eef3aad Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
5ef748d321
commit
904d613a51
@ -10,7 +10,6 @@ if(QT_FEATURE_library AND NOT ANDROID)
|
||||
add_subdirectory(qpluginloader)
|
||||
add_subdirectory(qlibrary)
|
||||
endif()
|
||||
# QTBUG-87438 # special case
|
||||
if(QT_BUILD_SHARED_LIBS AND QT_FEATURE_library AND NOT ANDROID)
|
||||
if(QT_BUILD_SHARED_LIBS AND QT_FEATURE_library)
|
||||
add_subdirectory(qplugin)
|
||||
endif()
|
||||
|
@ -1,27 +1,41 @@
|
||||
# Generated from qplugin.pro.
|
||||
|
||||
add_subdirectory(invalidplugin)
|
||||
|
||||
# special case begin
|
||||
add_subdirectory(debugplugin)
|
||||
add_subdirectory(releaseplugin)
|
||||
|
||||
# The contents below are generated from ./tst_qplugin.pro
|
||||
# Collect test data
|
||||
file(GLOB_RECURSE test_data_glob
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
plugins/*)
|
||||
list(APPEND test_data ${test_data_glob})
|
||||
|
||||
qt_internal_add_test(tst_qplugin
|
||||
SOURCES
|
||||
tst_qplugin.cpp
|
||||
LIBRARIES
|
||||
Qt::CorePrivate
|
||||
TESTDATA ${test_data}
|
||||
)
|
||||
|
||||
if(NOT ANDROID)
|
||||
# Collect test data
|
||||
file(GLOB_RECURSE test_data_glob
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
plugins/*)
|
||||
list(APPEND test_data ${test_data_glob})
|
||||
set_target_properties(tst_qplugin PROPERTIES TESTDATA "${test_data}")
|
||||
else()
|
||||
# On Android the plugins must be located in the libs subdir of the APK.
|
||||
# Use QT_ANDROID_EXTRA_LIBS to achieve that.
|
||||
set(plugins
|
||||
invalidplugin
|
||||
debugplugin
|
||||
releaseplugin
|
||||
)
|
||||
set(extra_libs)
|
||||
foreach(plugin IN LISTS plugins)
|
||||
list(APPEND extra_libs
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/plugins/lib${plugin}_${CMAKE_ANDROID_ARCH_ABI}.so")
|
||||
endforeach()
|
||||
set_target_properties(tst_qplugin PROPERTIES
|
||||
QT_ANDROID_EXTRA_LIBS "${extra_libs}"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(tst_qplugin PRIVATE CMAKE_BUILD=1)
|
||||
|
||||
add_dependencies(tst_qplugin invalidplugin debugplugin releaseplugin)
|
||||
# special case end
|
||||
|
@ -54,8 +54,15 @@ private slots:
|
||||
};
|
||||
|
||||
tst_QPlugin::tst_QPlugin()
|
||||
: dir(QFINDTESTDATA("plugins"))
|
||||
{
|
||||
// On Android the plugins must be located in the APK's libs subdir
|
||||
#ifndef Q_OS_ANDROID
|
||||
dir = QFINDTESTDATA("plugins");
|
||||
#else
|
||||
const QStringList paths = QCoreApplication::libraryPaths();
|
||||
if (!paths.isEmpty())
|
||||
dir = paths.first();
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QPlugin::initTestCase()
|
||||
|
Loading…
x
Reference in New Issue
Block a user