Simplify prefix-related functionality of qmake
Since the QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH and QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH definitions keep the same value in modern CMake build, no need to have special handling in cases where these values are used in qmake. Also it will be useful to specify the relative path to the prefix directory from the directories different of 'bin' when use QMakeLibraryInfo. Task-number: QTBUG-75870 Change-Id: I5a777001eb334dcf05e22853a514d4257352d59b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
93f55570c4
commit
d1101c460e
@ -83,15 +83,6 @@ function(qt_generate_qconfig_cpp in_file out_file)
|
||||
"${lib_location_absolute_path}" "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}")
|
||||
set(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "${from_lib_location_to_prefix}")
|
||||
|
||||
# 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>.
|
||||
set(bin_dir_absolute_path "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}")
|
||||
file(RELATIVE_PATH from_bin_dir_to_prefix "${bin_dir_absolute_path}" "${CMAKE_INSTALL_PREFIX}")
|
||||
set(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH "${from_bin_dir_to_prefix}")
|
||||
set(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH "${from_bin_dir_to_prefix}")
|
||||
|
||||
configure_file(${in_file} ${out_file} @ONLY)
|
||||
endfunction()
|
||||
|
||||
|
@ -21,6 +21,14 @@ Required features:
|
||||
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,6 +73,7 @@ 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
|
||||
|
@ -139,26 +139,11 @@ void QMakeLibraryInfo::sysrootify(QString &path)
|
||||
}
|
||||
}
|
||||
|
||||
static QString getPrefixFromHostBinDir(const char *hostBinDirToPrefixPath)
|
||||
static QString getPrefix()
|
||||
{
|
||||
const QString canonicalQMakePath = QFileInfo(qmake_abslocation()).canonicalPath();
|
||||
return QDir::cleanPath(canonicalQMakePath + QLatin1Char('/')
|
||||
+ QLatin1String(hostBinDirToPrefixPath));
|
||||
}
|
||||
|
||||
static QString getExtPrefixFromHostBinDir()
|
||||
{
|
||||
return getPrefixFromHostBinDir(QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH);
|
||||
}
|
||||
|
||||
static QString getHostPrefixFromHostBinDir()
|
||||
{
|
||||
return getPrefixFromHostBinDir(QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH);
|
||||
}
|
||||
|
||||
static QString getPrefix()
|
||||
{
|
||||
return getExtPrefixFromHostBinDir();
|
||||
+ QLatin1String(QT_CONFIGURE_RELATIVE_PREFIX_PATH));
|
||||
}
|
||||
|
||||
QString QMakeLibraryInfo::path(int loc)
|
||||
@ -271,7 +256,7 @@ QString QMakeLibraryInfo::rawLocation(int loc, QMakeLibraryInfo::PathGroup group
|
||||
path = QT_CONFIGURE_SETTINGS_PATH;
|
||||
#endif
|
||||
} else if (loc == HostPrefixPath) {
|
||||
static const QByteArray hostPrefixPath = getHostPrefixFromHostBinDir().toLatin1();
|
||||
static const QByteArray hostPrefixPath = getPrefix().toLatin1();
|
||||
path = hostPrefixPath.constData();
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,6 @@ static const char qt_configure_strs[] =
|
||||
;
|
||||
#define QT_CONFIGURE_SETTINGS_PATH "@QT_SYS_CONF_DIR@"
|
||||
#define QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH "@QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH@"
|
||||
#define QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH "@QT_CONFIGURE_HOSTBINDIR_TO_EXTPREFIX_PATH@"
|
||||
#define QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH "@QT_CONFIGURE_HOSTBINDIR_TO_HOSTPREFIX_PATH@"
|
||||
#define QT_CONFIGURE_PREFIX_PATH qt_configure_prefix_path_str + 12
|
||||
#ifdef QT_BUILD_QMAKE
|
||||
# define QT_CONFIGURE_EXT_PREFIX_PATH qt_configure_ext_prefix_path_str + 12
|
||||
|
Loading…
Reference in New Issue
Block a user