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);
|
QString ret = rawLocation(loc, QMakeLibraryInfo::FinalPaths);
|
||||||
|
|
||||||
// Automatically prepend the sysroot to target paths
|
// Automatically prepend the sysroot to target paths
|
||||||
if (loc < QMakeLibraryInfo::FirstHostPath || loc > QMakeLibraryInfo::LastHostPath)
|
if (loc < QMakeLibraryInfo::FirstHostPath)
|
||||||
sysrootify(ret);
|
sysrootify(ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// from qlibraryinfo.cpp:
|
||||||
|
void qlibraryinfo_keyAndDefault(QLibraryInfo::LibraryPath loc, QString *key, QString *value);
|
||||||
|
|
||||||
struct LocationInfo
|
struct LocationInfo
|
||||||
{
|
{
|
||||||
QString key;
|
QString key;
|
||||||
@ -159,7 +162,10 @@ static LocationInfo defaultLocationInfo(int loc)
|
|||||||
{
|
{
|
||||||
LocationInfo result;
|
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");
|
result.key = QStringLiteral("Sysroot");
|
||||||
} else if (loc == QMakeLibraryInfo::SysrootifyPrefixPath) {
|
} else if (loc == QMakeLibraryInfo::SysrootifyPrefixPath) {
|
||||||
result.key = QStringLiteral("SysrootifyPrefix");
|
result.key = QStringLiteral("SysrootifyPrefix");
|
||||||
@ -171,12 +177,6 @@ static LocationInfo defaultLocationInfo(int loc)
|
|||||||
result.key = QLatin1String(qtConfEntries[loc].key);
|
result.key = QLatin1String(qtConfEntries[loc].key);
|
||||||
result.defaultValue = QLatin1String(qtConfEntries[loc].value);
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,9 @@ static QString storedPath(int loc)
|
|||||||
// will be built with a dummy path, thus the compile-time result of
|
// will be built with a dummy path, thus the compile-time result of
|
||||||
// strlen is meaningless.
|
// strlen is meaningless.
|
||||||
const char *volatile path = nullptr;
|
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);
|
result = QLibraryInfo::path(QLibraryInfo::PrefixPath);
|
||||||
} else if (loc == QMakeLibraryInfo::SysrootPath) {
|
} else if (loc == QMakeLibraryInfo::SysrootPath) {
|
||||||
// empty result
|
// empty result
|
||||||
@ -203,10 +205,6 @@ static QString storedPath(int loc)
|
|||||||
} else if (unsigned(loc)
|
} else if (unsigned(loc)
|
||||||
<= sizeof(qt_configure_str_offsets) / sizeof(qt_configure_str_offsets[0])) {
|
<= sizeof(qt_configure_str_offsets) / sizeof(qt_configure_str_offsets[0])) {
|
||||||
path = qt_configure_strs + qt_configure_str_offsets[loc - 1];
|
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)
|
if (path)
|
||||||
|
@ -64,12 +64,12 @@ struct QMakeLibraryInfo
|
|||||||
HostLibraryExecutablesPath,
|
HostLibraryExecutablesPath,
|
||||||
HostLibrariesPath,
|
HostLibrariesPath,
|
||||||
HostDataPath,
|
HostDataPath,
|
||||||
|
HostPrefixPath,
|
||||||
|
LastHostPath = HostPrefixPath,
|
||||||
TargetSpecPath,
|
TargetSpecPath,
|
||||||
HostSpecPath,
|
HostSpecPath,
|
||||||
HostPrefixPath,
|
|
||||||
SysrootPath,
|
SysrootPath,
|
||||||
SysrootifyPrefixPath,
|
SysrootifyPrefixPath
|
||||||
LastHostPath = SysrootifyPrefixPath
|
|
||||||
};
|
};
|
||||||
enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
|
enum PathGroup { FinalPaths, EffectivePaths, EffectiveSourcePaths, DevicePaths };
|
||||||
static QString rawLocation(int loc, PathGroup group);
|
static QString rawLocation(int loc, PathGroup group);
|
||||||
|
@ -91,9 +91,9 @@ static const struct {
|
|||||||
#endif
|
#endif
|
||||||
{ "HostLibraries", "lib" },
|
{ "HostLibraries", "lib" },
|
||||||
{ "HostData", "." },
|
{ "HostData", "." },
|
||||||
|
{ "HostPrefix", "" },
|
||||||
{ "TargetSpec", "" },
|
{ "TargetSpec", "" },
|
||||||
{ "HostSpec", "" },
|
{ "HostSpec", "" },
|
||||||
{ "HostPrefix", "" },
|
|
||||||
{ "Sysroot", "" },
|
{ "Sysroot", "" },
|
||||||
{ "SysrootifyPrefix", "" },
|
{ "SysrootifyPrefix", "" },
|
||||||
#endif
|
#endif
|
||||||
|
@ -476,6 +476,25 @@ static QString getPrefix()
|
|||||||
#endif
|
#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)
|
/*! \fn QString QLibraryInfo::location(LibraryLocation loc)
|
||||||
\obsolete Use path() instead.
|
\obsolete Use path() instead.
|
||||||
|
|
||||||
@ -499,17 +518,7 @@ QString QLibraryInfo::path(LibraryPath p)
|
|||||||
|
|
||||||
QString key;
|
QString key;
|
||||||
QString defaultValue;
|
QString defaultValue;
|
||||||
if (unsigned(loc) < sizeof(qtConfEntries)/sizeof(qtConfEntries[0])) {
|
qlibraryinfo_keyAndDefault(loc, &key, &defaultValue);
|
||||||
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
|
|
||||||
|
|
||||||
if (!key.isNull()) {
|
if (!key.isNull()) {
|
||||||
QSettings *config = QLibraryInfoPrivate::configuration();
|
QSettings *config = QLibraryInfoPrivate::configuration();
|
||||||
config->beginGroup(QLatin1String("Paths"));
|
config->beginGroup(QLatin1String("Paths"));
|
||||||
|
Loading…
Reference in New Issue
Block a user