mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 05:11:15 -06:00
GHS: Fix include-what-you-use and clang-tidy diagnostics
We will soon build GHS sources on Linux where we run these lints.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmGhsMultiGpj.h"
|
#include "cmGhsMultiGpj.h"
|
||||||
|
|
||||||
#include "cmGeneratedFileStream.h"
|
#include <ostream>
|
||||||
|
|
||||||
static const char* GHS_TAG[] = { "[INTEGRITY Application]",
|
static const char* GHS_TAG[] = { "[INTEGRITY Application]",
|
||||||
"[Library]",
|
"[Library]",
|
||||||
@@ -11,7 +11,7 @@ static const char* GHS_TAG[] = { "[INTEGRITY Application]",
|
|||||||
"[Reference]",
|
"[Reference]",
|
||||||
"[Subproject]" };
|
"[Subproject]" };
|
||||||
|
|
||||||
const char* GhsMultiGpj::GetGpjTag(Types const gpjType)
|
const char* GhsMultiGpj::GetGpjTag(Types gpjType)
|
||||||
{
|
{
|
||||||
char const* tag;
|
char const* tag;
|
||||||
switch (gpjType) {
|
switch (gpjType) {
|
||||||
@@ -29,7 +29,7 @@ const char* GhsMultiGpj::GetGpjTag(Types const gpjType)
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GhsMultiGpj::WriteGpjTag(Types const gpjType, std::ostream& fout)
|
void GhsMultiGpj::WriteGpjTag(Types gpjType, std::ostream& fout)
|
||||||
{
|
{
|
||||||
char const* tag;
|
char const* tag;
|
||||||
tag = GhsMultiGpj::GetGpjTag(gpjType);
|
tag = GhsMultiGpj::GetGpjTag(gpjType);
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
#include "cmConfigure.h" // IWYU pragma: keep
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
class cmGeneratedFileStream;
|
|
||||||
|
|
||||||
class GhsMultiGpj
|
class GhsMultiGpj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -21,9 +19,9 @@ public:
|
|||||||
SUBPROJECT
|
SUBPROJECT
|
||||||
};
|
};
|
||||||
|
|
||||||
static void WriteGpjTag(Types const gpjType, std::ostream& fout);
|
static void WriteGpjTag(Types gpjType, std::ostream& fout);
|
||||||
|
|
||||||
static const char* GetGpjTag(Types const gpjType);
|
static const char* GetGpjTag(Types gpjType);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ! cmGhsMultiGpjType_h
|
#endif // ! cmGhsMultiGpjType_h
|
||||||
|
|||||||
@@ -2,16 +2,29 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmGhsMultiTargetGenerator.h"
|
#include "cmGhsMultiTargetGenerator.h"
|
||||||
|
|
||||||
#include "cmComputeLinkInformation.h"
|
#include "cmCustomCommand.h"
|
||||||
|
#include "cmCustomCommandLines.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGlobalGhsMultiGenerator.h"
|
#include "cmGlobalGhsMultiGenerator.h"
|
||||||
#include "cmLinkLineComputer.h"
|
#include "cmLinkLineComputer.h"
|
||||||
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmLocalGhsMultiGenerator.h"
|
#include "cmLocalGhsMultiGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmSourceGroup.h"
|
#include "cmSourceGroup.h"
|
||||||
|
#include "cmStateDirectory.h"
|
||||||
|
#include "cmStateSnapshot.h"
|
||||||
|
#include "cmStateTypes.h"
|
||||||
|
#include "cmSystemTools.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
|
#include "cmTargetDepend.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <ostream>
|
||||||
|
#include <set>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
|
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
|
||||||
: GeneratorTarget(target)
|
: GeneratorTarget(target)
|
||||||
@@ -30,9 +43,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
|
cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmGhsMultiTargetGenerator::Generate()
|
void cmGhsMultiTargetGenerator::Generate()
|
||||||
{
|
{
|
||||||
@@ -99,7 +110,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget()
|
|||||||
fname += "/";
|
fname += "/";
|
||||||
fname += this->Name;
|
fname += this->Name;
|
||||||
fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
|
fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
|
||||||
cmGeneratedFileStream fout(fname.c_str());
|
cmGeneratedFileStream fout(fname);
|
||||||
fout.SetCopyIfDifferent(true);
|
fout.SetCopyIfDifferent(true);
|
||||||
|
|
||||||
this->GetGlobalGenerator()->WriteFileHeader(fout);
|
this->GetGlobalGenerator()->WriteFileHeader(fout);
|
||||||
@@ -336,10 +347,9 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGhsMultiTargetGenerator::WriteSourceProperty(std::ostream& fout,
|
void cmGhsMultiTargetGenerator::WriteSourceProperty(
|
||||||
const cmSourceFile* sf,
|
std::ostream& fout, const cmSourceFile* sf, std::string const& propName,
|
||||||
std::string propName,
|
std::string const& propFlag)
|
||||||
std::string propFlag)
|
|
||||||
{
|
{
|
||||||
const char* prop = sf->GetProperty(propName);
|
const char* prop = sf->GetProperty(propName);
|
||||||
if (prop) {
|
if (prop) {
|
||||||
@@ -370,7 +380,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups);
|
this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups);
|
||||||
std::string gn = sourceGroup->GetFullName();
|
std::string gn = sourceGroup->GetFullName();
|
||||||
groupFiles[gn].push_back(sf);
|
groupFiles[gn].push_back(sf);
|
||||||
groupNames.insert(gn);
|
groupNames.insert(std::move(gn));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* list of known groups and the order they are displayed in a project file */
|
/* list of known groups and the order they are displayed in a project file */
|
||||||
@@ -397,7 +407,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ /* catch-all group - is last item */
|
{ /* catch-all group - is last item */
|
||||||
std::string gn = "";
|
std::string gn;
|
||||||
auto n = groupNames.find(gn);
|
auto n = groupNames.find(gn);
|
||||||
if (n != groupNames.end()) {
|
if (n != groupNames.end()) {
|
||||||
groupFilesList.back() = *n;
|
groupFilesList.back() = *n;
|
||||||
@@ -446,7 +456,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
std::string fpath = this->LocalGenerator->GetCurrentBinaryDirectory();
|
std::string fpath = this->LocalGenerator->GetCurrentBinaryDirectory();
|
||||||
fpath += "/";
|
fpath += "/";
|
||||||
fpath += lpath;
|
fpath += lpath;
|
||||||
cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath.c_str());
|
cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath);
|
||||||
f->SetCopyIfDifferent(true);
|
f->SetCopyIfDifferent(true);
|
||||||
gfiles.push_back(f);
|
gfiles.push_back(f);
|
||||||
fout = f;
|
fout = f;
|
||||||
@@ -476,7 +486,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
|||||||
|
|
||||||
if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
|
if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
|
||||||
"bsp" != si->GetExtension()) {
|
"bsp" != si->GetExtension()) {
|
||||||
this->WriteObjectLangOverride(*fout, si);
|
WriteObjectLangOverride(*fout, si);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I");
|
this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I");
|
||||||
@@ -502,9 +512,9 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
|
|||||||
std::ostream& fout, const cmSourceFile* sourceFile)
|
std::ostream& fout, const cmSourceFile* sourceFile)
|
||||||
{
|
{
|
||||||
const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
|
const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
|
||||||
if (NULL != rawLangProp) {
|
if (nullptr != rawLangProp) {
|
||||||
std::string sourceLangProp(rawLangProp);
|
std::string sourceLangProp(rawLangProp);
|
||||||
std::string 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" << std::endl;
|
||||||
}
|
}
|
||||||
@@ -540,20 +550,19 @@ void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp(void)
|
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
|
||||||
{
|
{
|
||||||
const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app");
|
const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app");
|
||||||
if (p) {
|
if (p) {
|
||||||
return cmSystemTools::IsOn(
|
return cmSystemTools::IsOn(
|
||||||
this->GeneratorTarget->GetProperty("ghs_integrity_app"));
|
this->GeneratorTarget->GetProperty("ghs_integrity_app"));
|
||||||
} else {
|
|
||||||
std::vector<cmSourceFile*> sources;
|
|
||||||
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
|
|
||||||
for (auto& sf : sources) {
|
|
||||||
if ("int" == sf->GetExtension()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
std::vector<cmSourceFile*> sources;
|
||||||
|
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
|
||||||
|
for (auto& sf : sources) {
|
||||||
|
if ("int" == sf->GetExtension()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,12 @@
|
|||||||
|
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
|
|
||||||
|
#include <iosfwd>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
class cmCustomCommand;
|
class cmCustomCommand;
|
||||||
class cmGeneratedFileStream;
|
|
||||||
class cmGeneratorTarget;
|
class cmGeneratorTarget;
|
||||||
class cmGlobalGhsMultiGenerator;
|
class cmGlobalGhsMultiGenerator;
|
||||||
class cmLocalGhsMultiGenerator;
|
class cmLocalGhsMultiGenerator;
|
||||||
@@ -51,12 +55,13 @@ private:
|
|||||||
cmTarget::CustomCommandType commandType);
|
cmTarget::CustomCommandType commandType);
|
||||||
void WriteSources(std::ostream& fout_proj);
|
void WriteSources(std::ostream& fout_proj);
|
||||||
void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf,
|
void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf,
|
||||||
std::string propName, std::string propFlag);
|
std::string const& propName,
|
||||||
|
std::string const& propFlag);
|
||||||
void WriteReferences(std::ostream& fout);
|
void WriteReferences(std::ostream& fout);
|
||||||
static void WriteObjectLangOverride(std::ostream& fout,
|
static void WriteObjectLangOverride(std::ostream& fout,
|
||||||
const cmSourceFile* sourceFile);
|
const cmSourceFile* sourceFile);
|
||||||
|
|
||||||
bool DetermineIfIntegrityApp(void);
|
bool DetermineIfIntegrityApp();
|
||||||
cmGeneratorTarget* GeneratorTarget;
|
cmGeneratorTarget* GeneratorTarget;
|
||||||
cmLocalGhsMultiGenerator* LocalGenerator;
|
cmLocalGhsMultiGenerator* LocalGenerator;
|
||||||
cmMakefile* Makefile;
|
cmMakefile* Makefile;
|
||||||
|
|||||||
@@ -2,19 +2,25 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmGlobalGhsMultiGenerator.h"
|
#include "cmGlobalGhsMultiGenerator.h"
|
||||||
|
|
||||||
#include "cmsys/SystemTools.hxx"
|
|
||||||
|
|
||||||
#include "cmAlgorithms.h"
|
|
||||||
#include "cmDocumentationEntry.h"
|
#include "cmDocumentationEntry.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGhsMultiTargetGenerator.h"
|
#include "cmGhsMultiGpj.h"
|
||||||
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmLocalGhsMultiGenerator.h"
|
#include "cmLocalGhsMultiGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmState.h"
|
#include "cmState.h"
|
||||||
|
#include "cmStateTypes.h"
|
||||||
|
#include "cmSystemTools.h"
|
||||||
#include "cmVersion.h"
|
#include "cmVersion.h"
|
||||||
#include "cmake.h"
|
#include "cmake.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <map>
|
||||||
|
#include <ostream>
|
||||||
|
#include <string.h>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
|
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
|
||||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
|
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
|
||||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
|
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
|
||||||
@@ -25,9 +31,7 @@ cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
|
|||||||
cm->GetState()->SetGhsMultiIDE(true);
|
cm->GetState()->SetGhsMultiIDE(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
|
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
cmLocalGenerator* cmGlobalGhsMultiGenerator::CreateLocalGenerator(
|
cmLocalGenerator* cmGlobalGhsMultiGenerator::CreateLocalGenerator(
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
@@ -64,7 +68,8 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
|||||||
/* no toolset was found */
|
/* no toolset was found */
|
||||||
if (tsp.empty()) {
|
if (tsp.empty()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (ts.empty()) {
|
}
|
||||||
|
if (ts.empty()) {
|
||||||
std::string message;
|
std::string message;
|
||||||
message =
|
message =
|
||||||
"Green Hills MULTI: -T <toolset> not specified; defaulting to \"";
|
"Green Hills MULTI: -T <toolset> not specified; defaulting to \"";
|
||||||
@@ -86,7 +91,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
|||||||
const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
|
const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
|
|
||||||
/* check if the toolset changed from last generate */
|
/* check if the toolset changed from last generate */
|
||||||
if (prevTool != NULL && (gbuild != prevTool)) {
|
if (prevTool != nullptr && (gbuild != prevTool)) {
|
||||||
std::string message = "toolset build tool: ";
|
std::string message = "toolset build tool: ";
|
||||||
message += gbuild;
|
message += gbuild;
|
||||||
message += "\nDoes not match the previously used build tool: ";
|
message += "\nDoes not match the previously used build tool: ";
|
||||||
@@ -95,13 +100,12 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
|||||||
"directory or choose a different binary directory.";
|
"directory or choose a different binary directory.";
|
||||||
cmSystemTools::Error(message);
|
cmSystemTools::Error(message);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
/* store the toolset that is being used for this build */
|
|
||||||
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
|
|
||||||
"build program to use", cmStateEnums::INTERNAL,
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* store the toolset that is being used for this build */
|
||||||
|
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
|
||||||
|
"build program to use", cmStateEnums::INTERNAL, true);
|
||||||
|
|
||||||
mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str());
|
mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -110,7 +114,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
|||||||
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
{
|
{
|
||||||
if (p == "") {
|
if (p.empty()) {
|
||||||
cmSystemTools::Message(
|
cmSystemTools::Message(
|
||||||
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
|
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
|
||||||
std::string arch = "arm";
|
std::string arch = "arm";
|
||||||
@@ -202,7 +206,7 @@ void cmGlobalGhsMultiGenerator::WriteFileHeader(std::ostream& fout)
|
|||||||
fout << "#!gbuild" << std::endl;
|
fout << "#!gbuild" << std::endl;
|
||||||
fout << "#" << std::endl
|
fout << "#" << std::endl
|
||||||
<< "# CMAKE generated file: DO NOT EDIT!" << std::endl
|
<< "# CMAKE generated file: DO NOT EDIT!" << std::endl
|
||||||
<< "# Generated by \"" << this->GetActualName() << "\""
|
<< "# Generated by \"" << GetActualName() << "\""
|
||||||
<< " Generator, CMake Version " << cmVersion::GetMajorVersion() << "."
|
<< " Generator, CMake Version " << cmVersion::GetMajorVersion() << "."
|
||||||
<< cmVersion::GetMinorVersion() << std::endl
|
<< cmVersion::GetMinorVersion() << std::endl
|
||||||
<< "#" << std::endl
|
<< "#" << std::endl
|
||||||
@@ -297,7 +301,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(
|
|||||||
if (projName && projType) {
|
if (projName && projType) {
|
||||||
cmLocalGenerator* lg = target->GetLocalGenerator();
|
cmLocalGenerator* lg = target->GetLocalGenerator();
|
||||||
std::string dir = lg->GetCurrentBinaryDirectory();
|
std::string dir = lg->GetCurrentBinaryDirectory();
|
||||||
dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str());
|
dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir);
|
||||||
if (dir == ".") {
|
if (dir == ".") {
|
||||||
dir.clear();
|
dir.clear();
|
||||||
} else {
|
} else {
|
||||||
@@ -320,7 +324,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(
|
|||||||
fname += "REF";
|
fname += "REF";
|
||||||
fname += FILE_EXTENSION;
|
fname += FILE_EXTENSION;
|
||||||
|
|
||||||
cmGeneratedFileStream fref(fname.c_str());
|
cmGeneratedFileStream fref(fname);
|
||||||
fref.SetCopyIfDifferent(true);
|
fref.SetCopyIfDifferent(true);
|
||||||
|
|
||||||
this->WriteFileHeader(fref);
|
this->WriteFileHeader(fref);
|
||||||
@@ -361,7 +365,7 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject(
|
|||||||
fname += ".top";
|
fname += ".top";
|
||||||
fname += FILE_EXTENSION;
|
fname += FILE_EXTENSION;
|
||||||
|
|
||||||
cmGeneratedFileStream fout(fname.c_str());
|
cmGeneratedFileStream fout(fname);
|
||||||
fout.SetCopyIfDifferent(true);
|
fout.SetCopyIfDifferent(true);
|
||||||
|
|
||||||
this->WriteTopLevelProject(fout, root, generators);
|
this->WriteTopLevelProject(fout, root, generators);
|
||||||
@@ -377,9 +381,12 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand(
|
|||||||
std::vector<std::string> const& makeOptions)
|
std::vector<std::string> const& makeOptions)
|
||||||
{
|
{
|
||||||
GeneratedMakeCommand makeCommand = {};
|
GeneratedMakeCommand makeCommand = {};
|
||||||
const char* gbuild =
|
std::string gbuild;
|
||||||
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
if (const char* gbuildCached =
|
||||||
makeCommand.Add(this->SelectMakeProgram(makeProgram, (std::string)gbuild));
|
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM")) {
|
||||||
|
gbuild = gbuildCached;
|
||||||
|
}
|
||||||
|
makeCommand.Add(this->SelectMakeProgram(makeProgram, gbuild));
|
||||||
|
|
||||||
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
|
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
|
||||||
makeCommand.Add("-parallel");
|
makeCommand.Add("-parallel");
|
||||||
@@ -425,7 +432,7 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout)
|
|||||||
{
|
{
|
||||||
char const* ghsGpjMacros =
|
char const* ghsGpjMacros =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
|
||||||
if (NULL != ghsGpjMacros) {
|
if (nullptr != ghsGpjMacros) {
|
||||||
std::vector<std::string> expandedList;
|
std::vector<std::string> expandedList;
|
||||||
cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList);
|
cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList);
|
||||||
for (std::string const& arg : expandedList) {
|
for (std::string const& arg : expandedList) {
|
||||||
@@ -458,7 +465,7 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout)
|
|||||||
|
|
||||||
char const* const customization =
|
char const* const customization =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
||||||
if (NULL != customization && strlen(customization) > 0) {
|
if (nullptr != customization && strlen(customization) > 0) {
|
||||||
fout << "customization=" << trimQuotes(customization) << std::endl;
|
fout << "customization=" << trimQuotes(customization) << std::endl;
|
||||||
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
|
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,20 @@
|
|||||||
|
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
|
|
||||||
#include "cmGhsMultiGpj.h"
|
|
||||||
#include "cmGlobalGeneratorFactory.h"
|
#include "cmGlobalGeneratorFactory.h"
|
||||||
|
#include "cmTargetDepend.h"
|
||||||
|
|
||||||
class cmGeneratedFileStream;
|
#include <iosfwd>
|
||||||
|
#include <set>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class cmGeneratorTarget;
|
||||||
|
class cmLocalGenerator;
|
||||||
|
class cmMakefile;
|
||||||
|
class cmake;
|
||||||
|
struct cmDocumentationEntry;
|
||||||
|
|
||||||
class cmGlobalGhsMultiGenerator : public cmGlobalGenerator
|
class cmGlobalGhsMultiGenerator : public cmGlobalGenerator
|
||||||
{
|
{
|
||||||
@@ -17,7 +27,7 @@ public:
|
|||||||
static const char* FILE_EXTENSION;
|
static const char* FILE_EXTENSION;
|
||||||
|
|
||||||
cmGlobalGhsMultiGenerator(cmake* cm);
|
cmGlobalGhsMultiGenerator(cmake* cm);
|
||||||
~cmGlobalGhsMultiGenerator();
|
~cmGlobalGhsMultiGenerator() override;
|
||||||
|
|
||||||
static cmGlobalGeneratorFactory* NewFactory()
|
static cmGlobalGeneratorFactory* NewFactory()
|
||||||
{
|
{
|
||||||
@@ -31,7 +41,7 @@ public:
|
|||||||
static std::string GetActualName() { return "Green Hills MULTI"; }
|
static std::string GetActualName() { return "Green Hills MULTI"; }
|
||||||
|
|
||||||
///! Get the name for this generator
|
///! Get the name for this generator
|
||||||
std::string GetName() const override { return this->GetActualName(); }
|
std::string GetName() const override { return GetActualName(); }
|
||||||
|
|
||||||
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
|
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
|
||||||
static void GetDocumentation(cmDocumentationEntry& entry);
|
static void GetDocumentation(cmDocumentationEntry& entry);
|
||||||
@@ -77,8 +87,8 @@ public:
|
|||||||
std::string First;
|
std::string First;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TargetCompare(std::string const& first)
|
TargetCompare(std::string first)
|
||||||
: First(first)
|
: First(std::move(first))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
bool operator()(cmGeneratorTarget const* l,
|
bool operator()(cmGeneratorTarget const* l,
|
||||||
|
|||||||
@@ -2,12 +2,15 @@
|
|||||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||||
#include "cmLocalGhsMultiGenerator.h"
|
#include "cmLocalGhsMultiGenerator.h"
|
||||||
|
|
||||||
#include "cmGeneratedFileStream.h"
|
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGhsMultiTargetGenerator.h"
|
#include "cmGhsMultiTargetGenerator.h"
|
||||||
#include "cmGlobalGhsMultiGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmMakefile.h"
|
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
|
#include "cmStateTypes.h"
|
||||||
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
|
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
|
||||||
cmMakefile* mf)
|
cmMakefile* mf)
|
||||||
@@ -15,9 +18,7 @@ cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator()
|
cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
|
std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
|
||||||
cmGeneratorTarget const* target) const
|
cmGeneratorTarget const* target) const
|
||||||
|
|||||||
@@ -5,7 +5,14 @@
|
|||||||
|
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
|
|
||||||
class cmGeneratedFileStream;
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class cmGeneratorTarget;
|
||||||
|
class cmGlobalGenerator;
|
||||||
|
class cmMakefile;
|
||||||
|
class cmSourceFile;
|
||||||
|
|
||||||
/** \class cmLocalGhsMultiGenerator
|
/** \class cmLocalGhsMultiGenerator
|
||||||
* \brief Write Green Hills MULTI project files.
|
* \brief Write Green Hills MULTI project files.
|
||||||
@@ -18,7 +25,7 @@ class cmLocalGhsMultiGenerator : public cmLocalGenerator
|
|||||||
public:
|
public:
|
||||||
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
|
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
|
||||||
|
|
||||||
virtual ~cmLocalGhsMultiGenerator();
|
~cmLocalGhsMultiGenerator() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the makefile for this directory.
|
* Generate the makefile for this directory.
|
||||||
|
|||||||
Reference in New Issue
Block a user