BaseQtVersion: remove qmakeProperty(...) getter

Qt 6 will not use qmake to identify a Qt version, so this can not
be part of the public interface of BaseQtVersion anymore.

Provide getters for the information actually read via qmakeProperty(...).

Use the getters whenever possible.

Change-Id: Iadbee80b75e4f8b06caf90e7ed69fae2029b4dd7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Tobias Hunger
2019-09-30 14:34:31 +02:00
parent fc2e22dad2
commit b489bfd615
22 changed files with 239 additions and 193 deletions

View File

@@ -212,7 +212,7 @@ bool AndroidBuildApkStep::init()
if (!AbstractProcessStep::init()) if (!AbstractProcessStep::init())
return false; return false;
QString command = version->qmakeProperty("QT_HOST_BINS"); QString command = version->hostBinPath().toString();
if (!command.endsWith('/')) if (!command.endsWith('/'))
command += '/'; command += '/';
command += "androiddeployqt"; command += "androiddeployqt";

View File

@@ -240,7 +240,7 @@ bool AndroidDeployQtStep::init()
emit addOutput(tr("Cannot find the androiddeploy Json file."), OutputFormat::Stderr); emit addOutput(tr("Cannot find the androiddeploy Json file."), OutputFormat::Stderr);
return false; return false;
} }
m_command = FilePath::fromString(version->qmakeProperty("QT_HOST_BINS")); m_command = version->hostBinPath();
if (m_command.isEmpty()) { if (m_command.isEmpty()) {
emit addOutput(tr("Cannot find the androiddeployqt tool."), OutputFormat::Stderr); emit addOutput(tr("Cannot find the androiddeployqt tool."), OutputFormat::Stderr);
return false; return false;

View File

@@ -238,9 +238,8 @@ int AndroidManager::minimumSDK(const ProjectExplorer::Kit *kit)
int minSDKVersion = -1; int minSDKVersion = -1;
QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit); QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(kit);
if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) { if (version && version->targetDeviceTypes().contains(Constants::ANDROID_DEVICE_TYPE)) {
Utils::FilePath stockManifestFilePath = Utils::FilePath stockManifestFilePath = Utils::FilePath::fromUserInput(
Utils::FilePath::fromUserInput(version->qmakeProperty("QT_INSTALL_PREFIX") + version->prefix().toString() + "/src/android/templates/AndroidManifest.xml");
QLatin1String("/src/android/templates/AndroidManifest.xml"));
QDomDocument doc; QDomDocument doc;
if (openXmlFile(doc, stockManifestFilePath)) { if (openXmlFile(doc, stockManifestFilePath)) {
minSDKVersion = parseMinSdk(doc.documentElement()); minSDKVersion = parseMinSdk(doc.documentElement());
@@ -276,7 +275,7 @@ QJsonObject AndroidManager::deploymentSettings(const Target *target)
return {}; return {};
QJsonObject settings; QJsonObject settings;
settings["_description"] = "This file is generated by QtCreator to be read by androiddeployqt and should not be modified by hand."; settings["_description"] = "This file is generated by QtCreator to be read by androiddeployqt and should not be modified by hand.";
settings["qt"] = qt->qmakeProperty("QT_INSTALL_PREFIX"); settings["qt"] = qt->prefix().toString();
settings["ndk"] = AndroidConfigurations::currentConfig().ndkLocation().toString(); settings["ndk"] = AndroidConfigurations::currentConfig().ndkLocation().toString();
settings["sdk"] = AndroidConfigurations::currentConfig().sdkLocation().toString(); settings["sdk"] = AndroidConfigurations::currentConfig().sdkLocation().toString();
settings["stdcpp-path"] = AndroidConfigurations::currentConfig().toolchainPath().pathAppended("sysroot/usr/lib/").toString(); settings["stdcpp-path"] = AndroidConfigurations::currentConfig().toolchainPath().pathAppended("sysroot/usr/lib/").toString();
@@ -728,8 +727,8 @@ bool AndroidManager::updateGradleProperties(ProjectExplorer::Target *target, con
const QString gradlePropertiesPath = packageSourceDir.pathAppended("gradle.properties").toString(); const QString gradlePropertiesPath = packageSourceDir.pathAppended("gradle.properties").toString();
GradleProperties gradleProperties = readGradleProperties(gradlePropertiesPath); GradleProperties gradleProperties = readGradleProperties(gradlePropertiesPath);
gradleProperties["qt5AndroidDir"] = version->qmakeProperty("QT_INSTALL_PREFIX") gradleProperties["qt5AndroidDir"] = (version->prefix().toString() + "/src/android/java")
.append(QLatin1String("/src/android/java")).toLocal8Bit(); .toLocal8Bit();
gradleProperties["buildDir"] = ".build"; gradleProperties["buildDir"] = ".build";
gradleProperties["androidCompileSdkVersion"] = buildTargetSDK(target).split(QLatin1Char('-')).last().toLocal8Bit(); gradleProperties["androidCompileSdkVersion"] = buildTargetSDK(target).split(QLatin1Char('-')).last().toLocal8Bit();
if (gradleProperties["androidBuildToolsVersion"].isEmpty()) { if (gradleProperties["androidBuildToolsVersion"].isEmpty()) {

View File

@@ -322,21 +322,19 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
if (!version) if (!version)
return; return;
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) { if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX") const QString src = version->prefix().toString() + "/src/android/java/AndroidManifest.xml";
.append(QLatin1String("/src/android/java/AndroidManifest.xml")));
FileUtils::copyRecursively(FilePath::fromString(src), FileUtils::copyRecursively(FilePath::fromString(src),
FilePath::fromString(m_directory + QLatin1String("/AndroidManifest.xml")), FilePath::fromString(m_directory + QLatin1String("/AndroidManifest.xml")),
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);}); nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
} else { } else {
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX") const QString src = version->prefix().toString() + "/src/android/templates";
.append(QLatin1String("/src/android/templates")));
FileUtils::copyRecursively(FilePath::fromString(src), FileUtils::copyRecursively(FilePath::fromString(src),
FilePath::fromString(m_directory), FilePath::fromString(m_directory),
nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);}); nullptr, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
if (m_copyGradle) { if (m_copyGradle) {
FilePath gradlePath = FilePath::fromString(version->qmakeProperty("QT_INSTALL_PREFIX").append(QLatin1String("/src/3rdparty/gradle"))); FilePath gradlePath = version->prefix().pathAppended("src/3rdparty/gradle");
if (!gradlePath.exists()) if (!gradlePath.exists())
gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("/tools/templates/gradle/wrapper"); gradlePath = AndroidConfigurations::currentConfig().sdkLocation().pathAppended("/tools/templates/gradle/wrapper");
FileUtils::copyRecursively(gradlePath, FilePath::fromString(m_directory), FileUtils::copyRecursively(gradlePath, FilePath::fromString(m_directory),

View File

@@ -292,10 +292,8 @@ const QList<BuildTargetInfo> CMakeBuildConfiguration::appTargets() const
bti.runEnvModifier = [this](Environment &env, bool) { bti.runEnvModifier = [this](Environment &env, bool) {
if (HostOsInfo::isWindowsHost()) { if (HostOsInfo::isWindowsHost()) {
const Kit *k = target()->kit(); const Kit *k = target()->kit();
if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k)) { if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k))
const QString installBinPath = qt->qmakeProperty("QT_INSTALL_BINS"); env.prependOrSetPath(qt->binPath().toString());
env.prependOrSetPath(installBinPath);
}
} }
}; };

View File

@@ -1001,7 +1001,7 @@ Tasks CMakeConfigurationKitAspect::validate(const Kit *k) const
Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); Utils::FilePath(), -1, Core::Id(ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
} }
} }
if (version && !qtInstallDirs.contains(version->qmakeProperty("QT_INSTALL_PREFIX")) && !isQt4) { if (version && !qtInstallDirs.contains(version->prefix().toString()) && !isQt4) {
if (version->isValid()) { if (version->isValid()) {
result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set " result << Task(Task::Warning, tr("CMake configuration has no CMAKE_PREFIX_PATH set "
"that points to the kit Qt version."), "that points to the kit Qt version."),

View File

@@ -106,7 +106,7 @@ void GenericBuildConfiguration::addToEnvironment(Utils::Environment &env) const
prependCompilerPathToEnvironment(target()->kit(), env); prependCompilerPathToEnvironment(target()->kit(), env);
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target()->kit()); const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(target()->kit());
if (qt) if (qt)
env.prependOrSetPath(qt->binPath().toString()); env.prependOrSetPath(qt->hostBinPath().toString());
} }
} // namespace Internal } // namespace Internal

View File

@@ -300,7 +300,7 @@ QStringList PerfDataReader::collectArguments(const QString &executableDirPath,
arguments << QLatin1String("--extra") << QString::fromLatin1("%1%5%2%5%3%5%4") arguments << QLatin1String("--extra") << QString::fromLatin1("%1%5%2%5%3%5%4")
.arg(QDir::toNativeSeparators(qt->libraryPath().toString())) .arg(QDir::toNativeSeparators(qt->libraryPath().toString()))
.arg(QDir::toNativeSeparators(qt->pluginPath().toString())) .arg(QDir::toNativeSeparators(qt->pluginPath().toString()))
.arg(QDir::toNativeSeparators(qt->binPath().toString())) .arg(QDir::toNativeSeparators(qt->hostBinPath().toString()))
.arg(QDir::toNativeSeparators(qt->qmlPath().toString())) .arg(QDir::toNativeSeparators(qt->qmlPath().toString()))
.arg(QDir::listSeparator()); .arg(QDir::listSeparator());
} }

View File

@@ -186,7 +186,7 @@ bool QbsProjectImporter::matchKit(void *directoryData, const Kit *k) const
if (!bgData->qtBinPath.isEmpty()) { if (!bgData->qtBinPath.isEmpty()) {
if (!qtVersion) if (!qtVersion)
return false; return false;
if (bgData->qtBinPath != qtVersion->binPath()) if (bgData->qtBinPath != qtVersion->hostBinPath())
return false; return false;
} }
if (bgData->sysroot != SysRootKitAspect::sysRoot(k)) if (bgData->sysroot != SysRootKitAspect::sysRoot(k))

View File

@@ -507,8 +507,8 @@ QString QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
if (parsedSpec.isEmpty()) if (parsedSpec.isEmpty())
return {}; return {};
FilePath baseMkspecDir = FilePath::fromUserInput( FilePath baseMkspecDir = FilePath::fromUserInput(version->hostDataPath().toString()
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs")); + "/mkspecs");
baseMkspecDir = FilePath::fromString(baseMkspecDir.toFileInfo().canonicalFilePath()); baseMkspecDir = FilePath::fromString(baseMkspecDir.toFileInfo().canonicalFilePath());
// if the path is relative it can be // if the path is relative it can be
@@ -608,7 +608,7 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
QString projectDirectory = projectPath.toFileInfo().absolutePath(); QString projectDirectory = projectPath.toFileInfo().absolutePath();
QDir qtSourceDir = QDir(version->sourcePath().toString()); QDir qtSourceDir = QDir(version->sourcePath().toString());
QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory); QString relativeProjectPath = qtSourceDir.relativeFilePath(projectDirectory);
QString qtBuildDir = version->qmakeProperty("QT_INSTALL_PREFIX"); QString qtBuildDir = version->prefix().toString();
QString absoluteBuildPath = QDir::cleanPath(qtBuildDir + QLatin1Char('/') + relativeProjectPath); QString absoluteBuildPath = QDir::cleanPath(qtBuildDir + QLatin1Char('/') + relativeProjectPath);
info.buildDirectory = FilePath::fromString(absoluteBuildPath); info.buildDirectory = FilePath::fromString(absoluteBuildPath);
@@ -672,8 +672,8 @@ void QmakeBuildConfiguration::setupBuildEnvironment(Kit *k, Environment &env)
{ {
prependCompilerPathToEnvironment(k, env); prependCompilerPathToEnvironment(k, env);
const BaseQtVersion *qt = QtKitAspect::qtVersion(k); const BaseQtVersion *qt = QtKitAspect::qtVersion(k);
if (qt && !qt->binPath().isEmpty()) if (qt && !qt->hostBinPath().isEmpty())
env.prependOrSetPath(qt->binPath().toString()); env.prependOrSetPath(qt->hostBinPath().toString());
} }
QmakeBuildConfiguration::LastKitState::LastKitState() = default; QmakeBuildConfiguration::LastKitState::LastKitState() = default;

View File

@@ -92,7 +92,7 @@ QByteArray PuppetCreator::qtHash() const
{ {
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit); QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
if (currentQtVersion) { if (currentQtVersion) {
return QCryptographicHash::hash(currentQtVersion->qmakeProperty("QT_INSTALL_DATA").toUtf8(), return QCryptographicHash::hash(currentQtVersion->dataPath().toString().toUtf8(),
QCryptographicHash::Sha1) QCryptographicHash::Sha1)
.toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals); .toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
} }
@@ -104,7 +104,7 @@ QDateTime PuppetCreator::qtLastModified() const
{ {
QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit); QtSupport::BaseQtVersion *currentQtVersion = QtSupport::QtKitAspect::qtVersion(m_kit);
if (currentQtVersion) if (currentQtVersion)
return QFileInfo(currentQtVersion->qmakeProperty("QT_INSTALL_LIBS")).lastModified(); return currentQtVersion->libraryPath().toFileInfo().lastModified();
return QDateTime(); return QDateTime();
} }
@@ -422,7 +422,7 @@ QProcessEnvironment PuppetCreator::processEnvironment() const
const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_kit); const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(m_kit);
if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet! if (QTC_GUARD(qt)) { // Kits without a Qt version should not have a puppet!
// Update PATH to include QT_HOST_BINS // Update PATH to include QT_HOST_BINS
const Utils::FilePath qtBinPath = qt->binPath(); const Utils::FilePath qtBinPath = qt->hostBinPath();
environment.prependOrSetPath(qtBinPath.toString()); environment.prependOrSetPath(qtBinPath.toString());
} }
environment.set("QML_BAD_GUI_RENDER_LOOP", "true"); environment.set("QML_BAD_GUI_RENDER_LOOP", "true");

View File

@@ -98,7 +98,7 @@ void GenerateResource::generateMenuEntry()
return; return;
temp.close(); temp.close();
auto rccBinary = QtSupport::QtKitAspect::qtVersion(currentProject->activeTarget()->kit())->binPath(); auto rccBinary = QtSupport::QtKitAspect::qtVersion(currentProject->activeTarget()->kit())->hostBinPath();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
rccBinary = rccBinary.pathAppended("rcc.exe"); rccBinary = rccBinary.pathAppended("rcc.exe");
#else #else

View File

@@ -76,15 +76,15 @@ static QStringList searchPaths(Kit *kit)
if (!qtVersion) if (!qtVersion)
return {}; return {};
const QDir pluginDir(qtVersion->qmakeProperty("QT_INSTALL_PLUGINS")); const QDir pluginDir(qtVersion->pluginPath().toString());
const QStringList pluginSubDirs = pluginDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); const QStringList pluginSubDirs = pluginDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
QStringList searchPaths; QStringList searchPaths;
for (const QString &dir : pluginSubDirs) for (const QString &dir : pluginSubDirs)
searchPaths << qtVersion->qmakeProperty("QT_INSTALL_PLUGINS") + '/' + dir; searchPaths << qtVersion->pluginPath().toString() + '/' + dir;
searchPaths << qtVersion->qmakeProperty("QT_INSTALL_LIBS"); searchPaths << qtVersion->libraryPath().toString();
searchPaths << qtVersion->qnxTarget().pathAppended(qtVersion->cpuDir() + "/lib").toString(); searchPaths << qtVersion->qnxTarget().pathAppended(qtVersion->cpuDir() + "/lib").toString();
searchPaths << qtVersion->qnxTarget().pathAppended(qtVersion->cpuDir() + "/usr/lib").toString(); searchPaths << qtVersion->qnxTarget().pathAppended(qtVersion->cpuDir() + "/usr/lib").toString();

View File

@@ -234,16 +234,16 @@ QList<DeployableFile> QnxDeployQtLibrariesDialog::gatherFiles()
QTC_ASSERT(qtVersion, return result); QTC_ASSERT(qtVersion, return result);
if (Utils::HostOsInfo::isWindowsHost()) { if (Utils::HostOsInfo::isWindowsHost()) {
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_LIBS"), result.append(gatherFiles(qtVersion->libraryPath().toString(),
QString(), QStringList() << QLatin1String("*.so.?"))); QString(),
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_LIBS") QStringList() << QLatin1String("*.so.?")));
+ QLatin1String("/fonts"))); result.append(gatherFiles(qtVersion->libraryPath().toString() + QLatin1String("/fonts")));
} else { } else {
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_LIBS"))); result.append(gatherFiles(qtVersion->libraryPath().toString()));
} }
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_PLUGINS"))); result.append(gatherFiles(qtVersion->pluginPath().toString()));
result.append(gatherFiles(qtVersion->qmakeProperty("QT_INSTALL_IMPORTS"))); result.append(gatherFiles(qtVersion->importsPath().toString()));
result.append(gatherFiles(qtVersion->qmlPath().toString())); result.append(gatherFiles(qtVersion->qmlPath().toString()));
return result; return result;

View File

@@ -130,7 +130,7 @@ void QnxQtVersion::addToEnvironment(const ProjectExplorer::Kit *k, Utils::Enviro
updateEnvironment(); updateEnvironment();
env.modify(m_qnxEnv); env.modify(m_qnxEnv);
env.prependOrSetLibrarySearchPath(qmakeProperty("QT_INSTALL_LIBS", PropertyVariantDev)); env.prependOrSetLibrarySearchPath(libraryPath().toString());
} }
Utils::Environment QnxQtVersion::qmakeRunEnvironment() const Utils::Environment QnxQtVersion::qmakeRunEnvironment() const

View File

@@ -141,9 +141,11 @@ public:
const Environment &env, const Environment &env,
QHash<ProKey, ProString> *versionInfo, QHash<ProKey, ProString> *versionInfo,
QString *error = nullptr); QString *error = nullptr);
enum PropertyVariant { PropertyVariantDev, PropertyVariantGet, PropertyVariantSrc };
QString qmakeProperty(const QByteArray &name, PropertyVariant variant = PropertyVariantGet);
static QString qmakeProperty(const QHash<ProKey, ProString> &versionInfo, static QString qmakeProperty(const QHash<ProKey, ProString> &versionInfo,
const QByteArray &name, const QByteArray &name,
BaseQtVersion::PropertyVariant variant = BaseQtVersion::PropertyVariantGet); PropertyVariant variant = PropertyVariantGet);
static FilePath mkspecDirectoryFromVersionInfo(const QHash<ProKey,ProString> &versionInfo); static FilePath mkspecDirectoryFromVersionInfo(const QHash<ProKey,ProString> &versionInfo);
static FilePath mkspecFromVersionInfo(const QHash<ProKey,ProString> &versionInfo); static FilePath mkspecFromVersionInfo(const QHash<ProKey,ProString> &versionInfo);
static FilePath sourcePath(const QHash<ProKey,ProString> &versionInfo); static FilePath sourcePath(const QHash<ProKey,ProString> &versionInfo);
@@ -158,6 +160,7 @@ public:
bool m_isAutodetected = false; bool m_isAutodetected = false;
QString m_type; QString m_type;
bool m_isUpdating = false;
bool m_hasQmlDump = false; // controlled by m_versionInfoUpToDate bool m_hasQmlDump = false; // controlled by m_versionInfoUpToDate
bool m_mkspecUpToDate = false; bool m_mkspecUpToDate = false;
bool m_mkspecReadUpToDate = false; bool m_mkspecReadUpToDate = false;
@@ -512,41 +515,76 @@ Tasks BaseQtVersion::validateKit(const Kit *k)
return result; return result;
} }
FilePath BaseQtVersion::headerPath() const FilePath BaseQtVersion::prefix() const // QT_INSTALL_PREFIX
{ {
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_HEADERS")); return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_PREFIX"));
} }
FilePath BaseQtVersion::docsPath() const FilePath BaseQtVersion::binPath() const // QT_INSTALL_BINS
{ {
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_DOCS")); return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_BINS"));
} }
FilePath BaseQtVersion::libraryPath() const FilePath BaseQtVersion::configurationPath() const // QT_INSTALL_CONFIGURATION
{ {
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_LIBS")); return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_CONFIGURATION"));
} }
FilePath BaseQtVersion::pluginPath() const FilePath BaseQtVersion::headerPath() const // QT_INSTALL_HEADERS
{ {
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_PLUGINS")); return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_HEADERS"));
} }
FilePath BaseQtVersion::qmlPath() const FilePath BaseQtVersion::dataPath() const // QT_INSTALL_DATA
{ {
return FilePath::fromUserInput(qmakeProperty("QT_INSTALL_QML")); return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_DATA"));
} }
FilePath BaseQtVersion::binPath() const FilePath BaseQtVersion::docsPath() const // QT_INSTALL_DOCS
{ {
return FilePath::fromUserInput(qmakeProperty("QT_HOST_BINS")); return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_DOCS"));
}
FilePath BaseQtVersion::importsPath() const // QT_INSTALL_IMPORTS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_IMPORTS"));
}
FilePath BaseQtVersion::libraryPath() const // QT_INSTALL_LIBS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_LIBS"));
}
FilePath BaseQtVersion::pluginPath() const // QT_INSTALL_PLUGINS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_PLUGINS"));
}
FilePath BaseQtVersion::qmlPath() const // QT_INSTALL_QML
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_QML"));
}
FilePath BaseQtVersion::translationsPath() const // QT_INSTALL_TRANSLATIONS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_INSTALL_TRANSLATIONS"));
}
FilePath BaseQtVersion::hostBinPath() const // QT_HOST_BINS
{
return FilePath::fromUserInput(d->qmakeProperty("QT_HOST_BINS"));
}
FilePath BaseQtVersion::hostDataPath() const // QT_HOST_DATA
{
return FilePath::fromUserInput(d->qmakeProperty("QT_HOST_DATA"));
} }
FilePath BaseQtVersion::mkspecsPath() const FilePath BaseQtVersion::mkspecsPath() const
{ {
const FilePath result = FilePath::fromUserInput(qmakeProperty("QT_HOST_DATA")); const FilePath result = hostDataPath();
if (result.isEmpty()) if (result.isEmpty())
return FilePath::fromUserInput(qmakeProperty("QMAKE_MKSPECS")); return FilePath::fromUserInput(d->qmakeProperty(d->m_versionInfo, "QMAKE_MKSPECS"));
return result.pathAppended("mkspecs"); return result.pathAppended("mkspecs");
} }
@@ -557,8 +595,7 @@ FilePath BaseQtVersion::qmlBinPath() const
FilePath BaseQtVersion::librarySearchPath() const FilePath BaseQtVersion::librarySearchPath() const
{ {
return HostOsInfo::isWindowsHost() return HostOsInfo::isWindowsHost() ? binPath() : libraryPath();
? FilePath::fromUserInput(qmakeProperty("QT_INSTALL_BINS")) : libraryPath();
} }
FilePathList BaseQtVersion::directoriesToIgnoreInProjectTree() const FilePathList BaseQtVersion::directoriesToIgnoreInProjectTree() const
@@ -567,7 +604,8 @@ FilePathList BaseQtVersion::directoriesToIgnoreInProjectTree() const
const FilePath mkspecPathGet = mkspecsPath(); const FilePath mkspecPathGet = mkspecsPath();
result.append(mkspecPathGet); result.append(mkspecPathGet);
FilePath mkspecPathSrc = FilePath::fromUserInput(qmakeProperty("QT_HOST_DATA", PropertyVariantSrc)); FilePath mkspecPathSrc = FilePath::fromUserInput(
d->qmakeProperty("QT_HOST_DATA", BaseQtVersionPrivate::PropertyVariantSrc));
if (!mkspecPathSrc.isEmpty()) { if (!mkspecPathSrc.isEmpty()) {
mkspecPathSrc = mkspecPathSrc.pathAppended("mkspecs"); mkspecPathSrc = mkspecPathSrc.pathAppended("mkspecs");
if (mkspecPathSrc != mkspecPathGet) if (mkspecPathSrc != mkspecPathGet)
@@ -663,11 +701,8 @@ bool BaseQtVersion::isValid() const
d->updateVersionInfo(); d->updateVersionInfo();
d->updateMkspec(); d->updateMkspec();
return !qmakeCommand().isEmpty() return !qmakeCommand().isEmpty() && d->m_installed && !binPath().isEmpty()
&& d->m_installed && !d->m_mkspecFullPath.isEmpty() && d->m_qmakeIsExecutable;
&& !qmakeProperty("QT_HOST_BINS").isNull()
&& !d->m_mkspecFullPath.isEmpty()
&& d->m_qmakeIsExecutable;
} }
BaseQtVersion::Predicate BaseQtVersion::isValidPredicate(const BaseQtVersion::Predicate &predicate) BaseQtVersion::Predicate BaseQtVersion::isValidPredicate(const BaseQtVersion::Predicate &predicate)
@@ -687,7 +722,7 @@ QString BaseQtVersion::invalidReason() const
return QCoreApplication::translate("QtVersion", "qmake does not exist or is not executable"); return QCoreApplication::translate("QtVersion", "qmake does not exist or is not executable");
if (!d->m_installed) if (!d->m_installed)
return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install"); return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install");
if (qmakeProperty("QT_HOST_BINS").isNull()) if (binPath().isEmpty())
return QCoreApplication::translate("QtVersion", return QCoreApplication::translate("QtVersion",
"Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?"); "Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
if (d->m_mkspecUpToDate && d->m_mkspecFullPath.isEmpty()) if (d->m_mkspecUpToDate && d->m_mkspecFullPath.isEmpty())
@@ -922,7 +957,7 @@ QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
{ {
QString baseDir; QString baseDir;
if (q->qtVersion() < QtVersionNumber(5, 0, 0)) { if (q->qtVersion() < QtVersionNumber(5, 0, 0)) {
baseDir = q->qmakeProperty("QT_HOST_BINS"); baseDir = q->binPath().toString();
} else { } else {
q->ensureMkSpecParsed(); q->ensureMkSpecParsed();
switch (binary) { switch (binary) {
@@ -932,7 +967,7 @@ QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
break; break;
case Uic: case Uic:
case QScxmlc: case QScxmlc:
baseDir = q->qmakeProperty("QT_HOST_BINS"); baseDir = q->hostBinPath().toString();
break; break;
default: default:
// Can't happen // Can't happen
@@ -1109,8 +1144,7 @@ bool BaseQtVersion::hasMkspec(const QString &spec) const
if (spec.isEmpty()) if (spec.isEmpty())
return true; // default spec of a Qt version return true; // default spec of a Qt version
QDir mkspecDir = QDir(QDir::fromNativeSeparators(qmakeProperty("QT_HOST_DATA")) QDir mkspecDir = QDir(hostDataPath().toString() + "/mkspecs/");
+ "/mkspecs/");
const QString absSpec = mkspecDir.absoluteFilePath(spec); const QString absSpec = mkspecDir.absoluteFilePath(spec);
if (QFileInfo(absSpec).isDir() && QFileInfo(absSpec + "/qmake.conf").isFile()) if (QFileInfo(absSpec).isDir() && QFileInfo(absSpec + "/qmake.conf").isFile())
return true; return true;
@@ -1146,11 +1180,11 @@ QtVersionNumber BaseQtVersion::qtVersion() const
void BaseQtVersionPrivate::updateVersionInfo() void BaseQtVersionPrivate::updateVersionInfo()
{ {
if (m_versionInfoUpToDate) if (m_versionInfoUpToDate || !m_qmakeIsExecutable || m_isUpdating)
return;
if (!m_qmakeIsExecutable)
return; return;
m_isUpdating = true;
// extract data from qmake executable // extract data from qmake executable
m_versionInfo.clear(); m_versionInfo.clear();
m_installed = true; m_installed = true;
@@ -1166,9 +1200,8 @@ void BaseQtVersionPrivate::updateVersionInfo()
} }
m_qmakeIsExecutable = true; m_qmakeIsExecutable = true;
const QString qtInstallBins = q->binPath().toString();
const QString qtInstallBins = qmakeProperty(m_versionInfo, "QT_INSTALL_BINS"); const QString qtHeaderData = q->headerPath().toString();
const QString qtHeaderData = qmakeProperty(m_versionInfo, "QT_INSTALL_HEADERS");
if (!qtInstallBins.isNull()) { if (!qtInstallBins.isNull()) {
if (!qtInstallBins.isEmpty()) { if (!qtInstallBins.isEmpty()) {
@@ -1179,7 +1212,7 @@ void BaseQtVersionPrivate::updateVersionInfo()
} }
// Now check for a qt that is configured with a prefix but not installed // Now check for a qt that is configured with a prefix but not installed
QString installDir = qmakeProperty(m_versionInfo, "QT_HOST_BINS"); QString installDir = q->hostBinPath().toString();
if (!installDir.isNull()) { if (!installDir.isNull()) {
if (!QFileInfo::exists(installDir)) if (!QFileInfo::exists(installDir))
m_installed = false; m_installed = false;
@@ -1192,23 +1225,24 @@ void BaseQtVersionPrivate::updateVersionInfo()
m_installed = false; m_installed = false;
} }
} }
const QString qtInstallDocs = qmakeProperty(m_versionInfo, "QT_INSTALL_DOCS"); const QString qtInstallDocs = q->docsPath().toString();
if (!qtInstallDocs.isNull()) { if (!qtInstallDocs.isNull()) {
if (QFileInfo::exists(qtInstallDocs)) if (QFileInfo::exists(qtInstallDocs))
m_hasDocumentation = true; m_hasDocumentation = true;
} }
const QString qtInstallExamples = qmakeProperty(m_versionInfo, "QT_INSTALL_EXAMPLES"); const QString qtInstallExamples = q->examplesPath().toString();
if (!qtInstallExamples.isNull()) { if (!qtInstallExamples.isNull()) {
if (QFileInfo::exists(qtInstallExamples)) if (QFileInfo::exists(qtInstallExamples))
m_hasExamples = true; m_hasExamples = true;
} }
const QString qtInstallDemos = qmakeProperty(m_versionInfo, "QT_INSTALL_DEMOS"); const QString qtInstallDemos = q->demosPath().toString();
if (!qtInstallDemos.isNull()) { if (!qtInstallDemos.isNull()) {
if (QFileInfo::exists(qtInstallDemos)) if (QFileInfo::exists(qtInstallDemos))
m_hasDemos = true; m_hasDemos = true;
} }
m_qtVersionString = qmakeProperty(m_versionInfo, "QT_VERSION"); m_qtVersionString = qmakeProperty("QT_VERSION");
m_isUpdating = false;
m_versionInfoUpToDate = true; m_versionInfoUpToDate = true;
} }
@@ -1218,23 +1252,22 @@ QHash<ProKey,ProString> BaseQtVersionPrivate::versionInfo()
return m_versionInfo; return m_versionInfo;
} }
QString BaseQtVersionPrivate::qmakeProperty(const QHash<ProKey,ProString> &versionInfo, const QByteArray &name, QString BaseQtVersionPrivate::qmakeProperty(const QHash<ProKey, ProString> &versionInfo,
BaseQtVersion::PropertyVariant variant) const QByteArray &name,
PropertyVariant variant)
{ {
QString val = versionInfo.value(ProKey(QString::fromLatin1( QString val = versionInfo
name + (variant == BaseQtVersion::PropertyVariantDev ? "/dev" : .value(ProKey(QString::fromLatin1(
variant == BaseQtVersion::PropertyVariantGet ? "/get" : "/src")))).toQString(); name
+ (variant == PropertyVariantDev
? "/dev"
: variant == PropertyVariantGet ? "/get" : "/src"))))
.toQString();
if (!val.isNull()) if (!val.isNull())
return val; return val;
return versionInfo.value(ProKey(name)).toQString(); return versionInfo.value(ProKey(name)).toQString();
} }
QString BaseQtVersion::qmakeProperty(const QByteArray &name, PropertyVariant variant) const
{
d->updateVersionInfo();
return d->qmakeProperty(d->m_versionInfo, name, variant);
}
void BaseQtVersion::applyProperties(QMakeGlobals *qmakeGlobals) const void BaseQtVersion::applyProperties(QMakeGlobals *qmakeGlobals) const
{ {
qmakeGlobals->setProperties(d->versionInfo()); qmakeGlobals->setProperties(d->versionInfo());
@@ -1254,13 +1287,13 @@ bool BaseQtVersion::hasDemos() const
FilePath BaseQtVersion::demosPath() const FilePath BaseQtVersion::demosPath() const
{ {
return FilePath::fromString(QFileInfo(qmakeProperty("QT_INSTALL_DEMOS")).canonicalFilePath()); return FilePath::fromString(QFileInfo(d->qmakeProperty("QT_INSTALL_DEMOS")).canonicalFilePath());
} }
FilePath BaseQtVersion::frameworkPath() const FilePath BaseQtVersion::frameworkPath() const
{ {
if (HostOsInfo::isMacHost()) if (HostOsInfo::isMacHost())
return FilePath::fromString(qmakeProperty("QT_INSTALL_LIBS")); return libraryPath();
return {}; return {};
} }
@@ -1270,9 +1303,10 @@ bool BaseQtVersion::hasExamples() const
return d->m_hasExamples; return d->m_hasExamples;
} }
FilePath BaseQtVersion::examplesPath() const FilePath BaseQtVersion::examplesPath() const // QT_INSTALL_EXAMPLES
{ {
return FilePath::fromString(QFileInfo(qmakeProperty("QT_INSTALL_EXAMPLES")).canonicalFilePath()); return FilePath::fromString(
QFileInfo(d->qmakeProperty("QT_INSTALL_EXAMPLES")).canonicalFilePath());
} }
QStringList BaseQtVersion::qtSoPaths() const QStringList BaseQtVersion::qtSoPaths() const
@@ -1286,7 +1320,7 @@ QStringList BaseQtVersion::qtSoPaths() const
QSet<QString> paths; QSet<QString> paths;
for (uint i = 0; i < sizeof qMakeVariables / sizeof qMakeVariables[0]; ++i) { for (uint i = 0; i < sizeof qMakeVariables / sizeof qMakeVariables[0]; ++i) {
QString path = qmakeProperty(qMakeVariables[i]); QString path = d->qmakeProperty(qMakeVariables[i]);
if (path.isNull()) if (path.isNull())
continue; continue;
QDirIterator it(path, QStringList("*.so"), QDir::Files, QDirIterator::Subdirectories); QDirIterator it(path, QStringList("*.so"), QDir::Files, QDirIterator::Subdirectories);
@@ -1328,12 +1362,11 @@ BaseQtVersion::createMacroExpander(const std::function<const BaseQtVersion *()>
std::unique_ptr<MacroExpander> expander(new MacroExpander); std::unique_ptr<MacroExpander> expander(new MacroExpander);
expander->setDisplayName(QtKitAspect::tr("Qt version")); expander->setDisplayName(QtKitAspect::tr("Qt version"));
expander->registerVariable( expander->registerVariable("Qt:Version",
"Qt:Version", QtKitAspect::tr("The version string of the current Qt version."),
QtKitAspect::tr("The version string of the current Qt version."), versionProperty([](const BaseQtVersion *version) {
versionProperty([](const BaseQtVersion *version) { return version->qtVersionString();
return version->qtVersionString(); }));
}));
expander->registerVariable( expander->registerVariable(
"Qt:Type", "Qt:Type",
@@ -1349,96 +1382,94 @@ BaseQtVersion::createMacroExpander(const std::function<const BaseQtVersion *()>
return QDir::toNativeSeparators(version->mkspec()); return QDir::toNativeSeparators(version->mkspec());
})); }));
expander->registerVariable( expander->registerVariable("Qt:QT_INSTALL_PREFIX",
"Qt:QT_INSTALL_PREFIX", QtKitAspect::tr(
QtKitAspect::tr("The installation prefix of the current Qt version."), "The installation prefix of the current Qt version."),
versionProperty([](const BaseQtVersion *version) { versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_PREFIX"); return version->prefix().toString();
})); }));
expander->registerVariable( expander->registerVariable("Qt:QT_INSTALL_DATA",
"Qt:QT_INSTALL_DATA", QtKitAspect::tr(
QtKitAspect::tr("The installation location of the current Qt version's data."), "The installation location of the current Qt version's data."),
versionProperty([](const BaseQtVersion *version) { versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_DATA"); return version->dataPath().toString();
})); }));
expander->registerVariable( expander->registerVariable(
"Qt:QT_INSTALL_HEADERS", "Qt:QT_INSTALL_HEADERS",
QtKitAspect::tr("The installation location of the current Qt version's header files."), QtKitAspect::tr("The installation location of the current Qt version's header files."),
versionProperty([](const BaseQtVersion *version) { versionProperty(
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_HEADERS"); [](const BaseQtVersion *version) { return version->headerPath().toString(); }));
}));
expander->registerVariable( expander->registerVariable(
"Qt:QT_INSTALL_LIBS", "Qt:QT_INSTALL_LIBS",
QtKitAspect::tr("The installation location of the current Qt version's library files."), QtKitAspect::tr("The installation location of the current Qt version's library files."),
versionProperty([](const BaseQtVersion *version) { versionProperty(
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_LIBS"); [](const BaseQtVersion *version) { return version->libraryPath().toString(); }));
}));
expander->registerVariable( expander->registerVariable(
"Qt:QT_INSTALL_DOCS", "Qt:QT_INSTALL_DOCS",
QtKitAspect::tr("The installation location of the current Qt version's documentation files."), QtKitAspect::tr(
versionProperty([](const BaseQtVersion *version) { "The installation location of the current Qt version's documentation files."),
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_DOCS"); versionProperty(
})); [](const BaseQtVersion *version) { return version->docsPath().toString(); }));
expander->registerVariable( expander->registerVariable(
"Qt:QT_INSTALL_BINS", "Qt:QT_INSTALL_BINS",
QtKitAspect::tr("The installation location of the current Qt version's executable files."), QtKitAspect::tr("The installation location of the current Qt version's executable files."),
versionProperty([](const BaseQtVersion *version) { versionProperty([](const BaseQtVersion *version) { return version->binPath().toString(); }));
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_BINS");
}));
expander->registerVariable( expander
"Qt:QT_INSTALL_PLUGINS", ->registerVariable("Qt:QT_INSTALL_PLUGINS",
QtKitAspect::tr("The installation location of the current Qt version's plugins."), QtKitAspect::tr(
versionProperty([](const BaseQtVersion *version) { "The installation location of the current Qt version's plugins."),
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_PLUGINS"); versionProperty([](const BaseQtVersion *version) {
})); return version->pluginPath().toString();
}));
expander->registerVariable( expander
"Qt:QT_INSTALL_QML", ->registerVariable("Qt:QT_INSTALL_QML",
QtKitAspect::tr("The installation location of the current Qt version's QML files."), QtKitAspect::tr(
versionProperty([](const BaseQtVersion *version) { "The installation location of the current Qt version's QML files."),
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_QML"); versionProperty([](const BaseQtVersion *version) {
})); return version->qmlPath().toString();
}));
expander->registerVariable( expander
"Qt:QT_INSTALL_IMPORTS", ->registerVariable("Qt:QT_INSTALL_IMPORTS",
QtKitAspect::tr("The installation location of the current Qt version's imports."), QtKitAspect::tr(
versionProperty([](const BaseQtVersion *version) { "The installation location of the current Qt version's imports."),
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_IMPORTS"); versionProperty([](const BaseQtVersion *version) {
})); return version->importsPath().toString();
}));
expander->registerVariable( expander->registerVariable(
"Qt:QT_INSTALL_TRANSLATIONS", "Qt:QT_INSTALL_TRANSLATIONS",
QtKitAspect::tr("The installation location of the current Qt version's translation files."), QtKitAspect::tr("The installation location of the current Qt version's translation files."),
versionProperty([](const BaseQtVersion *version) { versionProperty(
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_TRANSLATIONS"); [](const BaseQtVersion *version) { return version->translationsPath().toString(); }));
}));
expander->registerVariable( expander->registerVariable(
"Qt:QT_INSTALL_CONFIGURATION", "Qt:QT_INSTALL_CONFIGURATION",
QtKitAspect::tr("The installation location of the current Qt version's translation files."), QtKitAspect::tr("The installation location of the current Qt version's translation files."),
versionProperty([](const BaseQtVersion *version) { versionProperty(
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_CONFIGURATION"); [](const BaseQtVersion *version) { return version->configurationPath().toString(); }));
}));
expander->registerVariable( expander
"Qt:QT_INSTALL_EXAMPLES", ->registerVariable("Qt:QT_INSTALL_EXAMPLES",
QtKitAspect::tr("The installation location of the current Qt version's examples."), QtKitAspect::tr(
versionProperty([](const BaseQtVersion *version) { "The installation location of the current Qt version's examples."),
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_EXAMPLES"); versionProperty([](const BaseQtVersion *version) {
})); return version->examplesPath().toString();
}));
expander->registerVariable( expander->registerVariable("Qt:QT_INSTALL_DEMOS",
"Qt:QT_INSTALL_DEMOS", QtKitAspect::tr(
QtKitAspect::tr("The installation location of the current Qt version's demos."), "The installation location of the current Qt version's demos."),
versionProperty([](const BaseQtVersion *version) { versionProperty([](const BaseQtVersion *version) {
return version->d->qmakeProperty(version->d->m_versionInfo, "QT_INSTALL_DEMOS"); return version->demosPath().toString();
})); }));
expander->registerVariable( expander->registerVariable(
"Qt:QMAKE_MKSPECS", "Qt:QMAKE_MKSPECS",
@@ -1553,7 +1584,7 @@ QSet<Id> BaseQtVersion::features() const
void BaseQtVersion::addToEnvironment(const Kit *k, Environment &env) const void BaseQtVersion::addToEnvironment(const Kit *k, Environment &env) const
{ {
Q_UNUSED(k) Q_UNUSED(k)
env.set("QTDIR", QDir::toNativeSeparators(qmakeProperty("QT_HOST_DATA"))); env.set("QTDIR", hostDataPath().toUserOutput());
} }
// Some Qt versions may require environment settings for qmake to work // Some Qt versions may require environment settings for qmake to work
@@ -1585,7 +1616,7 @@ bool BaseQtVersion::needsQmlDump() const
QString BaseQtVersion::qmlDumpTool(bool debugVersion) const QString BaseQtVersion::qmlDumpTool(bool debugVersion) const
{ {
const QString qtInstallBins = qmakeProperty("QT_INSTALL_BINS"); const QString qtInstallBins = binPath().toString();
return QmlDumpTool::toolForQtPaths(qtInstallBins, debugVersion); return QmlDumpTool::toolForQtPaths(qtInstallBins, debugVersion);
} }
@@ -1701,9 +1732,16 @@ bool BaseQtVersionPrivate::queryQMakeVariables(const FilePath &binary, const Env
return true; return true;
} }
QString BaseQtVersionPrivate::qmakeProperty(const QByteArray &name,
BaseQtVersionPrivate::PropertyVariant variant)
{
updateVersionInfo();
return qmakeProperty(m_versionInfo, name, variant);
}
FilePath BaseQtVersionPrivate::mkspecDirectoryFromVersionInfo(const QHash<ProKey, ProString> &versionInfo) FilePath BaseQtVersionPrivate::mkspecDirectoryFromVersionInfo(const QHash<ProKey, ProString> &versionInfo)
{ {
QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA", BaseQtVersion::PropertyVariantSrc); QString dataDir = qmakeProperty(versionInfo, "QT_HOST_DATA", PropertyVariantSrc);
if (dataDir.isEmpty()) if (dataDir.isEmpty())
return FilePath(); return FilePath();
return FilePath::fromUserInput(dataDir + "/mkspecs"); return FilePath::fromUserInput(dataDir + "/mkspecs");
@@ -1916,10 +1954,10 @@ bool BaseQtVersion::isQtQuickCompilerSupported(QString *reason) const
FilePathList BaseQtVersionPrivate::qtCorePaths() FilePathList BaseQtVersionPrivate::qtCorePaths()
{ {
updateVersionInfo(); updateVersionInfo();
const QString &versionString = m_qtVersionString; const QString versionString = m_qtVersionString;
const QString &installLibsDir = qmakeProperty(m_versionInfo, "QT_INSTALL_LIBS"); const QString installLibsDir = q->libraryPath().toString();
const QString &installBinDir = qmakeProperty(m_versionInfo, "QT_INSTALL_BINS"); const QString installBinDir = q->binPath().toString();
const QDir::Filters filters = QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot; const QDir::Filters filters = QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot;

View File

@@ -119,9 +119,6 @@ public:
ProjectExplorer::Abis qtAbis() const; ProjectExplorer::Abis qtAbis() const;
virtual ProjectExplorer::Abis detectQtAbis() const; virtual ProjectExplorer::Abis detectQtAbis() const;
enum PropertyVariant { PropertyVariantDev, PropertyVariantGet, PropertyVariantSrc };
QString qmakeProperty(const QByteArray &name,
PropertyVariant variant = PropertyVariantGet) const;
void applyProperties(QMakeGlobals *qmakeGlobals) const; void applyProperties(QMakeGlobals *qmakeGlobals) const;
virtual void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const; virtual void addToEnvironment(const ProjectExplorer::Kit *k, Utils::Environment &env) const;
virtual Utils::Environment qmakeRunEnvironment() const; virtual Utils::Environment qmakeRunEnvironment() const;
@@ -197,15 +194,25 @@ public:
virtual ProjectExplorer::Tasks validateKit(const ProjectExplorer::Kit *k); virtual ProjectExplorer::Tasks validateKit(const ProjectExplorer::Kit *k);
Utils::FilePath headerPath() const; Utils::FilePath prefix() const;
Utils::FilePath binPath() const;
Utils::FilePath configurationPath() const;
Utils::FilePath dataPath() const;
Utils::FilePath demosPath() const; Utils::FilePath demosPath() const;
Utils::FilePath docsPath() const; Utils::FilePath docsPath() const;
Utils::FilePath examplesPath() const; Utils::FilePath examplesPath() const;
Utils::FilePath frameworkPath() const; Utils::FilePath frameworkPath() const;
Utils::FilePath headerPath() const;
Utils::FilePath importsPath() const;
Utils::FilePath libraryPath() const; Utils::FilePath libraryPath() const;
Utils::FilePath pluginPath() const; Utils::FilePath pluginPath() const;
Utils::FilePath qmlPath() const; Utils::FilePath qmlPath() const;
Utils::FilePath binPath() const; Utils::FilePath translationsPath() const;
Utils::FilePath hostBinPath() const;
Utils::FilePath hostDataPath() const;
Utils::FilePath mkspecsPath() const; Utils::FilePath mkspecsPath() const;
Utils::FilePath qmlBinPath() const; Utils::FilePath qmlBinPath() const;
Utils::FilePath librarySearchPath() const; Utils::FilePath librarySearchPath() const;
@@ -231,7 +238,6 @@ public:
QSet<Core::Id> features() const; QSet<Core::Id> features() const;
protected: protected:
BaseQtVersion(); BaseQtVersion();
BaseQtVersion(const BaseQtVersion &other) = delete; BaseQtVersion(const BaseQtVersion &other) = delete;

View File

@@ -58,7 +58,7 @@ static inline QStringList validPrebuiltFilenames(bool debugBuild)
QString QmlDumpTool::toolForVersion(const BaseQtVersion *version, bool debugDump) QString QmlDumpTool::toolForVersion(const BaseQtVersion *version, bool debugDump)
{ {
if (version) { if (version) {
const QString qtInstallBins = version->qmakeProperty("QT_INSTALL_BINS"); const QString qtInstallBins = version->binPath().toString();
return toolForQtPaths(qtInstallBins, debugDump); return toolForQtPaths(qtInstallBins, debugDump);
} }

View File

@@ -104,30 +104,36 @@ bool QtSupportPlugin::initialize(const QStringList &arguments, QString *errorMes
return true; return true;
} }
static QString qmakeProperty(const char *propertyName) static BaseQtVersion *qtVersion()
{ {
ProjectExplorer::Project *project = ProjectExplorer::ProjectTree::currentProject(); ProjectExplorer::Project *project = ProjectExplorer::ProjectTree::currentProject();
if (!project || !project->activeTarget()) if (!project || !project->activeTarget())
return QString(); return nullptr;
const BaseQtVersion *qtVersion = QtKitAspect::qtVersion(project->activeTarget()->kit()); return QtKitAspect::qtVersion(project->activeTarget()->kit());
if (!qtVersion)
return QString();
return qtVersion->qmakeProperty(propertyName);
} }
void QtSupportPlugin::extensionsInitialized() void QtSupportPlugin::extensionsInitialized()
{ {
Utils::MacroExpander *expander = Utils::globalMacroExpander(); Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable(kHostBins, expander->registerVariable(
kHostBins,
tr("Full path to the host bin directory of the current project's Qt version."), tr("Full path to the host bin directory of the current project's Qt version."),
[]() { return qmakeProperty("QT_HOST_BINS"); }); []() {
BaseQtVersion *qt = qtVersion();
return qt ? qt->hostBinPath().toUserOutput() : QString();
});
expander->registerVariable(kInstallBins, expander->registerVariable(
kInstallBins,
tr("Full path to the target bin directory of the current project's Qt version.<br>" tr("Full path to the target bin directory of the current project's Qt version.<br>"
"You probably want %1 instead.").arg(QString::fromLatin1(kHostBins)), "You probably want %1 instead.")
[]() { return qmakeProperty("QT_INSTALL_BINS"); }); .arg(QString::fromLatin1(kInstallBins)),
[]() {
BaseQtVersion *qt = qtVersion();
return qt ? qt->binPath().toUserOutput() : QString();
});
} }
} // Internal } // Internal

View File

@@ -225,7 +225,7 @@ QString WinRtDeviceFactory::findRunnerFilePath() const
BaseQtVersion *qt = nullptr; BaseQtVersion *qt = nullptr;
for (BaseQtVersion *v : winrtVersions) { for (BaseQtVersion *v : winrtVersions) {
if (!qt || qt->qtVersion() < v->qtVersion()) { if (!qt || qt->qtVersion() < v->qtVersion()) {
QFileInfo fi(v->binPath().toString() + winRtRunnerExe); QFileInfo fi(v->hostBinPath().toString() + winRtRunnerExe);
if (fi.isFile() && fi.isExecutable()) { if (fi.isFile() && fi.isExecutable()) {
qt = v; qt = v;
filePath = fi.absoluteFilePath(); filePath = fi.absoluteFilePath();

View File

@@ -91,7 +91,8 @@ bool WinRtPackageDeploymentStep::init()
if (!qt) if (!qt)
return false; return false;
const QString windeployqtPath = FileUtils::resolvePath(qt->binPath().toString(), "windeployqt.exe"); const QString windeployqtPath = FileUtils::resolvePath(qt->hostBinPath().toString(),
"windeployqt.exe");
CommandLine windeployqt{windeployqtPath}; CommandLine windeployqt{windeployqtPath};
windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath)); windeployqt.addArg(QDir::toNativeSeparators(m_targetFilePath));
@@ -104,8 +105,8 @@ bool WinRtPackageDeploymentStep::init()
ProcessParameters *params = processParameters(); ProcessParameters *params = processParameters();
if (!QFile::exists(windeployqtPath)) { if (!QFile::exists(windeployqtPath)) {
raiseError(tr("Cannot find windeployqt.exe in \"%1\".").arg( raiseError(tr("Cannot find windeployqt.exe in \"%1\".")
QDir::toNativeSeparators(qt->binPath().toString()))); .arg(QDir::toNativeSeparators(qt->hostBinPath().toString())));
return false; return false;
} }
params->setCommandLine(windeployqt); params->setCommandLine(windeployqt);

View File

@@ -62,10 +62,10 @@ WinRtRunnerHelper::WinRtRunnerHelper(ProjectExplorer::RunWorker *runWorker, QStr
return; return;
} }
m_runnerFilePath = qt->binPath().toString() + QStringLiteral("/winrtrunner.exe"); m_runnerFilePath = qt->hostBinPath().toString() + QStringLiteral("/winrtrunner.exe");
if (!QFile::exists(m_runnerFilePath)) { if (!QFile::exists(m_runnerFilePath)) {
*errorMessage = tr("Cannot find winrtrunner.exe in \"%1\".").arg( *errorMessage = tr("Cannot find winrtrunner.exe in \"%1\".").arg(
QDir::toNativeSeparators(qt->binPath().toString())); QDir::toNativeSeparators(qt->hostBinPath().toString()));
return; return;
} }