Merge topic 'ninja-minor-refactoring'
67bd514a
Ninja: Refactor restat to be a string internallyef42e57d
Ninja: Use a TARGET_FILE variable to hold the link output file592644c4
Tests/BuildDepends: Drop unneeded help for Ninja
This commit is contained in:
commit
3609fceee7
|
@ -242,7 +242,7 @@ void cmGlobalNinjaGenerator::AddCustomCommandRule()
|
|||
/*deptype*/ "",
|
||||
/*rspfile*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat*/ true,
|
||||
/*restat*/ "1",
|
||||
/*generator*/ false);
|
||||
}
|
||||
|
||||
|
@ -309,7 +309,7 @@ cmGlobalNinjaGenerator::AddMacOSXContentRule()
|
|||
/*deptype*/ "",
|
||||
/*rspfile*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat*/ false,
|
||||
/*restat*/ "",
|
||||
/*generator*/ false);
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
|
|||
const std::string& deptype,
|
||||
const std::string& rspfile,
|
||||
const std::string& rspcontent,
|
||||
bool restat,
|
||||
const std::string& restat,
|
||||
bool generator)
|
||||
{
|
||||
// Make sure the rule has a name.
|
||||
|
@ -408,10 +408,10 @@ void cmGlobalNinjaGenerator::WriteRule(std::ostream& os,
|
|||
os << "rspfile_content = " << rspcontent << "\n";
|
||||
}
|
||||
|
||||
if(restat)
|
||||
if(!restat.empty())
|
||||
{
|
||||
cmGlobalNinjaGenerator::Indent(os, 1);
|
||||
os << "restat = 1\n";
|
||||
os << "restat = " << restat << "\n";
|
||||
}
|
||||
|
||||
if(generator)
|
||||
|
@ -607,7 +607,7 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
|
|||
const std::string& deptype,
|
||||
const std::string& rspfile,
|
||||
const std::string& rspcontent,
|
||||
bool restat,
|
||||
const std::string& restat,
|
||||
bool generator)
|
||||
{
|
||||
// Do not add the same rule twice.
|
||||
|
@ -1122,7 +1122,7 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
|
|||
/*deptype=*/ "",
|
||||
/*rspfile=*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat=*/ false,
|
||||
/*restat=*/ "",
|
||||
/*generator=*/ true);
|
||||
|
||||
cmLocalNinjaGenerator *ng = static_cast<cmLocalNinjaGenerator *>(lg);
|
||||
|
@ -1206,7 +1206,7 @@ void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
|
|||
/*deptype=*/ "",
|
||||
/*rspfile=*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat=*/ false,
|
||||
/*restat=*/ "",
|
||||
/*generator=*/ false);
|
||||
WriteBuild(os,
|
||||
"Clean all the built files.",
|
||||
|
@ -1229,7 +1229,7 @@ void cmGlobalNinjaGenerator::WriteTargetHelp(std::ostream& os)
|
|||
/*deptype=*/ "",
|
||||
/*rspfile=*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat=*/ false,
|
||||
/*restat=*/ "",
|
||||
/*generator=*/ false);
|
||||
WriteBuild(os,
|
||||
"Print all primary targets available.",
|
||||
|
|
|
@ -125,7 +125,7 @@ public:
|
|||
const std::string& deptype,
|
||||
const std::string& rspfile,
|
||||
const std::string& rspcontent,
|
||||
bool restat,
|
||||
const std::string& restat,
|
||||
bool generator);
|
||||
|
||||
/**
|
||||
|
@ -245,7 +245,7 @@ public:
|
|||
const std::string& deptype,
|
||||
const std::string& rspfile,
|
||||
const std::string& rspcontent,
|
||||
bool restat,
|
||||
const std::string& restat,
|
||||
bool generator);
|
||||
|
||||
bool HasRule(const std::string& name);
|
||||
|
|
|
@ -194,12 +194,7 @@ cmNinjaNormalTargetGenerator
|
|||
|
||||
vars.ObjectDir = "$OBJECT_DIR";
|
||||
|
||||
// TODO:
|
||||
// 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.Target = "$TARGET_FILE";
|
||||
|
||||
vars.SONameFlag = "$SONAME_FLAG";
|
||||
vars.TargetSOName = "$SONAME";
|
||||
|
@ -252,7 +247,7 @@ cmNinjaNormalTargetGenerator
|
|||
<< this->GetVisibleTypeName() << ".";
|
||||
cmOStringStream description;
|
||||
description << "Linking " << this->TargetLinkLanguage << " "
|
||||
<< this->GetVisibleTypeName() << " $out";
|
||||
<< this->GetVisibleTypeName() << " $TARGET_FILE";
|
||||
this->GetGlobalGenerator()->AddRule(ruleName,
|
||||
linkCmd,
|
||||
description.str(),
|
||||
|
@ -261,7 +256,7 @@ cmNinjaNormalTargetGenerator
|
|||
/*deptype*/ "",
|
||||
rspfile,
|
||||
rspcontent,
|
||||
/*restat*/ false,
|
||||
/*restat*/ "",
|
||||
/*generator*/ false);
|
||||
}
|
||||
|
||||
|
@ -283,7 +278,7 @@ cmNinjaNormalTargetGenerator
|
|||
/*deptype*/ "",
|
||||
/*rspfile*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat*/ false,
|
||||
/*restat*/ "",
|
||||
/*generator*/ false);
|
||||
else
|
||||
this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_LIBRARY",
|
||||
|
@ -297,7 +292,7 @@ cmNinjaNormalTargetGenerator
|
|||
/*deptype*/ "",
|
||||
/*rspfile*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat*/ false,
|
||||
/*restat*/ "",
|
||||
/*generator*/ false);
|
||||
}
|
||||
}
|
||||
|
@ -326,7 +321,7 @@ cmNinjaNormalTargetGenerator
|
|||
this->GetLocalGenerator()->ConvertToOutputFormat(
|
||||
mf->GetRequiredDefinition("CMAKE_COMMAND"),
|
||||
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.
|
||||
{
|
||||
|
@ -450,6 +445,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
this->GetConfigName());
|
||||
bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE");
|
||||
cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
|
||||
|
||||
vars["TARGET_FILE"] =
|
||||
localGen.ConvertToOutputFormat(targetOutputReal, cmLocalGenerator::SHELL);
|
||||
|
||||
localGen.GetTargetFlags(vars["LINK_LIBRARIES"],
|
||||
vars["FLAGS"],
|
||||
vars["LINK_FLAGS"],
|
||||
|
@ -509,6 +508,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
|||
cmLocalGenerator::SHELL);
|
||||
vars["TARGET_IMPLIB"] = impLibPath;
|
||||
EnsureParentDirectoryExists(impLibPath);
|
||||
if(target.HasImportLibrary())
|
||||
{
|
||||
outputs.push_back(targetOutputImplib);
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
globalGen.AddTargetAlias(this->TargetNameOut, &target);
|
||||
globalGen.AddTargetAlias(this->GetTargetName(), &target);
|
||||
|
|
|
@ -477,7 +477,7 @@ cmNinjaTargetGenerator
|
|||
deptype,
|
||||
/*rspfile*/ "",
|
||||
/*rspcontent*/ "",
|
||||
/*restat*/ false,
|
||||
/*restat*/ "",
|
||||
/*generator*/ false);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,10 +28,6 @@ function(help_xcode_depends)
|
|||
endif()
|
||||
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
|
||||
# incremental linking, so avoid the /INCREMENTAL:YES flag.
|
||||
if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
|
||||
|
@ -218,7 +214,7 @@ try_compile(RESULT
|
|||
OUTPUT_VARIABLE OUTPUT)
|
||||
|
||||
# Xcode is in serious need of help here
|
||||
if(HELP_XCODE OR HELP_NINJA)
|
||||
if(HELP_XCODE)
|
||||
try_compile(RESULT
|
||||
${BuildDepends_BINARY_DIR}/Project
|
||||
${BuildDepends_SOURCE_DIR}/Project
|
||||
|
|
Loading…
Reference in New Issue