Merge topic 'ninja-minor-refactoring'
67bd514a Ninja: Refactor restat to be a string internally ef42e57d Ninja: Use a TARGET_FILE variable to hold the link output file 592644c4 Tests/BuildDepends: Drop unneeded help for Ninja
This commit is contained in:
commit
3609fceee7
@ -242,7 +242,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule()
|
|||||||
/*deptype*/ "",
|
/*deptype*/ "",
|
||||||
/*rspfile*/ "",
|
/*rspfile*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat*/ true,
|
/*restat*/ "1",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ cmGlobalNinjaGenerator::AddMacOSXContentRule()
|
|||||||
/*deptype*/ "",
|
/*deptype*/ "",
|
||||||
/*rspfile*/ "",
|
/*rspfile*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat*/ false,
|
/*restat*/ "",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
|
|||||||
const std::string& deptype,
|
const std::string& deptype,
|
||||||
const std::string& rspfile,
|
const std::string& rspfile,
|
||||||
const std::string& rspcontent,
|
const std::string& rspcontent,
|
||||||
bool restat,
|
const std::string& restat,
|
||||||
bool generator)
|
bool generator)
|
||||||
{
|
{
|
||||||
// Make sure the rule has a name.
|
// Make sure the rule has a name.
|
||||||
@ -408,10 +408,10 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
|
|||||||
os << "rspfile_content = " << rspcontent << "\n";
|
os << "rspfile_content = " << rspcontent << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(restat)
|
if(!restat.empty())
|
||||||
{
|
{
|
||||||
cmGlobalNinjaGenerator::Indent(os, 1);
|
cmGlobalNinjaGenerator::Indent(os, 1);
|
||||||
os << "restat = 1\n";
|
os << "restat = " << restat << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(generator)
|
if(generator)
|
||||||
@ -607,7 +607,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
|
|||||||
const std::string& deptype,
|
const std::string& deptype,
|
||||||
const std::string& rspfile,
|
const std::string& rspfile,
|
||||||
const std::string& rspcontent,
|
const std::string& rspcontent,
|
||||||
bool restat,
|
const std::string& restat,
|
||||||
bool generator)
|
bool generator)
|
||||||
{
|
{
|
||||||
// Do not add the same rule twice.
|
// Do not add the same rule twice.
|
||||||
@ -1122,7 +1122,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
|
|||||||
/*deptype=*/ "",
|
/*deptype=*/ "",
|
||||||
/*rspfile=*/ "",
|
/*rspfile=*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat=*/ false,
|
/*restat=*/ "",
|
||||||
/*generator=*/ true);
|
/*generator=*/ true);
|
||||||
|
|
||||||
cmLocalNinjaGenerator *ng = static_cast<cmLocalNinjaGenerator *>(lg);
|
cmLocalNinjaGenerator *ng = static_cast<cmLocalNinjaGenerator *>(lg);
|
||||||
@ -1206,7 +1206,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
|
|||||||
/*deptype=*/ "",
|
/*deptype=*/ "",
|
||||||
/*rspfile=*/ "",
|
/*rspfile=*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat=*/ false,
|
/*restat=*/ "",
|
||||||
/*generator=*/ false);
|
/*generator=*/ false);
|
||||||
WriteBuild(os,
|
WriteBuild(os,
|
||||||
"Clean all the built files.",
|
"Clean all the built files.",
|
||||||
@ -1229,7 +1229,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
|
|||||||
/*deptype=*/ "",
|
/*deptype=*/ "",
|
||||||
/*rspfile=*/ "",
|
/*rspfile=*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat=*/ false,
|
/*restat=*/ "",
|
||||||
/*generator=*/ false);
|
/*generator=*/ false);
|
||||||
WriteBuild(os,
|
WriteBuild(os,
|
||||||
"Print all primary targets available.",
|
"Print all primary targets available.",
|
||||||
|
@ -125,7 +125,7 @@ public:
|
|||||||
const std::string& deptype,
|
const std::string& deptype,
|
||||||
const std::string& rspfile,
|
const std::string& rspfile,
|
||||||
const std::string& rspcontent,
|
const std::string& rspcontent,
|
||||||
bool restat,
|
const std::string& restat,
|
||||||
bool generator);
|
bool generator);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -245,7 +245,7 @@ public:
|
|||||||
const std::string& deptype,
|
const std::string& deptype,
|
||||||
const std::string& rspfile,
|
const std::string& rspfile,
|
||||||
const std::string& rspcontent,
|
const std::string& rspcontent,
|
||||||
bool restat,
|
const std::string& restat,
|
||||||
bool generator);
|
bool generator);
|
||||||
|
|
||||||
bool HasRule(const std::string& name);
|
bool HasRule(const std::string& name);
|
||||||
|
@ -194,12 +194,7 @@ cmNinjaNormalTargetGenerator
|
|||||||
|
|
||||||
vars.ObjectDir = "$OBJECT_DIR";
|
vars.ObjectDir = "$OBJECT_DIR";
|
||||||
|
|
||||||
// TODO:
|
vars.Target = "$TARGET_FILE";
|
||||||
// Makefile generator expands <TARGET> to the plain target name
|
|
||||||
// with suffix. $out expands to a relative path. This difference
|
|
||||||
// could make trouble when switching to Ninja generator. Maybe
|
|
||||||
// using TARGET_NAME and RuleVariables::TargetName is a fix.
|
|
||||||
vars.Target = "$out";
|
|
||||||
|
|
||||||
vars.SONameFlag = "$SONAME_FLAG";
|
vars.SONameFlag = "$SONAME_FLAG";
|
||||||
vars.TargetSOName = "$SONAME";
|
vars.TargetSOName = "$SONAME";
|
||||||
@ -252,7 +247,7 @@ cmNinjaNormalTargetGenerator
|
|||||||
<< this->GetVisibleTypeName() << ".";
|
<< this->GetVisibleTypeName() << ".";
|
||||||
cmOStringStream description;
|
cmOStringStream description;
|
||||||
description << "Linking " << this->TargetLinkLanguage << " "
|
description << "Linking " << this->TargetLinkLanguage << " "
|
||||||
<< this->GetVisibleTypeName() << " $out";
|
<< this->GetVisibleTypeName() << " $TARGET_FILE";
|
||||||
this->GetGlobalGenerator()->AddRule(ruleName,
|
this->GetGlobalGenerator()->AddRule(ruleName,
|
||||||
linkCmd,
|
linkCmd,
|
||||||
description.str(),
|
description.str(),
|
||||||
@ -261,7 +256,7 @@ cmNinjaNormalTargetGenerator
|
|||||||
/*deptype*/ "",
|
/*deptype*/ "",
|
||||||
rspfile,
|
rspfile,
|
||||||
rspcontent,
|
rspcontent,
|
||||||
/*restat*/ false,
|
/*restat*/ "",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +278,7 @@ cmNinjaNormalTargetGenerator
|
|||||||
/*deptype*/ "",
|
/*deptype*/ "",
|
||||||
/*rspfile*/ "",
|
/*rspfile*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat*/ false,
|
/*restat*/ "",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
else
|
else
|
||||||
this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_LIBRARY",
|
this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_LIBRARY",
|
||||||
@ -297,7 +292,7 @@ cmNinjaNormalTargetGenerator
|
|||||||
/*deptype*/ "",
|
/*deptype*/ "",
|
||||||
/*rspfile*/ "",
|
/*rspfile*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat*/ false,
|
/*restat*/ "",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -326,7 +321,7 @@ cmNinjaNormalTargetGenerator
|
|||||||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||||
mf->GetRequiredDefinition("CMAKE_COMMAND"),
|
mf->GetRequiredDefinition("CMAKE_COMMAND"),
|
||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
linkCmds.push_back(cmakeCommand + " -E remove $out");
|
linkCmds.push_back(cmakeCommand + " -E remove $TARGET_FILE");
|
||||||
}
|
}
|
||||||
// TODO: Use ARCHIVE_APPEND for archives over a certain size.
|
// TODO: Use ARCHIVE_APPEND for archives over a certain size.
|
||||||
{
|
{
|
||||||
@ -450,6 +445,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
this->GetConfigName());
|
this->GetConfigName());
|
||||||
bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE");
|
bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE");
|
||||||
cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
|
cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
|
||||||
|
|
||||||
|
vars["TARGET_FILE"] =
|
||||||
|
localGen.ConvertToOutputFormat(targetOutputReal, cmLocalGenerator::SHELL);
|
||||||
|
|
||||||
localGen.GetTargetFlags(vars["LINK_LIBRARIES"],
|
localGen.GetTargetFlags(vars["LINK_LIBRARIES"],
|
||||||
vars["FLAGS"],
|
vars["FLAGS"],
|
||||||
vars["LINK_FLAGS"],
|
vars["LINK_FLAGS"],
|
||||||
@ -509,6 +508,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
cmLocalGenerator::SHELL);
|
cmLocalGenerator::SHELL);
|
||||||
vars["TARGET_IMPLIB"] = impLibPath;
|
vars["TARGET_IMPLIB"] = impLibPath;
|
||||||
EnsureParentDirectoryExists(impLibPath);
|
EnsureParentDirectoryExists(impLibPath);
|
||||||
|
if(target.HasImportLibrary())
|
||||||
|
{
|
||||||
|
outputs.push_back(targetOutputImplib);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->SetMsvcTargetPdbVariable(vars))
|
if (!this->SetMsvcTargetPdbVariable(vars))
|
||||||
@ -659,16 +662,6 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->TargetNameImport.empty())
|
|
||||||
{
|
|
||||||
// Since using multiple outputs would mess up the $out variable, use an
|
|
||||||
// alias for the import library.
|
|
||||||
globalGen.WritePhonyBuild(this->GetBuildFileStream(),
|
|
||||||
"Alias for import library.",
|
|
||||||
cmNinjaDeps(1, targetOutputImplib),
|
|
||||||
cmNinjaDeps(1, targetOutputReal));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add aliases for the file name and the target name.
|
// Add aliases for the file name and the target name.
|
||||||
globalGen.AddTargetAlias(this->TargetNameOut, &target);
|
globalGen.AddTargetAlias(this->TargetNameOut, &target);
|
||||||
globalGen.AddTargetAlias(this->GetTargetName(), &target);
|
globalGen.AddTargetAlias(this->GetTargetName(), &target);
|
||||||
|
@ -477,7 +477,7 @@ cmNinjaTargetGenerator
|
|||||||
deptype,
|
deptype,
|
||||||
/*rspfile*/ "",
|
/*rspfile*/ "",
|
||||||
/*rspcontent*/ "",
|
/*rspcontent*/ "",
|
||||||
/*restat*/ false,
|
/*restat*/ "",
|
||||||
/*generator*/ false);
|
/*generator*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,10 +28,6 @@ function(help_xcode_depends)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
if("${CMAKE_GENERATOR}" MATCHES "Ninja")
|
|
||||||
set(HELP_NINJA 1) # TODO Why is this needed?
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# The Intel compiler causes the MSVC linker to crash during
|
# The Intel compiler causes the MSVC linker to crash during
|
||||||
# incremental linking, so avoid the /INCREMENTAL:YES flag.
|
# incremental linking, so avoid the /INCREMENTAL:YES flag.
|
||||||
if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
|
if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
|
||||||
@ -218,7 +214,7 @@ try_compile(RESULT
|
|||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
|
|
||||||
# Xcode is in serious need of help here
|
# Xcode is in serious need of help here
|
||||||
if(HELP_XCODE OR HELP_NINJA)
|
if(HELP_XCODE)
|
||||||
try_compile(RESULT
|
try_compile(RESULT
|
||||||
${BuildDepends_BINARY_DIR}/Project
|
${BuildDepends_BINARY_DIR}/Project
|
||||||
${BuildDepends_SOURCE_DIR}/Project
|
${BuildDepends_SOURCE_DIR}/Project
|
||||||
|
Loading…
x
Reference in New Issue
Block a user