Read QLibraryInfo paths directly from QLibraryInfo and not from qmakeconfig.cpp
Change-Id: I1db1c871ec6b4e572bd36df6aff7a5be8a4a706c Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
3c12ab974f
commit
a08b1f6359
@ -143,12 +143,15 @@ QString QMakeLibraryInfo::path(int loc)
|
||||
QString ret = rawLocation(loc, QMakeLibraryInfo::FinalPaths);
|
||||
|
||||
// Automatically prepend the sysroot to target paths
|
||||
if (loc < QMakeLibraryInfo::FirstHostPath || loc > QMakeLibraryInfo::LastHostPath)
|
||||
if (loc < QMakeLibraryInfo::FirstHostPath)
|
||||
sysrootify(ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// from qlibraryinfo.cpp:
|
||||
void qlibraryinfo_keyAndDefault(QLibraryInfo::LibraryPath loc, QString *key, QString *value);
|
||||
|
||||
struct LocationInfo
|
||||
{
|
||||
QString key;
|
||||
@ -159,7 +162,10 @@ static LocationInfo defaultLocationInfo(int loc)
|
||||
{
|
||||
LocationInfo result;
|
||||
|
||||
if (loc == QMakeLibraryInfo::SysrootPath) {
|
||||
if (loc < QMakeLibraryInfo::FirstHostPath) {
|
||||
qlibraryinfo_keyAndDefault(static_cast<QLibraryInfo::LibraryPath>(loc),
|
||||
&result.key, &result.defaultValue);
|
||||
} else if (loc == QMakeLibraryInfo::SysrootPath) {
|
||||
result.key = QStringLiteral("Sysroot");
|
||||
} else if (loc == QMakeLibraryInfo::SysrootifyPrefixPath) {
|
||||
result.key = QStringLiteral("SysrootifyPrefix");
|
||||
@ -171,12 +177,6 @@ static LocationInfo defaultLocationInfo(int loc)
|
||||
result.key = QLatin1String(qtConfEntries[loc].key);
|
||||
result.defaultValue = QLatin1String(qtConfEntries[loc].value);
|
||||
}
|
||||
#ifndef Q_OS_WIN // On Windows we use the registry
|
||||
else if (loc == QLibraryInfo::SettingsPath) {
|
||||
result.key = QLatin1String("Settings");
|
||||
result.defaultValue = QLatin1String(".");
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -190,7 +190,9 @@ static QString storedPath(int loc)
|
||||
// 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 || loc == QMakeLibraryInfo::HostPrefixPath) {
|
||||
if (loc < QMakeLibraryInfo::FirstHostPath) {
|
||||
result = QLibraryInfo::path(static_cast<QLibraryInfo::LibraryPath>(loc));
|
||||
} else if (loc == QMakeLibraryInfo::HostPrefixPath) {
|
||||
result = QLibraryInfo::path(QLibraryInfo::PrefixPath);
|
||||
} else if (loc == QMakeLibraryInfo::SysrootPath) {
|
||||
// empty result
|
||||
@ -203,10 +205,6 @@ static QString storedPath(int loc)
|
||||
} 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];
|
||||
#ifndef Q_OS_WIN // On Windows we use the registry
|
||||
} else if (loc == QLibraryInfo::SettingsPath) {
|
||||
path = QT_CONFIGURE_SETTINGS_PATH;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (path)
|
||||
|
@ -64,12 +64,12 @@ struct QMakeLibraryInfo
|
||||
HostLibraryExecutablesPath,
|
||||
HostLibrariesPath,
|
||||
HostDataPath,
|
||||
HostPrefixPath,
|
||||
LastHostPath = HostPrefixPath,
|
||||
TargetSpecPath,
|
||||
HostSpecPath,
|
||||
HostPrefixPath,
|
||||
SysrootPath,
|
||||
SysrootifyPrefixPath,
|
||||
LastHostPath = SysrootifyPrefixPath
|
||||
SysrootifyPrefixPath
|
||||
};
|
||||
enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
|
||||
static QString rawLocation(int loc, PathGroup group);
|
||||
|
@ -91,9 +91,9 @@ static const struct {
|
||||
#endif
|
||||
{ "HostLibraries", "lib" },
|
||||
{ "HostData", "." },
|
||||
{ "HostPrefix", "" },
|
||||
{ "TargetSpec", "" },
|
||||
{ "HostSpec", "" },
|
||||
{ "HostPrefix", "" },
|
||||
{ "Sysroot", "" },
|
||||
{ "SysrootifyPrefix", "" },
|
||||
#endif
|
||||
|
@ -476,6 +476,25 @@ static QString getPrefix()
|
||||
#endif
|
||||
}
|
||||
|
||||
Q_CORE_EXPORT void qlibraryinfo_keyAndDefault(QLibraryInfo::LibraryPath loc, QString *key,
|
||||
QString *value)
|
||||
{
|
||||
if (unsigned(loc) < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) {
|
||||
*key = QLatin1String(qtConfEntries[loc].key);
|
||||
*value = QLatin1String(qtConfEntries[loc].value);
|
||||
}
|
||||
#ifndef Q_OS_WIN // On Windows we use the registry
|
||||
else if (loc == QLibraryInfo::SettingsPath) {
|
||||
*key = QLatin1String("Settings");
|
||||
*value = QLatin1String(".");
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
key->clear();
|
||||
value->clear();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \fn QString QLibraryInfo::location(LibraryLocation loc)
|
||||
\obsolete Use path() instead.
|
||||
|
||||
@ -499,17 +518,7 @@ QString QLibraryInfo::path(LibraryPath p)
|
||||
|
||||
QString key;
|
||||
QString defaultValue;
|
||||
if (unsigned(loc) < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) {
|
||||
key = QLatin1String(qtConfEntries[loc].key);
|
||||
defaultValue = QLatin1String(qtConfEntries[loc].value);
|
||||
}
|
||||
#ifndef Q_OS_WIN // On Windows we use the registry
|
||||
else if (loc == SettingsPath) {
|
||||
key = QLatin1String("Settings");
|
||||
defaultValue = QLatin1String(".");
|
||||
}
|
||||
#endif
|
||||
|
||||
qlibraryinfo_keyAndDefault(loc, &key, &defaultValue);
|
||||
if (!key.isNull()) {
|
||||
QSettings *config = QLibraryInfoPrivate::configuration();
|
||||
config->beginGroup(QLatin1String("Paths"));
|
||||
|
Loading…
Reference in New Issue
Block a user