diff options
author | Fred Baksik <frodak17@gmail.com> | 2019-01-05 16:01:21 (GMT) |
---|---|---|
committer | Fred Baksik <frodak17@gmail.com> | 2019-01-16 15:41:20 (GMT) |
commit | ead7117afda23d7cf0c1466ce5229d06240d3de0 (patch) | |
tree | d6f73008a1c387f27d3ef3834681ac5edd8c3897 /Source/cmGhsMultiTargetGenerator.cxx | |
parent | e7825386e2e9e69728e5a5c3dcbc94814bb7cb1c (diff) | |
download | CMake-ead7117afda23d7cf0c1466ce5229d06240d3de0.zip CMake-ead7117afda23d7cf0c1466ce5229d06240d3de0.tar.gz CMake-ead7117afda23d7cf0c1466ce5229d06240d3de0.tar.bz2 |
GHS: Update the top-level project generation
-- Sort targets by name
-- Generate a top-level project for each project command named as project.top.gpj
Use the target set for the current project instead of assuming all targets
-- Add support for building projects not in binary root
-- Directly create files and pass ostream
-- Do no generate project files for UTILITY targets; this was never supported
-- Do no generate project files for OBJECT, SHARED, or MODULE libraries; this was never supported
-- Update GHS tags to support project types
NOTE: The default tag is changed to "" because "[ ]" is an invalid token in project file
Diffstat (limited to 'Source/cmGhsMultiTargetGenerator.cxx')
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 70 |
1 files changed, 50 insertions, 20 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 4fcc63d..0e0607d 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -101,10 +101,59 @@ std::string cmGhsMultiTargetGenerator::AddSlashIfNeededToPath( void cmGhsMultiTargetGenerator::Generate() { + // Determine type of target for this project + switch (this->GeneratorTarget->GetType()) { + case cmStateEnums::EXECUTABLE: { + if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup( + this->GeneratorTarget)) { + this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION; + } else { + this->TagType = GhsMultiGpj::PROGRAM; + } + break; + } + case cmStateEnums::STATIC_LIBRARY: { + this->TagType = GhsMultiGpj::LIBRARY; + break; + } + case cmStateEnums::SHARED_LIBRARY: { + std::string msg = "add_library(<name> SHARED ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + case cmStateEnums::OBJECT_LIBRARY: { + std::string msg = "add_library(<name> OBJECT ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + case cmStateEnums::MODULE_LIBRARY: { + std::string msg = "add_library(<name> MODULE ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + case cmStateEnums::UTILITY: { + std::string msg = "add_custom_target(<name> ...) not supported: "; + msg += this->Name; + cmSystemTools::Message(msg.c_str()); + return; + } + default: + return; + } // Tell the global generator the name of the project file this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME", this->Name.c_str()); + this->GeneratorTarget->Target->SetProperty( + "GENERATOR_FILE_NAME_EXT", GhsMultiGpj::GetGpjTag(this->TagType)); + + this->GenerateTarget(); +} +void cmGhsMultiTargetGenerator::GenerateTarget() +{ // Skip if empty or not included in build if (!this->GetSources().empty() && this->IncludeThisTarget()) { @@ -129,7 +178,7 @@ void cmGhsMultiTargetGenerator::Generate() if (this->DynamicDownload) { fout << "#component integrity_dynamic_download" << std::endl; } - GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), &fout); + GhsMultiGpj::WriteGpjTag(this->TagType, &fout); cmGlobalGhsMultiGenerator::WriteDisclaimer(&fout); bool const notKernel = this->IsNotKernel(config, language); @@ -168,25 +217,6 @@ std::vector<cmSourceFile*> cmGhsMultiTargetGenerator::GetSources() const return output; } -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const -{ - return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget); -} - -GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag( - const cmGeneratorTarget* target) -{ - GhsMultiGpj::Types output; - if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) { - output = GhsMultiGpj::INTERGRITY_APPLICATION; - } else if (target->GetType() == cmStateEnums::STATIC_LIBRARY) { - output = GhsMultiGpj::LIBRARY; - } else { - output = GhsMultiGpj::PROGRAM; - } - return output; -} - cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator() const { |