Merge topic 'ninja-object-rsp'
7731e44f
Ninja: Honor CMAKE_NINJA_FORCE_RESPONSE_FILE for compile rulesf9644a2d
cmGlobalNinjaGenerator: Clarify logic for forcing use of response files24c9106b
cmNinjaTargetGenerator: Factor out helper for forced response file check
This commit is contained in:
commit
2369f19a7a
|
@ -230,9 +230,10 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
|
||||||
std::string assignments = variable_assignments.str();
|
std::string assignments = variable_assignments.str();
|
||||||
const std::string& args = arguments;
|
const std::string& args = arguments;
|
||||||
bool useResponseFile = false;
|
bool useResponseFile = false;
|
||||||
if (cmdLineLimit > 0
|
if (cmdLineLimit < 0 ||
|
||||||
&& args.size() + buildstr.size() + assignments.size()
|
(cmdLineLimit > 0 &&
|
||||||
> (size_t) cmdLineLimit) {
|
(args.size() + buildstr.size() + assignments.size())
|
||||||
|
> static_cast<size_t>(cmdLineLimit))) {
|
||||||
variable_assignments.str(std::string());
|
variable_assignments.str(std::string());
|
||||||
cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
|
cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
|
||||||
"RSP_FILE", rspfile, "", 1);
|
"RSP_FILE", rspfile, "", 1);
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
const cmNinjaDeps& orderOnlyDeps,
|
const cmNinjaDeps& orderOnlyDeps,
|
||||||
const cmNinjaVars& variables,
|
const cmNinjaVars& variables,
|
||||||
const std::string& rspfile = std::string(),
|
const std::string& rspfile = std::string(),
|
||||||
int cmdLineLimit = -1,
|
int cmdLineLimit = 0,
|
||||||
bool* usedResponseFile = 0);
|
bool* usedResponseFile = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -697,10 +697,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
|
|
||||||
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
|
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
|
||||||
|
|
||||||
int commandLineLengthLimit = 1;
|
int commandLineLengthLimit = -1;
|
||||||
const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
|
if (!this->ForceResponseFile())
|
||||||
if (!mf->IsDefinitionSet(forceRspFile) &&
|
|
||||||
cmSystemTools::GetEnv(forceRspFile) == 0)
|
|
||||||
{
|
{
|
||||||
commandLineLengthLimit = calculateCommandLineLengthLimit(
|
commandLineLengthLimit = calculateCommandLineLengthLimit(
|
||||||
globalGen.GetRuleCmdLength(this->LanguageLinkerRule()));
|
globalGen.GetRuleCmdLength(this->LanguageLinkerRule()));
|
||||||
|
|
|
@ -341,11 +341,25 @@ cmNinjaTargetGenerator
|
||||||
|
|
||||||
cmMakefile* mf = this->GetMakefile();
|
cmMakefile* mf = this->GetMakefile();
|
||||||
|
|
||||||
|
std::string flags = "$FLAGS";
|
||||||
|
std::string rspfile;
|
||||||
|
std::string rspcontent;
|
||||||
|
std::string responseFlag;
|
||||||
|
|
||||||
|
if (this->ForceResponseFile())
|
||||||
|
{
|
||||||
|
rspfile = "$RSP_FILE";
|
||||||
|
responseFlag = "@" + rspfile;
|
||||||
|
rspcontent = " $DEFINES $INCLUDES $FLAGS";
|
||||||
|
flags = responseFlag;
|
||||||
|
vars.Defines = "";
|
||||||
|
vars.Includes = "";
|
||||||
|
}
|
||||||
|
|
||||||
// Tell ninja dependency format so all deps can be loaded into a database
|
// Tell ninja dependency format so all deps can be loaded into a database
|
||||||
std::string deptype;
|
std::string deptype;
|
||||||
std::string depfile;
|
std::string depfile;
|
||||||
std::string cldeps;
|
std::string cldeps;
|
||||||
std::string flags = "$FLAGS";
|
|
||||||
if (this->NeedDepTypeMSVC(lang))
|
if (this->NeedDepTypeMSVC(lang))
|
||||||
{
|
{
|
||||||
deptype = "msvc";
|
deptype = "msvc";
|
||||||
|
@ -460,8 +474,8 @@ cmNinjaTargetGenerator
|
||||||
comment.str(),
|
comment.str(),
|
||||||
depfile,
|
depfile,
|
||||||
deptype,
|
deptype,
|
||||||
/*rspfile*/ "",
|
rspfile,
|
||||||
/*rspcontent*/ "",
|
rspcontent,
|
||||||
/*restat*/ "",
|
/*restat*/ "",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
}
|
}
|
||||||
|
@ -641,6 +655,9 @@ cmNinjaTargetGenerator
|
||||||
|
|
||||||
this->SetMsvcTargetPdbVariable(vars);
|
this->SetMsvcTargetPdbVariable(vars);
|
||||||
|
|
||||||
|
int const commandLineLengthLimit = this->ForceResponseFile() ? -1 : 0;
|
||||||
|
std::string const rspfile = objectFileName + ".rsp";
|
||||||
|
|
||||||
this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(),
|
this->GetGlobalGenerator()->WriteBuild(this->GetBuildFileStream(),
|
||||||
comment,
|
comment,
|
||||||
rule,
|
rule,
|
||||||
|
@ -648,7 +665,10 @@ cmNinjaTargetGenerator
|
||||||
explicitDeps,
|
explicitDeps,
|
||||||
implicitDeps,
|
implicitDeps,
|
||||||
orderOnlyDeps,
|
orderOnlyDeps,
|
||||||
vars);
|
vars,
|
||||||
|
rspfile,
|
||||||
|
commandLineLengthLimit);
|
||||||
|
|
||||||
|
|
||||||
if(const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
|
if(const char* objectOutputs = source->GetProperty("OBJECT_OUTPUTS")) {
|
||||||
std::vector<std::string> outputList;
|
std::vector<std::string> outputList;
|
||||||
|
@ -795,3 +815,10 @@ void cmNinjaTargetGenerator::addPoolNinjaVariable(
|
||||||
vars["pool"] = pool;
|
vars["pool"] = pool;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmNinjaTargetGenerator::ForceResponseFile()
|
||||||
|
{
|
||||||
|
static std::string const forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
|
||||||
|
return (this->GetMakefile()->IsDefinitionSet(forceRspFile) ||
|
||||||
|
cmSystemTools::GetEnv(forceRspFile) != 0);
|
||||||
|
}
|
||||||
|
|
|
@ -152,6 +152,8 @@ protected:
|
||||||
cmGeneratorTarget* target,
|
cmGeneratorTarget* target,
|
||||||
cmNinjaVars& vars);
|
cmNinjaVars& vars);
|
||||||
|
|
||||||
|
bool ForceResponseFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cmLocalNinjaGenerator* LocalGenerator;
|
cmLocalNinjaGenerator* LocalGenerator;
|
||||||
/// List of object files for this target.
|
/// List of object files for this target.
|
||||||
|
|
Loading…
Reference in New Issue