Refactor: Avoid std::endl
where it's not necessary (part 3)
The `std::endl` manipulator, except inserting `\n` character, also performs `os.flush()`, which may lead to undesired effects (like disk I/O in the middle of forming data strings). For the `std::stringstream` it also has no meaning. * replace multiple `operator<<` calls on a string literal w/ the only call and the only (bigger) string literal; * replace one character string literal used in `operator<<` w/ a char literal.
This commit is contained in:
parent
7099db5dd4
commit
8e3a65d963
@ -165,13 +165,15 @@ void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
|
|||||||
outpath = this->GeneratorTarget->GetDirectory(config);
|
outpath = this->GeneratorTarget->GetDirectory(config);
|
||||||
outpath =
|
outpath =
|
||||||
this->LocalGenerator->MaybeConvertToRelativePath(rootpath, outpath);
|
this->LocalGenerator->MaybeConvertToRelativePath(rootpath, outpath);
|
||||||
fout << " :binDirRelative=\"" << outpath << "\"" << std::endl;
|
/* clang-format off */
|
||||||
fout << " -o \"" << this->TargetNameReal << "\"" << std::endl;
|
fout << " :binDirRelative=\"" << outpath << "\"\n"
|
||||||
|
" -o \"" << this->TargetNameReal << "\"\n";
|
||||||
|
/* clang-format on */
|
||||||
}
|
}
|
||||||
|
|
||||||
// set target object file destination
|
// set target object file destination
|
||||||
outpath = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
outpath = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
||||||
fout << " :outputDirRelative=\"" << outpath << "\"" << std::endl;
|
fout << " :outputDirRelative=\"" << outpath << "\"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
|
void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
|
||||||
@ -232,7 +234,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
|
|||||||
std::vector<std::string> ghsCompFlags =
|
std::vector<std::string> ghsCompFlags =
|
||||||
cmSystemTools::ParseArguments(flagsByLangI->second);
|
cmSystemTools::ParseArguments(flagsByLangI->second);
|
||||||
for (const std::string& f : ghsCompFlags) {
|
for (const std::string& f : ghsCompFlags) {
|
||||||
fout << " " << f << std::endl;
|
fout << " " << f << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,7 +247,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
|
|||||||
this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config,
|
this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config,
|
||||||
language);
|
language);
|
||||||
for (std::string const& compileDefinition : compileDefinitions) {
|
for (std::string const& compileDefinition : compileDefinitions) {
|
||||||
fout << " -D" << compileDefinition << std::endl;
|
fout << " -D" << compileDefinition << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,7 +260,7 @@ void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout,
|
|||||||
language, config);
|
language, config);
|
||||||
|
|
||||||
for (std::string const& include : includes) {
|
for (std::string const& include : includes) {
|
||||||
fout << " -I\"" << include << "\"" << std::endl;
|
fout << " -I\"" << include << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,14 +289,14 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
|
|||||||
// write out link options
|
// write out link options
|
||||||
std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
|
std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
|
||||||
for (const std::string& l : lopts) {
|
for (const std::string& l : lopts) {
|
||||||
fout << " " << l << std::endl;
|
fout << " " << l << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out link search paths
|
// write out link search paths
|
||||||
// must be quoted for paths that contain spaces
|
// must be quoted for paths that contain spaces
|
||||||
std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
|
std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
|
||||||
for (const std::string& l : lpath) {
|
for (const std::string& l : lpath) {
|
||||||
fout << " -L\"" << l << "\"" << std::endl;
|
fout << " -L\"" << l << "\"\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// write out link libs
|
// write out link libs
|
||||||
@ -305,10 +307,10 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
|
|||||||
cmSystemTools::ParseArguments(linkLibraries);
|
cmSystemTools::ParseArguments(linkLibraries);
|
||||||
for (const std::string& l : llibs) {
|
for (const std::string& l : llibs) {
|
||||||
if (l.compare(0, 2, "-l") == 0) {
|
if (l.compare(0, 2, "-l") == 0) {
|
||||||
fout << " \"" << l << "\"" << std::endl;
|
fout << " \"" << l << "\"\n";
|
||||||
} else {
|
} else {
|
||||||
std::string rl = cmSystemTools::CollapseFullPath(l, cbd);
|
std::string rl = cmSystemTools::CollapseFullPath(l, cbd);
|
||||||
fout << " -l\"" << rl << "\"" << std::endl;
|
fout << " -l\"" << rl << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -349,13 +351,12 @@ void cmGhsMultiTargetGenerator::WriteBuildEventsHelper(
|
|||||||
this->WriteCustomCommandsHelper(f, ccg);
|
this->WriteCustomCommandsHelper(f, ccg);
|
||||||
f.Close();
|
f.Close();
|
||||||
if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) {
|
if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) {
|
||||||
fout << " :" << cmd << "=\"" << fname << "\"" << std::endl;
|
fout << " :" << cmd << "=\"" << fname << "\"\n";
|
||||||
} else {
|
} else {
|
||||||
fout << fname << std::endl;
|
fout << fname << "\n :outputName=\"" << fname << ".rule\"\n";
|
||||||
fout << " :outputName=\"" << fname << ".rule\"" << std::endl;
|
|
||||||
}
|
}
|
||||||
for (auto& byp : ccg.GetByproducts()) {
|
for (auto& byp : ccg.GetByproducts()) {
|
||||||
fout << " :extraOutputFile=\"" << byp << "\"" << std::endl;
|
fout << " :extraOutputFile=\"" << byp << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -447,8 +448,7 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
|
|||||||
|
|
||||||
// push back the custom commands
|
// push back the custom commands
|
||||||
for (auto const& c : cmdLines) {
|
for (auto const& c : cmdLines) {
|
||||||
fout << c << std::endl;
|
fout << c << '\n' << check_error << '\n';
|
||||||
fout << check_error << std::endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
|
|||||||
if (prop) {
|
if (prop) {
|
||||||
std::vector<std::string> list = cmExpandedList(prop);
|
std::vector<std::string> list = cmExpandedList(prop);
|
||||||
for (const std::string& p : list) {
|
for (const std::string& p : list) {
|
||||||
fout << " " << propFlag << p << std::endl;
|
fout << " " << propFlag << p << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -575,12 +575,12 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
|
|
||||||
if (useProjectFile) {
|
if (useProjectFile) {
|
||||||
if (sg.empty()) {
|
if (sg.empty()) {
|
||||||
*fout << "{comment} Others" << std::endl;
|
*fout << "{comment} Others" << '\n';
|
||||||
} else {
|
} else {
|
||||||
*fout << "{comment} " << sg << std::endl;
|
*fout << "{comment} " << sg << '\n';
|
||||||
}
|
}
|
||||||
} else if (sg.empty()) {
|
} else if (sg.empty()) {
|
||||||
*fout << "{comment} Others" << std::endl;
|
*fout << "{comment} Others\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sg != "CMake Rules") {
|
if (sg != "CMake Rules") {
|
||||||
@ -608,7 +608,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
compile = false;
|
compile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*fout << comment << fname << std::endl;
|
*fout << comment << fname << '\n';
|
||||||
if (compile) {
|
if (compile) {
|
||||||
if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
|
if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
|
||||||
"bsp" != si->GetExtension()) {
|
"bsp" != si->GetExtension()) {
|
||||||
@ -624,7 +624,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
std::string objectName = this->GeneratorTarget->GetObjectName(si);
|
std::string objectName = this->GeneratorTarget->GetObjectName(si);
|
||||||
if (!objectName.empty() &&
|
if (!objectName.empty() &&
|
||||||
this->GeneratorTarget->HasExplicitObjectName(si)) {
|
this->GeneratorTarget->HasExplicitObjectName(si)) {
|
||||||
*fout << " -o " << objectName << std::endl;
|
*fout << " -o " << objectName << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -691,14 +691,14 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandLine(
|
|||||||
*/
|
*/
|
||||||
bool specifyExtra = true;
|
bool specifyExtra = true;
|
||||||
for (auto& out : ccg.GetOutputs()) {
|
for (auto& out : ccg.GetOutputs()) {
|
||||||
fout << fname << std::endl;
|
fout << fname << '\n';
|
||||||
fout << " :outputName=\"" << out << "\"" << std::endl;
|
fout << " :outputName=\"" << out << "\"\n";
|
||||||
if (specifyExtra) {
|
if (specifyExtra) {
|
||||||
for (auto& byp : ccg.GetByproducts()) {
|
for (auto& byp : ccg.GetByproducts()) {
|
||||||
fout << " :extraOutputFile=\"" << byp << "\"" << std::endl;
|
fout << " :extraOutputFile=\"" << byp << "\"\n";
|
||||||
}
|
}
|
||||||
for (auto& dep : ccg.GetDepends()) {
|
for (auto& dep : ccg.GetDepends()) {
|
||||||
fout << " :depends=\"" << dep << "\"" << std::endl;
|
fout << " :depends=\"" << dep << "\"\n";
|
||||||
}
|
}
|
||||||
specifyExtra = false;
|
specifyExtra = false;
|
||||||
}
|
}
|
||||||
@ -713,7 +713,7 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
|
|||||||
std::string sourceLangProp(rawLangProp);
|
std::string sourceLangProp(rawLangProp);
|
||||||
std::string const& extension = sourceFile->GetExtension();
|
std::string const& extension = sourceFile->GetExtension();
|
||||||
if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
|
if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
|
||||||
fout << " -dotciscxx" << std::endl;
|
fout << " -dotciscxx\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -254,14 +254,15 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
|
|||||||
|
|
||||||
void cmGlobalGhsMultiGenerator::WriteFileHeader(std::ostream& fout)
|
void cmGlobalGhsMultiGenerator::WriteFileHeader(std::ostream& fout)
|
||||||
{
|
{
|
||||||
fout << "#!gbuild" << std::endl;
|
/* clang-format off */
|
||||||
fout << "#" << std::endl
|
fout << "#!gbuild\n"
|
||||||
<< "# CMAKE generated file: DO NOT EDIT!" << std::endl
|
"#\n"
|
||||||
<< "# Generated by \"" << GetActualName() << "\""
|
"# CMAKE generated file: DO NOT EDIT!\n"
|
||||||
<< " Generator, CMake Version " << cmVersion::GetMajorVersion() << "."
|
"# Generated by \"" << GetActualName() << "\""
|
||||||
<< cmVersion::GetMinorVersion() << std::endl
|
" Generator, CMake Version " << cmVersion::GetMajorVersion() << '.'
|
||||||
<< "#" << std::endl
|
<< cmVersion::GetMinorVersion() << "\n"
|
||||||
<< std::endl;
|
"#\n\n";
|
||||||
|
/* clang-format on */
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalGhsMultiGenerator::WriteCustomRuleBOD(std::ostream& fout)
|
void cmGlobalGhsMultiGenerator::WriteCustomRuleBOD(std::ostream& fout)
|
||||||
@ -269,36 +270,36 @@ void cmGlobalGhsMultiGenerator::WriteCustomRuleBOD(std::ostream& fout)
|
|||||||
fout << "Commands {\n"
|
fout << "Commands {\n"
|
||||||
" Custom_Rule_Command {\n"
|
" Custom_Rule_Command {\n"
|
||||||
" name = \"Custom Rule Command\"\n"
|
" name = \"Custom Rule Command\"\n"
|
||||||
" exec = \"";
|
" exec = \""
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fout << "cmd.exe";
|
"cmd.exe"
|
||||||
#else
|
#else
|
||||||
fout << "/bin/sh";
|
"/bin/sh"
|
||||||
#endif
|
#endif
|
||||||
fout << "\"\n"
|
"\"\n"
|
||||||
" options = {\"SpecialOptions\"}\n"
|
" options = {\"SpecialOptions\"}\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n"
|
||||||
|
|
||||||
fout << "\n\n";
|
"\n\n"
|
||||||
fout << "FileTypes {\n"
|
"FileTypes {\n"
|
||||||
" CmakeRule {\n"
|
" CmakeRule {\n"
|
||||||
" name = \"Custom Rule\"\n"
|
" name = \"Custom Rule\"\n"
|
||||||
" action = \"&Run\"\n"
|
" action = \"&Run\"\n"
|
||||||
" extensions = {\"";
|
" extensions = {\""
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fout << "bat";
|
"bat"
|
||||||
#else
|
#else
|
||||||
fout << "sh";
|
"sh"
|
||||||
#endif
|
#endif
|
||||||
fout << "\"}\n"
|
"\"}\n"
|
||||||
" grepable = false\n"
|
" grepable = false\n"
|
||||||
" command = \"Custom Rule Command\"\n"
|
" command = \"Custom Rule Command\"\n"
|
||||||
" commandLine = \"$COMMAND ";
|
" commandLine = \"$COMMAND "
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fout << "/c";
|
"/c"
|
||||||
#endif
|
#endif
|
||||||
fout << " $INPUTFILE\"\n"
|
" $INPUTFILE\"\n"
|
||||||
" progress = \"Processing Custom Rule\"\n"
|
" progress = \"Processing Custom Rule\"\n"
|
||||||
" promoteToFirstPass = true\n"
|
" promoteToFirstPass = true\n"
|
||||||
" outputType = \"None\"\n"
|
" outputType = \"None\"\n"
|
||||||
@ -328,13 +329,13 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
|
|||||||
this->WriteHighLevelDirectives(root, fout);
|
this->WriteHighLevelDirectives(root, fout);
|
||||||
GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout);
|
GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, fout);
|
||||||
|
|
||||||
fout << "# Top Level Project File" << std::endl;
|
fout << "# Top Level Project File\n";
|
||||||
|
|
||||||
// Specify BSP option if supplied by user
|
// Specify BSP option if supplied by user
|
||||||
const char* bspName =
|
const char* bspName =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
|
||||||
if (!cmIsOff(bspName)) {
|
if (!cmIsOff(bspName)) {
|
||||||
fout << " -bsp " << bspName << std::endl;
|
fout << " -bsp " << bspName << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specify OS DIR if supplied by user
|
// Specify OS DIR if supplied by user
|
||||||
@ -349,14 +350,14 @@ void cmGlobalGhsMultiGenerator::WriteTopLevelProject(std::ostream& fout,
|
|||||||
} else {
|
} else {
|
||||||
fout << osDirOption;
|
fout << osDirOption;
|
||||||
}
|
}
|
||||||
fout << "\"" << this->OsDir << "\"" << std::endl;
|
fout << "\"" << this->OsDir << "\"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout,
|
void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout,
|
||||||
std::string& all_target)
|
std::string& all_target)
|
||||||
{
|
{
|
||||||
fout << "CMakeFiles/" << all_target << " [Project]" << std::endl;
|
fout << "CMakeFiles/" << all_target << " [Project]\n";
|
||||||
// All known targets
|
// All known targets
|
||||||
for (cmGeneratorTarget const* target : this->ProjectTargets) {
|
for (cmGeneratorTarget const* target : this->ProjectTargets) {
|
||||||
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
|
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
|
||||||
@ -367,7 +368,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fout << "CMakeFiles/" << target->GetName() + ".tgt" + FILE_EXTENSION
|
fout << "CMakeFiles/" << target->GetName() + ".tgt" + FILE_EXTENSION
|
||||||
<< " [Project]" << std::endl;
|
<< " [Project]\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +392,7 @@ void cmGlobalGhsMultiGenerator::WriteProjectLine(
|
|||||||
|
|
||||||
std::string projFile = dir + projName + FILE_EXTENSION;
|
std::string projFile = dir + projName + FILE_EXTENSION;
|
||||||
fout << projFile;
|
fout << projFile;
|
||||||
fout << " " << projType << std::endl;
|
fout << ' ' << projType << '\n';
|
||||||
} else {
|
} else {
|
||||||
/* Should never happen */
|
/* Should never happen */
|
||||||
std::string message =
|
std::string message =
|
||||||
@ -613,14 +614,14 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand(
|
|||||||
void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
|
void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout,
|
||||||
cmLocalGenerator* root)
|
cmLocalGenerator* root)
|
||||||
{
|
{
|
||||||
fout << "macro PROJ_NAME=" << root->GetProjectName() << std::endl;
|
fout << "macro PROJ_NAME=" << root->GetProjectName() << '\n';
|
||||||
char const* ghsGpjMacros =
|
char const* ghsGpjMacros =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
|
||||||
if (nullptr != ghsGpjMacros) {
|
if (nullptr != ghsGpjMacros) {
|
||||||
std::vector<std::string> expandedList =
|
std::vector<std::string> expandedList =
|
||||||
cmExpandedList(std::string(ghsGpjMacros));
|
cmExpandedList(std::string(ghsGpjMacros));
|
||||||
for (std::string const& arg : expandedList) {
|
for (std::string const& arg : expandedList) {
|
||||||
fout << "macro " << arg << std::endl;
|
fout << "macro " << arg << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -643,17 +644,19 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(
|
|||||||
tgt = cmStrCat((a ? a : ""), '_', (p ? p : ""), ".tgt");
|
tgt = cmStrCat((a ? a : ""), '_', (p ? p : ""), ".tgt");
|
||||||
}
|
}
|
||||||
|
|
||||||
fout << "primaryTarget=" << tgt << std::endl;
|
/* clang-format off */
|
||||||
fout << "customization=" << root->GetBinaryDirectory()
|
fout << "primaryTarget=" << tgt << "\n"
|
||||||
<< "/CMakeFiles/custom_rule.bod" << std::endl;
|
"customization=" << root->GetBinaryDirectory()
|
||||||
fout << "customization=" << root->GetBinaryDirectory()
|
<< "/CMakeFiles/custom_rule.bod\n"
|
||||||
<< "/CMakeFiles/custom_target.bod" << std::endl;
|
"customization=" << root->GetBinaryDirectory()
|
||||||
|
<< "/CMakeFiles/custom_target.bod" << '\n';
|
||||||
|
/* clang-format on */
|
||||||
|
|
||||||
char const* const customization =
|
char const* const customization =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
||||||
if (nullptr != customization && strlen(customization) > 0) {
|
if (nullptr != customization && strlen(customization) > 0) {
|
||||||
fout << "customization="
|
fout << "customization="
|
||||||
<< cmGlobalGhsMultiGenerator::TrimQuotes(customization) << std::endl;
|
<< cmGlobalGhsMultiGenerator::TrimQuotes(customization) << '\n';
|
||||||
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
|
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,13 +298,13 @@ void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& fs,
|
|||||||
const std::string& name)
|
const std::string& name)
|
||||||
{
|
{
|
||||||
auto const escapedGraphName = EscapeForDotFile(name);
|
auto const escapedGraphName = EscapeForDotFile(name);
|
||||||
fs << "digraph \"" << escapedGraphName << "\" {" << std::endl;
|
fs << "digraph \"" << escapedGraphName << "\" {\n"
|
||||||
fs << this->GraphHeader << std::endl;
|
<< this->GraphHeader << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& fs)
|
void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& fs)
|
||||||
{
|
{
|
||||||
fs << "}" << std::endl;
|
fs << "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGraphVizWriter::WriteLegend(cmGeneratedFileStream& fs)
|
void cmGraphVizWriter::WriteLegend(cmGeneratedFileStream& fs)
|
||||||
@ -312,52 +312,46 @@ void cmGraphVizWriter::WriteLegend(cmGeneratedFileStream& fs)
|
|||||||
// Note that the subgraph name must start with "cluster", as done here, to
|
// Note that the subgraph name must start with "cluster", as done here, to
|
||||||
// make Graphviz layout engines do the right thing and keep the nodes
|
// make Graphviz layout engines do the right thing and keep the nodes
|
||||||
// together.
|
// together.
|
||||||
fs << "subgraph clusterLegend {" << std::endl;
|
/* clang-format off */
|
||||||
fs << " label = \"Legend\";" << std::endl;
|
fs << "subgraph clusterLegend {\n"
|
||||||
|
" label = \"Legend\";\n"
|
||||||
// Set the color of the box surrounding the legend.
|
// Set the color of the box surrounding the legend.
|
||||||
fs << " color = black;" << std::endl;
|
" color = black;\n"
|
||||||
// We use invisible edges just to enforce the layout.
|
// We use invisible edges just to enforce the layout.
|
||||||
fs << " edge [ style = invis ];" << std::endl;
|
" edge [ style = invis ];\n"
|
||||||
|
|
||||||
// Nodes.
|
// Nodes.
|
||||||
fs << " legendNode0 [ label = \"Executable\", shape = "
|
" legendNode0 [ label = \"Executable\", shape = "
|
||||||
<< GRAPHVIZ_NODE_SHAPE_EXECUTABLE << " ];" << std::endl;
|
<< GRAPHVIZ_NODE_SHAPE_EXECUTABLE << " ];\n"
|
||||||
|
" legendNode1 [ label = \"Static Library\", shape = "
|
||||||
fs << " legendNode1 [ label = \"Static Library\", shape = "
|
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_STATIC << " ];\n"
|
||||||
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_STATIC << " ];" << std::endl;
|
" legendNode2 [ label = \"Shared Library\", shape = "
|
||||||
fs << " legendNode2 [ label = \"Shared Library\", shape = "
|
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_SHARED << " ];\n"
|
||||||
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_SHARED << " ];" << std::endl;
|
" legendNode3 [ label = \"Module Library\", shape = "
|
||||||
fs << " legendNode3 [ label = \"Module Library\", shape = "
|
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_MODULE << " ];\n"
|
||||||
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_MODULE << " ];" << std::endl;
|
" legendNode4 [ label = \"Interface Library\", shape = "
|
||||||
|
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_INTERFACE << " ];\n"
|
||||||
fs << " legendNode4 [ label = \"Interface Library\", shape = "
|
" legendNode5 [ label = \"Object Library\", shape = "
|
||||||
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_INTERFACE << " ];" << std::endl;
|
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_OBJECT << " ];\n"
|
||||||
fs << " legendNode5 [ label = \"Object Library\", shape = "
|
" legendNode6 [ label = \"Unknown Library\", shape = "
|
||||||
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_OBJECT << " ];" << std::endl;
|
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN << " ];\n"
|
||||||
fs << " legendNode6 [ label = \"Unknown Library\", shape = "
|
" legendNode7 [ label = \"Custom Target\", shape = "
|
||||||
<< GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN << " ];" << std::endl;
|
<< GRAPHVIZ_NODE_SHAPE_UTILITY << " ];\n"
|
||||||
|
|
||||||
fs << " legendNode7 [ label = \"Custom Target\", shape = "
|
|
||||||
<< GRAPHVIZ_NODE_SHAPE_UTILITY << " ];" << std::endl;
|
|
||||||
|
|
||||||
// Edges.
|
// Edges.
|
||||||
// Some of those are dummy (invisible) edges to enforce a layout.
|
// Some of those are dummy (invisible) edges to enforce a layout.
|
||||||
fs << " legendNode0 -> legendNode1 [ style = " << GRAPHVIZ_EDGE_STYLE_PUBLIC
|
" legendNode0 -> legendNode1 [ style = "
|
||||||
<< " ];" << std::endl;
|
<< GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n"
|
||||||
fs << " legendNode0 -> legendNode2 [ style = " << GRAPHVIZ_EDGE_STYLE_PUBLIC
|
" legendNode0 -> legendNode2 [ style = "
|
||||||
<< " ];" << std::endl;
|
<< GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n"
|
||||||
fs << " legendNode0 -> legendNode3;" << std::endl;
|
" legendNode0 -> legendNode3;\n"
|
||||||
|
" legendNode1 -> legendNode4 [ label = \"Interface\", style = "
|
||||||
fs << " legendNode1 -> legendNode4 [ label = \"Interface\", style = "
|
<< GRAPHVIZ_EDGE_STYLE_INTERFACE << " ];\n"
|
||||||
<< GRAPHVIZ_EDGE_STYLE_INTERFACE << " ];" << std::endl;
|
" legendNode2 -> legendNode5 [ label = \"Private\", style = "
|
||||||
fs << " legendNode2 -> legendNode5 [ label = \"Private\", style = "
|
<< GRAPHVIZ_EDGE_STYLE_PRIVATE << " ];\n"
|
||||||
<< GRAPHVIZ_EDGE_STYLE_PRIVATE << " ];" << std::endl;
|
" legendNode3 -> legendNode6 [ style = "
|
||||||
fs << " legendNode3 -> legendNode6 [ style = " << GRAPHVIZ_EDGE_STYLE_PUBLIC
|
<< GRAPHVIZ_EDGE_STYLE_PUBLIC << " ];\n"
|
||||||
<< " ];" << std::endl;
|
" legendNode0 -> legendNode7;\n"
|
||||||
|
"}\n";
|
||||||
fs << " legendNode0 -> legendNode7;" << std::endl;
|
/* clang-format off */
|
||||||
|
|
||||||
fs << "}" << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGraphVizWriter::WriteNode(cmGeneratedFileStream& fs,
|
void cmGraphVizWriter::WriteNode(cmGeneratedFileStream& fs,
|
||||||
@ -370,7 +364,7 @@ void cmGraphVizWriter::WriteNode(cmGeneratedFileStream& fs,
|
|||||||
auto const escapedLabel = EscapeForDotFile(itemNameWithAliases);
|
auto const escapedLabel = EscapeForDotFile(itemNameWithAliases);
|
||||||
|
|
||||||
fs << " \"" << nodeName << "\" [ label = \"" << escapedLabel
|
fs << " \"" << nodeName << "\" [ label = \"" << escapedLabel
|
||||||
<< "\", shape = " << getShapeForTarget(item) << " ];" << std::endl;
|
<< "\", shape = " << getShapeForTarget(item) << " ];\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGraphVizWriter::WriteConnection(cmGeneratedFileStream& fs,
|
void cmGraphVizWriter::WriteConnection(cmGeneratedFileStream& fs,
|
||||||
@ -382,11 +376,9 @@ void cmGraphVizWriter::WriteConnection(cmGeneratedFileStream& fs,
|
|||||||
auto const& dependeeName = dependee.AsStr();
|
auto const& dependeeName = dependee.AsStr();
|
||||||
|
|
||||||
fs << " \"" << this->NodeNames[dependerName] << "\" -> \""
|
fs << " \"" << this->NodeNames[dependerName] << "\" -> \""
|
||||||
<< this->NodeNames[dependeeName] << "\" ";
|
<< this->NodeNames[dependeeName] << "\" "
|
||||||
|
<< edgeStyle
|
||||||
fs << edgeStyle;
|
<< " // " << dependerName << " -> " << dependeeName << '\n';
|
||||||
|
|
||||||
fs << " // " << dependerName << " -> " << dependeeName << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGraphVizWriter::ItemExcluded(cmLinkItem const& item)
|
bool cmGraphVizWriter::ItemExcluded(cmLinkItem const& item)
|
||||||
|
@ -678,7 +678,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string> const& args)
|
|||||||
} else if (!a.empty() && a[0] == '-') {
|
} else if (!a.empty() && a[0] == '-') {
|
||||||
// Environment variable and command names cannot start in '-',
|
// Environment variable and command names cannot start in '-',
|
||||||
// so this must be an unknown option.
|
// so this must be an unknown option.
|
||||||
std::cerr << "cmake -E env: unknown option '" << a << "'"
|
std::cerr << "cmake -E env: unknown option '" << a << '\''
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
} else if (a.find('=') != std::string::npos) {
|
} else if (a.find('=') != std::string::npos) {
|
||||||
@ -1654,11 +1654,13 @@ int cmcmd::WindowsCEEnvironment(const char* version, const std::string& name)
|
|||||||
cmVisualStudioWCEPlatformParser parser(name.c_str());
|
cmVisualStudioWCEPlatformParser parser(name.c_str());
|
||||||
parser.ParseVersion(version);
|
parser.ParseVersion(version);
|
||||||
if (parser.Found()) {
|
if (parser.Found()) {
|
||||||
std::cout << "@echo off" << std::endl;
|
/* clang-format off */
|
||||||
std::cout << "echo Environment Selection: " << name << std::endl;
|
std::cout << "@echo off\n"
|
||||||
std::cout << "set PATH=" << parser.GetPathDirectories() << std::endl;
|
"echo Environment Selection: " << name << "\n"
|
||||||
std::cout << "set INCLUDE=" << parser.GetIncludeDirectories() << std::endl;
|
"set PATH=" << parser.GetPathDirectories() << "\n"
|
||||||
std::cout << "set LIB=" << parser.GetLibraryDirectories() << std::endl;
|
"set INCLUDE=" << parser.GetIncludeDirectories() << "\n"
|
||||||
|
"set LIB=" << parser.GetLibraryDirectories() << std::endl;
|
||||||
|
/* clang-format on */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user