qmake: Delegate prefix deduction to QLibraryInfo

Now, that qmake depends on QtCore, we can just ask QLibraryInfo for the
prefix instead of calculating it from QT_CONFIGURE_RELATIVE_PREFIX_PATH.
Remove that define.

Change-Id: I14be298a9d08abf33299e4cdbac55e91af318397
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2021-03-05 12:01:36 +01:00
parent b788c87457
commit 504d0c3755
3 changed files with 2 additions and 22 deletions

View File

@ -12,14 +12,6 @@ if(NOT QT_FEATURE_qmake)
return()
endif()
# The QT_CONFIGURE_HOSTBINDIR_TO_*PREFIX_PATH defines are exclusively used by qmake to determine
# the prefix from the location of the qmake executable. In our build of qmake host_prefix is
# always the same as ext_prefix, and we can just use CMAKE_INSTALL_PREFIX for the calculation of
# the relative path between <ext_prefix>/bin and <ext_prefix>.
file(RELATIVE_PATH QT_CONFIGURE_RELATIVE_PREFIX_PATH
"${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" "${CMAKE_INSTALL_PREFIX}"
)
qt_get_tool_target_name(target_name qmake)
qt_internal_add_tool(${target_name}
TOOLS_TARGET Core # special case
@ -65,7 +57,6 @@ qt_internal_add_tool(${target_name}
QT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} # special case
QT_VERSION_MINOR=${PROJECT_VERSION_MINOR} # special case
QT_VERSION_PATCH=${PROJECT_VERSION_PATCH} # special case
QT_CONFIGURE_RELATIVE_PREFIX_PATH="${QT_CONFIGURE_RELATIVE_PREFIX_PATH}"
INCLUDE_DIRECTORIES
generators
generators/mac

View File

@ -138,13 +138,6 @@ void QMakeLibraryInfo::sysrootify(QString &path)
}
}
QString QMakeLibraryInfo::getPrefix()
{
const QString canonicalQMakePath = QFileInfo(binaryAbsLocation).canonicalPath();
return QDir::cleanPath(canonicalQMakePath + QLatin1Char('/')
+ QLatin1String(QT_CONFIGURE_RELATIVE_PREFIX_PATH));
}
QString QMakeLibraryInfo::path(int loc)
{
QString ret = rawLocation(loc, QMakeLibraryInfo::FinalPaths);
@ -255,8 +248,8 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
// will be built with a dummy path, thus the compile-time result of
// strlen is meaningless.
const char *volatile path = nullptr;
if (loc == QLibraryInfo::PrefixPath) {
ret = getPrefix();
if (loc == QLibraryInfo::PrefixPath || loc == HostPrefixPath) {
ret = QLibraryInfo::path(QLibraryInfo::PrefixPath);
} else if (unsigned(loc)
<= sizeof(qt_configure_str_offsets) / sizeof(qt_configure_str_offsets[0])) {
path = qt_configure_strs + qt_configure_str_offsets[loc - 1];
@ -264,9 +257,6 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
} else if (loc == QLibraryInfo::SettingsPath) {
path = QT_CONFIGURE_SETTINGS_PATH;
#endif
} else if (loc == HostPrefixPath) {
static const QByteArray hostPrefixPath = getPrefix().toLatin1();
path = hostPrefixPath.constData();
}
if (path)

View File

@ -80,7 +80,6 @@ struct QMakeLibraryInfo
static QString qtconfManualPath;
private:
static QString getPrefix();
static QString libraryInfoFile();
};