forked from qt-creator/qt-creator
QMake: Fix that qmake was run on every build on macOS
The commit a71d725e46
which fixed issues
on ARM Macs also removed logic for CONFIG+=<arch> arguments to qmake,
which was removed from qmake in Qt 5.6 (since PPC and 32bit Macs are no
longer supported or relevant, qbase f58e95f098c8d78a5f2db7729606126fe093cbdf).
The commit only removed part of the logic though, leading to the
Makefile parser and the qmake step disagreeing on the architecture of
the last qmake run, leading to the qmake step being executed again.
Remove the whole architecture detection and matching logic from
everywhere, which only did anything meaningful on macOS, and is not
needed there anymore either.
Fixes: QTCREATORBUG-26212
Change-Id: Ib60ebca1143296194454a63992ab90a97fdb56b6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -160,26 +160,6 @@ QList<QMakeAssignment> MakeFileParse::parseAssignments(const QList<QMakeAssignme
|
||||
m_qmakeBuildConfig.explicitBuildAll = false;
|
||||
m_qmakeBuildConfig.explicitNoBuildAll = true;
|
||||
}
|
||||
} else if (value == QLatin1String("x86")) {
|
||||
if (qa.op == QLatin1String("+="))
|
||||
m_config.archConfig = QMakeStepConfig::X86;
|
||||
else
|
||||
m_config.archConfig = QMakeStepConfig::NoArch;
|
||||
} else if (value == QLatin1String("x86_64")) {
|
||||
if (qa.op == QLatin1String("+="))
|
||||
m_config.archConfig = QMakeStepConfig::X86_64;
|
||||
else
|
||||
m_config.archConfig = QMakeStepConfig::NoArch;
|
||||
} else if (value == QLatin1String("ppc")) {
|
||||
if (qa.op == QLatin1String("+="))
|
||||
m_config.archConfig = QMakeStepConfig::PowerPC;
|
||||
else
|
||||
m_config.archConfig = QMakeStepConfig::NoArch;
|
||||
} else if (value == QLatin1String("ppc64")) {
|
||||
if (qa.op == QLatin1String("+="))
|
||||
m_config.archConfig = QMakeStepConfig::PowerPC64;
|
||||
else
|
||||
m_config.archConfig = QMakeStepConfig::NoArch;
|
||||
} else if (value == QLatin1String("iphonesimulator")) {
|
||||
if (qa.op == QLatin1String("+="))
|
||||
m_config.osType = QMakeStepConfig::IphoneSimulator;
|
||||
@@ -378,7 +358,6 @@ void MakeFileParse::parseCommandLine(const QString &command, const QString &proj
|
||||
qCDebug(logging()) << " Explicit Release" << m_qmakeBuildConfig.explicitRelease;
|
||||
qCDebug(logging()) << " Explicit BuildAll" << m_qmakeBuildConfig.explicitBuildAll;
|
||||
qCDebug(logging()) << " Explicit NoBuildAll" << m_qmakeBuildConfig.explicitNoBuildAll;
|
||||
qCDebug(logging()) << " TargetArch" << m_config.archConfig;
|
||||
qCDebug(logging()) << " OsType" << m_config.osType;
|
||||
qCDebug(logging()) << " LinkQmlDebuggingQQ2"
|
||||
<< (m_config.linkQmlDebuggingQQ2 == TriState::Enabled);
|
||||
@@ -532,7 +511,6 @@ void QmakeProjectManagerPlugin::testMakefileParser()
|
||||
QCOMPARE(parser.effectiveBuildConfig({}), effectiveBuildConfig);
|
||||
|
||||
const QMakeStepConfig qmsc = parser.config();
|
||||
QCOMPARE(qmsc.archConfig, static_cast<QMakeStepConfig::TargetArchConfig>(archConfig));
|
||||
QCOMPARE(qmsc.osType, static_cast<QMakeStepConfig::OsType>(osType));
|
||||
QCOMPARE(qmsc.linkQmlDebuggingQQ2 == TriState::Enabled, linkQmlDebuggingQQ2);
|
||||
QCOMPARE(qmsc.useQtQuickCompiler == TriState::Enabled, useQtQuickCompiler);
|
||||
|
@@ -71,7 +71,6 @@ struct DirectoryData
|
||||
BaseQtVersion::QmakeBuildConfigs buildConfig;
|
||||
QString additionalArguments;
|
||||
QMakeStepConfig config;
|
||||
QMakeStepConfig::TargetArchConfig archConfig;
|
||||
QMakeStepConfig::OsType osType;
|
||||
};
|
||||
|
||||
@@ -155,10 +154,8 @@ QList<void *> QmakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
|
||||
qCDebug(logs) << " qt version:" << version->displayName() << " temporary:" << isTemporaryVersion;
|
||||
|
||||
data->archConfig = parse.config().archConfig;
|
||||
data->osType = parse.config().osType;
|
||||
|
||||
qCDebug(logs) << " archConfig:" << data->archConfig;
|
||||
qCDebug(logs) << " osType: " << data->osType;
|
||||
if (version->type() == QLatin1String(IOSQT)
|
||||
&& data->osType == QMakeStepConfig::NoOsType) {
|
||||
@@ -166,20 +163,6 @@ QList<void *> QmakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||
qCDebug(logs) << " IOS found without osType, adjusting osType" << data->osType;
|
||||
}
|
||||
|
||||
if (version->type() == QtSupport::Constants::DESKTOPQT) {
|
||||
const ProjectExplorer::Abis abis = version->qtAbis();
|
||||
if (!abis.isEmpty()) {
|
||||
ProjectExplorer::Abi abi = abis.first();
|
||||
if (abi.os() == ProjectExplorer::Abi::DarwinOS) {
|
||||
if (abi.wordWidth() == 64)
|
||||
data->archConfig = QMakeStepConfig::X86_64;
|
||||
else
|
||||
data->archConfig = QMakeStepConfig::X86;
|
||||
qCDebug(logs) << " OS X found without targetarch, adjusting archType" << data->archConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// find qmake arguments and mkspec
|
||||
data->additionalArguments = parse.unparsedArguments();
|
||||
qCDebug(logs) << " Unparsed arguments:" << data->additionalArguments;
|
||||
@@ -211,27 +194,23 @@ bool QmakeProjectImporter::matchKit(void *directoryData, const Kit *k) const
|
||||
ToolChain *tc = ToolChainKitAspect::cxxToolChain(k);
|
||||
if (kitSpec.isEmpty() && kitVersion)
|
||||
kitSpec = kitVersion->mkspecFor(tc);
|
||||
QMakeStepConfig::TargetArchConfig kitTargetArch = QMakeStepConfig::NoArch;
|
||||
QMakeStepConfig::OsType kitOsType = QMakeStepConfig::NoOsType;
|
||||
if (tc) {
|
||||
kitTargetArch = QMakeStepConfig::targetArchFor(tc->targetAbi(), kitVersion);
|
||||
kitOsType = QMakeStepConfig::osTypeFor(tc->targetAbi(), kitVersion);
|
||||
}
|
||||
qCDebug(logs) << k->displayName()
|
||||
<< "version:" << (kitVersion == data->qtVersionData.qt)
|
||||
<< "spec:" << (kitSpec == data->parsedSpec)
|
||||
<< "targetarch:" << (kitTargetArch == data->archConfig)
|
||||
<< "ostype:" << (kitOsType == data->osType);
|
||||
return kitVersion == data->qtVersionData.qt
|
||||
&& kitSpec == data->parsedSpec
|
||||
&& kitTargetArch == data->archConfig
|
||||
&& kitOsType == data->osType;
|
||||
}
|
||||
|
||||
Kit *QmakeProjectImporter::createKit(void *directoryData) const
|
||||
{
|
||||
auto *data = static_cast<DirectoryData *>(directoryData);
|
||||
return createTemporaryKit(data->qtVersionData, data->parsedSpec, data->archConfig, data->osType);
|
||||
return createTemporaryKit(data->qtVersionData, data->parsedSpec, data->osType);
|
||||
}
|
||||
|
||||
const QList<BuildInfo> QmakeProjectImporter::buildInfoList(void *directoryData) const
|
||||
@@ -263,17 +242,14 @@ void QmakeProjectImporter::deleteDirectoryData(void *directoryData) const
|
||||
delete static_cast<DirectoryData *>(directoryData);
|
||||
}
|
||||
|
||||
static const QList<ToolChain *> preferredToolChains(BaseQtVersion *qtVersion, const QString &ms,
|
||||
const QMakeStepConfig::TargetArchConfig &archConfig)
|
||||
static const QList<ToolChain *> preferredToolChains(BaseQtVersion *qtVersion, const QString &ms)
|
||||
{
|
||||
const QString spec = ms.isEmpty() ? qtVersion->mkspec() : ms;
|
||||
|
||||
const QList<ToolChain *> toolchains = ToolChainManager::toolChains();
|
||||
const Abis qtAbis = qtVersion->qtAbis();
|
||||
const auto matcher = [&](const ToolChain *tc) {
|
||||
return qtAbis.contains(tc->targetAbi())
|
||||
&& tc->suggestedMkspecList().contains(spec)
|
||||
&& QMakeStepConfig::targetArchFor(tc->targetAbi(), qtVersion) == archConfig;
|
||||
return qtAbis.contains(tc->targetAbi()) && tc->suggestedMkspecList().contains(spec);
|
||||
};
|
||||
ToolChain * const cxxToolchain = findOrDefault(toolchains, [matcher](const ToolChain *tc) {
|
||||
return tc->language() == ProjectExplorer::Constants::CXX_LANGUAGE_ID && matcher(tc);
|
||||
@@ -291,13 +267,11 @@ static const QList<ToolChain *> preferredToolChains(BaseQtVersion *qtVersion, co
|
||||
|
||||
Kit *QmakeProjectImporter::createTemporaryKit(const QtProjectImporter::QtVersionData &data,
|
||||
const QString &parsedSpec,
|
||||
const QMakeStepConfig::TargetArchConfig &archConfig,
|
||||
const QMakeStepConfig::OsType &osType) const
|
||||
{
|
||||
Q_UNUSED(osType) // TODO use this to select the right toolchain?
|
||||
return QtProjectImporter::createTemporaryKit(data,
|
||||
[&data, parsedSpec, archConfig](Kit *k) -> void {
|
||||
for (ToolChain * const tc : preferredToolChains(data.qt, parsedSpec, archConfig))
|
||||
return QtProjectImporter::createTemporaryKit(data, [&data, parsedSpec](Kit *k) -> void {
|
||||
for (ToolChain *const tc : preferredToolChains(data.qt, parsedSpec))
|
||||
ToolChainKitAspect::setToolChain(k, tc);
|
||||
if (parsedSpec != data.qt->mkspec())
|
||||
QmakeKitAspect::setMkspec(k, parsedSpec, QmakeKitAspect::MkspecSource::Code);
|
||||
|
@@ -50,7 +50,6 @@ private:
|
||||
|
||||
ProjectExplorer::Kit *createTemporaryKit(const QtProjectImporter::QtVersionData &data,
|
||||
const QString &parsedSpec,
|
||||
const QmakeProjectManager::QMakeStepConfig::TargetArchConfig &archConfig,
|
||||
const QMakeStepConfig::OsType &osType) const;
|
||||
};
|
||||
|
||||
|
@@ -185,7 +185,6 @@ QMakeStepConfig QMakeStep::deducedArguments() const
|
||||
|
||||
BaseQtVersion *version = QtKitAspect::qtVersion(kit);
|
||||
|
||||
config.archConfig = QMakeStepConfig::targetArchFor(targetAbi, version);
|
||||
config.osType = QMakeStepConfig::osTypeFor(targetAbi, version);
|
||||
config.separateDebugInfo = qmakeBuildConfiguration()->separateDebugInfo();
|
||||
config.linkQmlDebuggingQQ2 = qmakeBuildConfiguration()->qmlDebugging();
|
||||
@@ -776,25 +775,9 @@ QMakeStepFactory::QMakeStepFactory()
|
||||
setFlags(BuildStepInfo::UniqueStep);
|
||||
}
|
||||
|
||||
QMakeStepConfig::TargetArchConfig QMakeStepConfig::targetArchFor(const Abi &targetAbi, const BaseQtVersion *version)
|
||||
QMakeStepConfig::TargetArchConfig QMakeStepConfig::targetArchFor(const Abi &, const BaseQtVersion *)
|
||||
{
|
||||
TargetArchConfig arch = NoArch;
|
||||
if (!version || version->type() != QtSupport::Constants::DESKTOPQT)
|
||||
return arch;
|
||||
if (targetAbi.os() == Abi::DarwinOS && targetAbi.binaryFormat() == Abi::MachOFormat) {
|
||||
if (targetAbi.architecture() == Abi::X86Architecture) {
|
||||
if (targetAbi.wordWidth() == 32)
|
||||
arch = X86;
|
||||
else if (targetAbi.wordWidth() == 64)
|
||||
arch = X86_64;
|
||||
} else if (targetAbi.architecture() == Abi::PowerPCArchitecture) {
|
||||
if (targetAbi.wordWidth() == 32)
|
||||
arch = PowerPC;
|
||||
else if (targetAbi.wordWidth() == 64)
|
||||
arch = PowerPC64;
|
||||
}
|
||||
}
|
||||
return arch;
|
||||
return NoArch;
|
||||
}
|
||||
|
||||
QMakeStepConfig::OsType QMakeStepConfig::osTypeFor(const Abi &targetAbi, const BaseQtVersion *version)
|
||||
|
@@ -66,15 +66,14 @@ public:
|
||||
class QMAKEPROJECTMANAGER_EXPORT QMakeStepConfig
|
||||
{
|
||||
public:
|
||||
enum TargetArchConfig {
|
||||
NoArch, X86, X86_64, PowerPC, PowerPC64
|
||||
};
|
||||
// TODO remove, does nothing
|
||||
enum TargetArchConfig { NoArch, X86, X86_64, PowerPC, PowerPC64 };
|
||||
|
||||
enum OsType {
|
||||
NoOsType, IphoneSimulator, IphoneOS
|
||||
};
|
||||
enum OsType { NoOsType, IphoneSimulator, IphoneOS };
|
||||
|
||||
static TargetArchConfig targetArchFor(const ProjectExplorer::Abi &targetAbi, const QtSupport::BaseQtVersion *version);
|
||||
// TODO remove, does nothing
|
||||
static TargetArchConfig targetArchFor(const ProjectExplorer::Abi &targetAbi,
|
||||
const QtSupport::BaseQtVersion *version);
|
||||
static OsType osTypeFor(const ProjectExplorer::Abi &targetAbi, const QtSupport::BaseQtVersion *version);
|
||||
|
||||
QStringList toArguments() const;
|
||||
@@ -82,6 +81,7 @@ public:
|
||||
// Actual data
|
||||
QString sysRoot;
|
||||
QString targetTriple;
|
||||
// TODO remove, does nothing
|
||||
TargetArchConfig archConfig = NoArch;
|
||||
OsType osType = NoOsType;
|
||||
Utils::TriState separateDebugInfo;
|
||||
|
Reference in New Issue
Block a user