forked from qt-creator/qt-creator
ProjectPart: save codegen flags in project part
And add them to other clang code model arguments. These flags provide architecture for cross-compilation when ios kit is selected. Task-number: QTCREATORBUG-19437 Task-number: QTCREATORBUG-19430 Change-Id: I7a485f49d637371bb28b2096086d7d8a4b0c404a Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -52,6 +52,7 @@ QStringList CompilerOptionsBuilder::build(CppTools::ProjectFile::Kind fileKind,
|
||||
|
||||
addWordWidth();
|
||||
addTargetTriple();
|
||||
addExtraCodeModelFlags();
|
||||
addLanguageOption(fileKind);
|
||||
addOptionsForLanguage(/*checkForBorlandExtensions*/ true);
|
||||
enableExceptions();
|
||||
@@ -104,6 +105,14 @@ void CompilerOptionsBuilder::addTargetTriple()
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addExtraCodeModelFlags()
|
||||
{
|
||||
// extraCodeModelFlags keep build architecture for cross-compilation.
|
||||
// In case of iOS build target triple has aarch64 archtecture set which makes
|
||||
// code model fail with CXError_Failure. To fix that we explicitly provide architecture.
|
||||
m_options.append(m_projectPart.extraCodeModelFlags);
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::enableExceptions()
|
||||
{
|
||||
add(QLatin1String("-fcxx-exceptions"));
|
||||
|
@@ -45,6 +45,7 @@ public:
|
||||
virtual ~CompilerOptionsBuilder() {}
|
||||
|
||||
virtual void addTargetTriple();
|
||||
virtual void addExtraCodeModelFlags();
|
||||
virtual void enableExceptions();
|
||||
virtual void addPredefinedHeaderPathsOptions();
|
||||
virtual void addLanguageOption(ProjectFile::Kind fileKind);
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
m_projectPart.isMsvc2015Toolchain = m_tcInfo.isMsvc2015ToolChain;
|
||||
m_projectPart.toolChainWordWidth = mapWordWith(m_tcInfo.wordWidth);
|
||||
m_projectPart.toolChainTargetTriple = m_tcInfo.targetTriple;
|
||||
m_projectPart.extraCodeModelFlags = m_tcInfo.extraCodeModelFlags;
|
||||
|
||||
m_projectPart.warningFlags = m_flags.warningFlags;
|
||||
|
||||
@@ -128,7 +129,7 @@ private:
|
||||
|
||||
const QList<ProjectExplorer::HeaderPath> systemHeaderPaths
|
||||
= m_tcInfo.headerPathsRunner(m_flags.commandLineFlags,
|
||||
m_tcInfo.sysRoothPath);
|
||||
m_tcInfo.sysRootPath);
|
||||
|
||||
ProjectPartHeaderPaths &headerPaths = m_projectPart.headerPaths;
|
||||
for (const ProjectExplorer::HeaderPath &header : systemHeaderPaths) {
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "projectinfo.h"
|
||||
|
||||
#include <projectexplorer/abi.h>
|
||||
#include <projectexplorer/gcctoolchain.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
@@ -41,10 +42,11 @@ ToolChainInfo::ToolChainInfo(const ProjectExplorer::ToolChain *toolChain,
|
||||
= toolChain->targetAbi().osFlavor() == ProjectExplorer::Abi::WindowsMsvc2015Flavor;
|
||||
wordWidth = toolChain->targetAbi().wordWidth();
|
||||
targetTriple = toolChain->originalTargetTriple();
|
||||
extraCodeModelFlags = toolChain->extraCodeModelFlags();
|
||||
|
||||
// ...and save the potentially expensive operations for later so that
|
||||
// they can be run from a worker thread.
|
||||
sysRoothPath = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
||||
sysRootPath = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString();
|
||||
headerPathsRunner = toolChain->createSystemHeaderPathsRunner();
|
||||
predefinedMacrosRunner = toolChain->createPredefinedMacrosRunner();
|
||||
}
|
||||
|
@@ -54,8 +54,9 @@ public:
|
||||
bool isMsvc2015ToolChain = false;
|
||||
unsigned wordWidth = 0;
|
||||
QString targetTriple;
|
||||
QStringList extraCodeModelFlags;
|
||||
|
||||
QString sysRoothPath; // For headerPathsRunner.
|
||||
QString sysRootPath; // For headerPathsRunner.
|
||||
ProjectExplorer::ToolChain::SystemHeaderPathsRunner headerPathsRunner;
|
||||
ProjectExplorer::ToolChain::PredefinedMacrosRunner predefinedMacrosRunner;
|
||||
};
|
||||
|
@@ -140,6 +140,7 @@ public:
|
||||
ProjectExplorer::Macros toolChainMacros;
|
||||
ToolChainWordWidth toolChainWordWidth = WordWidth32Bit;
|
||||
QString toolChainTargetTriple;
|
||||
QStringList extraCodeModelFlags;
|
||||
BuildTargetType buildTargetType = Unknown;
|
||||
};
|
||||
|
||||
|
@@ -774,6 +774,11 @@ void GccToolChain::setPlatformCodeGenFlags(const QStringList &flags)
|
||||
}
|
||||
}
|
||||
|
||||
QStringList GccToolChain::extraCodeModelFlags() const
|
||||
{
|
||||
return platformCodeGenFlags();
|
||||
}
|
||||
|
||||
/*!
|
||||
Code gen flags that have to be passed to the compiler.
|
||||
*/
|
||||
|
@@ -165,6 +165,7 @@ public:
|
||||
void resetToolChain(const Utils::FileName &);
|
||||
Utils::FileName compilerCommand() const override;
|
||||
void setPlatformCodeGenFlags(const QStringList &);
|
||||
QStringList extraCodeModelFlags() const override;
|
||||
QStringList platformCodeGenFlags() const;
|
||||
void setPlatformLinkerFlags(const QStringList &);
|
||||
QStringList platformLinkerFlags() const;
|
||||
|
@@ -100,6 +100,7 @@ public:
|
||||
virtual Abi targetAbi() const = 0;
|
||||
virtual QList<Abi> supportedAbis() const;
|
||||
virtual QString originalTargetTriple() const { return QString(); }
|
||||
virtual QStringList extraCodeModelFlags() const { return QStringList(); }
|
||||
|
||||
virtual bool isValid() const = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user