Allow building android{deployqt, testrunner} under target host_tools

When doing a cross build for Android we need only the host tools which
are available under cmake's host_tools target, but androiddeployqt and
androidtestrunner are not part of that. This fixes that.

Pick-to: 6.2
Change-Id: Icdbc4a78ca050b66ec8df656d9ec766ef6c9f4b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Assam Boudjelthia 2021-08-26 20:31:07 +03:00
parent 7166a82844
commit 7dc05252a0
4 changed files with 18 additions and 11 deletions

View File

@ -4,7 +4,10 @@
## androiddeployqt App: ## androiddeployqt App:
##################################################################### #####################################################################
qt_internal_add_app(androiddeployqt qt_get_tool_target_name(target_name androiddeployqt)
qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Android Deployment Tool"
TOOLS_TARGET Core
SOURCES SOURCES
main.cpp main.cpp
DEFINES DEFINES
@ -16,7 +19,7 @@ qt_internal_add_app(androiddeployqt
INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES
../shared ../shared
) )
set_target_properties(androiddeployqt PROPERTIES set_target_properties(${target_name} PROPERTIES
WIN32_EXECUTABLE FALSE WIN32_EXECUTABLE FALSE
) )
@ -26,7 +29,7 @@ set_target_properties(androiddeployqt PROPERTIES
## Scopes: ## Scopes:
##################################################################### #####################################################################
qt_internal_extend_target(androiddeployqt CONDITION windows qt_internal_extend_target(${target_name} CONDITION windows
COMPILE_OPTIONS COMPILE_OPTIONS
-U__STRICT_ANSI__ -U__STRICT_ANSI__
) )

View File

@ -395,7 +395,7 @@ void deleteMissingFiles(const Options &options, const QDir &srcDir, const QDir &
for (const QFileInfo &src : srcEntries) for (const QFileInfo &src : srcEntries)
if (dst.fileName() == src.fileName()) { if (dst.fileName() == src.fileName()) {
if (dst.isDir()) if (dst.isDir())
deleteMissingFiles(options, src.absoluteFilePath(), dst.absoluteFilePath()); deleteMissingFiles(options, src.absoluteDir(), dst.absoluteDir());
found = true; found = true;
break; break;
} }
@ -1150,16 +1150,17 @@ void cleanTopFolders(const Options &options, const QDir &srcDir, const QString &
const auto dirs = srcDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs); const auto dirs = srcDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs);
for (const QFileInfo &dir : dirs) { for (const QFileInfo &dir : dirs) {
if (dir.fileName() != QLatin1String("libs")) if (dir.fileName() != QLatin1String("libs"))
deleteMissingFiles(options, dir.absoluteFilePath(), dstDir + dir.fileName()); deleteMissingFiles(options, dir.absoluteDir(), QDir(dstDir + dir.fileName()));
} }
} }
void cleanAndroidFiles(const Options &options) void cleanAndroidFiles(const Options &options)
{ {
if (!options.androidSourceDirectory.isEmpty()) if (!options.androidSourceDirectory.isEmpty())
cleanTopFolders(options, options.androidSourceDirectory, options.outputDirectory); cleanTopFolders(options, QDir(options.androidSourceDirectory), options.outputDirectory);
cleanTopFolders(options, options.qtInstallDirectory + QLatin1String("/src/android/templates"), options.outputDirectory); cleanTopFolders(options, QDir(options.qtInstallDirectory + QLatin1String("/src/android/templates")),
options.outputDirectory);
} }
bool copyAndroidTemplate(const Options &options, const QString &androidTemplate, const QString &outDirPrefix = QString()) bool copyAndroidTemplate(const Options &options, const QString &androidTemplate, const QString &outDirPrefix = QString())

View File

@ -4,7 +4,10 @@
## androidtestrunner App: ## androidtestrunner App:
##################################################################### #####################################################################
qt_internal_add_app(androidtestrunner qt_get_tool_target_name(target_name androidtestrunner)
qt_internal_add_tool(${target_name}
TARGET_DESCRIPTION "Qt Android Test Runner Tool"
TOOLS_TARGET Core
SOURCES SOURCES
main.cpp main.cpp
DEFINES DEFINES
@ -14,7 +17,7 @@ qt_internal_add_app(androidtestrunner
PUBLIC_LIBRARIES PUBLIC_LIBRARIES
Qt::Gui Qt::Gui
) )
set_target_properties(androidtestrunner PROPERTIES set_target_properties(${target_name} PROPERTIES
WIN32_EXECUTABLE FALSE WIN32_EXECUTABLE FALSE
) )
@ -24,7 +27,7 @@ set_target_properties(androidtestrunner PROPERTIES
## Scopes: ## Scopes:
##################################################################### #####################################################################
qt_internal_extend_target(androidtestrunner CONDITION windows qt_internal_extend_target(${target_name} CONDITION windows
COMPILE_OPTIONS COMPILE_OPTIONS
-U__STRICT_ANSI__ -U__STRICT_ANSI__
) )

View File

@ -389,7 +389,7 @@ static bool isRunning() {
return false; return false;
} }
return output.indexOf(" " + g_options.package.toUtf8()) > -1; return output.indexOf(QLatin1String(" " + g_options.package.toUtf8())) > -1;
} }
static bool waitToFinish() static bool waitToFinish()