diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-04-08 13:55:34 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2019-04-11 17:15:50 (GMT) |
commit | 5d2e1404bdfa83eeae5b361bd7d8a882aadc7242 (patch) | |
tree | 8aa8c0f88ed78d8fc15031587655c396813247b5 /Source/cmGhsMultiTargetGenerator.cxx | |
parent | b6bfa7eeb29937fbed44153518abfa4f28b9aa62 (diff) | |
download | CMake-5d2e1404bdfa83eeae5b361bd7d8a882aadc7242.zip CMake-5d2e1404bdfa83eeae5b361bd7d8a882aadc7242.tar.gz CMake-5d2e1404bdfa83eeae5b361bd7d8a882aadc7242.tar.bz2 |
GHS: Update project layout to build targets correctly
-- Restructure projects and files to support proper building of targets
Build order is determined by hierarchy of project files and folders
Custom targets may have been run multiple times in the original file / folder structure
-- Default to build targets that are part of ALL target
-- List all known targets for this project
Includes global targets for ALL_BUILD and INSTALL
-- Compute build order for building targets
Diffstat (limited to 'Source/cmGhsMultiTargetGenerator.cxx')
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 70 |
1 files changed, 32 insertions, 38 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 51d08cb..f59d410 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -13,13 +13,13 @@ #include "cmMakefile.h" #include "cmOutputConverter.h" #include "cmSourceFile.h" +#include "cmSourceFileLocation.h" #include "cmSourceGroup.h" #include "cmStateDirectory.h" #include "cmStateSnapshot.h" #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmTargetDepend.h" #include <algorithm> #include <ostream> @@ -94,6 +94,16 @@ void cmGhsMultiTargetGenerator::Generate() this->TagType = GhsMultiGpj::CUSTOM_TARGET; break; } + case cmStateEnums::GLOBAL_TARGET: { + this->TargetNameReal = this->GeneratorTarget->GetName(); + if (this->TargetNameReal == + this->GetGlobalGenerator()->GetInstallTargetName()) { + this->TagType = GhsMultiGpj::CUSTOM_TARGET; + } else { + return; + } + break; + } default: return; } @@ -120,10 +130,9 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->GetGlobalGenerator()->WriteFileHeader(fout); GhsMultiGpj::WriteGpjTag(this->TagType, fout); - const std::string language( - this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); - if (this->TagType != GhsMultiGpj::CUSTOM_TARGET) { + const std::string language( + this->GeneratorTarget->GetLinkerLanguage(this->ConfigName)); this->WriteTargetSpecifics(fout, this->ConfigName); this->SetCompilerFlags(this->ConfigName, language); this->WriteCompilerFlags(fout, this->ConfigName, language); @@ -132,23 +141,10 @@ void cmGhsMultiTargetGenerator::GenerateTarget() this->WriteTargetLinkLine(fout, this->ConfigName); this->WriteBuildEvents(fout); } - this->WriteReferences(fout); this->WriteSources(fout); - fout.Close(); - // Open the target ref file in copy-if-different mode. - std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); - fname += "/"; - fname += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); - fname += "/"; - fname += this->Name + "_REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; - cmGeneratedFileStream fref(fname); - fref.SetCopyIfDifferent(true); - this->GetGlobalGenerator()->WriteFileHeader(fref); - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); - fref << " :reference=" << fproj << std::endl; - fref.Close(); + this->WriteReferenceFile(fproj); } cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() @@ -739,27 +735,25 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride( } } -void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout) +void cmGhsMultiTargetGenerator::WriteReferenceFile(std::string fproj) { - // FIXME - compare unordered to ordered projects - // also needs transitive build order deps! - // Get the targets that this one depends upon - cmTargetDependSet unordered = - this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget); - cmGlobalGhsMultiGenerator::OrderedTargetDependSet ordered(unordered, - this->Name); - for (auto& t : ordered) { - std::string tname = t->GetName(); - std::string tpath = t->LocalGenerator->GetCurrentBinaryDirectory(); - std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory(); - std::string outpath = - this->LocalGenerator->MaybeConvertToRelativePath(rootpath, tpath) + "/" + - tname + "REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; - - fout << outpath; - fout << " "; - GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fout); - } + // Open the target ref file in copy-if-different mode. + std::string fname = this->LocalGenerator->GetCurrentBinaryDirectory(); + fname += "/"; + fname += this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget); + fname += "/"; + fname += this->Name + "_REF" + cmGlobalGhsMultiGenerator::FILE_EXTENSION; + cmGeneratedFileStream fref(fname); + fref.SetCopyIfDifferent(true); + this->GetGlobalGenerator()->WriteFileHeader(fref); + GhsMultiGpj::WriteGpjTag(GhsMultiGpj::REFERENCE, fref); + fref << " :reference=CMakeFiles/${PROJ_NAME}.project.gpj;" << fproj + << std::endl; + fref.Close(); + + // Store location of the reference file + this->GeneratorTarget->Target->SetProperty("GHS_REFERENCE_PROJECT", + fname.c_str()); } bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp() |