From 14f3ba205989a422f1668073a325b057cece0b32 Mon Sep 17 00:00:00 2001 From: Fred Baksik Date: Sat, 5 Jan 2019 11:01:22 -0500 Subject: GHS: EXCLUDE_FROM_ALL updates -- Excluded targets should be generated but not included in build ALL -- Use the correct source list for this configuration when writing sources --- Source/cmGhsMultiTargetGenerator.cxx | 79 +++++++++++++----------------------- Source/cmGhsMultiTargetGenerator.h | 3 -- Source/cmGlobalGhsMultiGenerator.cxx | 19 ++------- Source/cmGlobalGhsMultiGenerator.h | 2 - 4 files changed, 33 insertions(+), 70 deletions(-) diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 0cd6312..5e6224f 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -108,56 +108,34 @@ void cmGhsMultiTargetGenerator::Generate() void cmGhsMultiTargetGenerator::GenerateTarget() { - // Skip if empty or not included in build - if (!this->GetSources().empty() && this->IncludeThisTarget()) { - - // Open the filestream in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->Name; - fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fout(fname.c_str()); - fout.SetCopyIfDifferent(true); - - this->GetGlobalGenerator()->WriteFileHeader(fout); - GhsMultiGpj::WriteGpjTag(this->TagType, fout); - const std::string language( - this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - this->DynamicDownload = - this->DetermineIfDynamicDownload(this->ConfigName, language); - if (this->DynamicDownload) { - fout << "#component integrity_dynamic_download" << std::endl; - } - this->WriteTargetSpecifics(fout, this->ConfigName); - this->SetCompilerFlags(this->ConfigName, language); - this->WriteCompilerFlags(fout, this->ConfigName, language); - this->WriteCompilerDefinitions(fout, this->ConfigName, language); - this->WriteIncludes(fout, this->ConfigName, language); - this->WriteTargetLinkLine(fout, this->ConfigName); - this->WriteCustomCommands(fout); - this->WriteSources(fout); - - fout.Close(); - } -} - -bool cmGhsMultiTargetGenerator::IncludeThisTarget() -{ - bool output = true; - char const* excludeFromAll = - this->GeneratorTarget->GetProperty("EXCLUDE_FROM_ALL"); - if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { - output = false; + // Open the filestream in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->Name; + fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fout(fname.c_str()); + fout.SetCopyIfDifferent(true); + + this->GetGlobalGenerator()->WriteFileHeader(fout); + GhsMultiGpj::WriteGpjTag(this->TagType, fout); + + const std::string language( + this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); + this->DynamicDownload = + this->DetermineIfDynamicDownload(this->ConfigName, language); + if (this->DynamicDownload) { + fout << "#component integrity_dynamic_download" << std::endl; } - return output; -} - -std::vector cmGhsMultiTargetGenerator::GetSources() const -{ - std::vector output; - this->GeneratorTarget->GetSourceFiles(output, this->ConfigName); - return output; + this->WriteTargetSpecifics(fout, this->ConfigName); + this->SetCompilerFlags(this->ConfigName, language); + this->WriteCompilerFlags(fout, this->ConfigName, language); + this->WriteCompilerDefinitions(fout, this->ConfigName, language); + this->WriteIncludes(fout, this->ConfigName, language); + this->WriteTargetLinkLine(fout, this->ConfigName); + this->WriteCustomCommands(fout); + this->WriteSources(fout); + + fout.Close(); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -431,7 +409,8 @@ cmGhsMultiTargetGenerator::GetObjectNames( void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj) { /* vector of all sources for this target */ - std::vector sources = this->GetSources(); + std::vector sources; + this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName); /* vector of all groups defined for this target * -- but the vector is not expanded with sub groups or in any useful order diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h index 343044a..5d67112 100644 --- a/Source/cmGhsMultiTargetGenerator.h +++ b/Source/cmGhsMultiTargetGenerator.h @@ -24,9 +24,6 @@ public: virtual void Generate(); - bool IncludeThisTarget(); - std::vector GetSources() const; - private: cmGlobalGhsMultiGenerator* GetGlobalGenerator() const; diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx index 452a610..f2f43e3 100644 --- a/Source/cmGlobalGhsMultiGenerator.cxx +++ b/Source/cmGlobalGhsMultiGenerator.cxx @@ -311,6 +311,10 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects( dir += "/"; } } + + if (cmSystemTools::IsOn(target->GetProperty("EXCLUDE_FROM_ALL"))) { + fout << "{comment} "; + } fout << dir << projName << FILE_EXTENSION; fout << " " << projType << std::endl; } @@ -441,21 +445,6 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout) } } -bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget* tgt) -{ - const std::string config = - tgt->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); - std::vector tgtSources; - tgt->GetSourceFiles(tgtSources, config); - bool tgtInBuild = true; - char const* excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); - if (NULL != excludeFromAll && '1' == excludeFromAll[0] && - '\0' == excludeFromAll[1]) { - tgtInBuild = false; - } - return !tgtSources.empty() && tgtInBuild; -} - std::string cmGlobalGhsMultiGenerator::trimQuotes(std::string const& str) { std::string result; diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h index 71c0b48..d926575 100644 --- a/Source/cmGlobalGhsMultiGenerator.h +++ b/Source/cmGlobalGhsMultiGenerator.h @@ -111,8 +111,6 @@ private: void WriteSubProjects(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); - bool IsTgtForBuild(const cmGeneratorTarget* tgt); - std::string trimQuotes(std::string const& str); static const char* DEFAULT_BUILD_PROGRAM; -- cgit v0.12