summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/generator/Green Hills MULTI.rst3
-rw-r--r--Modules/Compiler/GHS.cmake2
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx83
-rw-r--r--Source/cmGhsMultiTargetGenerator.h7
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx12
-rw-r--r--Source/cmGlobalGhsMultiGenerator.h2
-rw-r--r--Source/cmLocalGhsMultiGenerator.cxx9
-rw-r--r--Source/cmLocalGhsMultiGenerator.h3
8 files changed, 75 insertions, 46 deletions
diff --git a/Help/generator/Green Hills MULTI.rst b/Help/generator/Green Hills MULTI.rst
index 1b4960d..4ee1427 100644
--- a/Help/generator/Green Hills MULTI.rst
+++ b/Help/generator/Green Hills MULTI.rst
@@ -3,6 +3,9 @@ Green Hills MULTI
Generates Green Hills MULTI project files (experimental, work-in-progress).
+The buildsystem has predetermined build-configuration settings that can be controlled
+via the :variable:`CMAKE_BUILD_TYPE` variable.
+
Customizations that are used to pick toolset and target system:
The ``-A <arch>`` can be supplied for setting the target architecture.
diff --git a/Modules/Compiler/GHS.cmake b/Modules/Compiler/GHS.cmake
index e6a867d..0583a23 100644
--- a/Modules/Compiler/GHS.cmake
+++ b/Modules/Compiler/GHS.cmake
@@ -3,6 +3,6 @@ if(__COMPILER_GHS)
endif()
set(__COMPILER_GHS 1)
-set(CMAKE_EXECUTABLE_SUFFIX ".as")
+set(CMAKE_EXECUTABLE_SUFFIX "")
set(CMAKE_LIBRARY_PATH_TERMINATOR "\n")
set(CMAKE_LIBRARY_PATH_FLAG " -L")
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 0e0607d..7d2af09 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGhsMultiTargetGenerator.h"
+#include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h"
#include "cmGeneratorTarget.h"
#include "cmGlobalGhsMultiGenerator.h"
@@ -35,6 +36,15 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName;
+
+ // Store the configuration name that is being used
+ if (const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE")) {
+ // Use the build type given by the user.
+ this->ConfigName = config;
+ } else {
+ // No configuration type given.
+ this->ConfigName.clear();
+ }
}
cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
@@ -104,6 +114,13 @@ void cmGhsMultiTargetGenerator::Generate()
// Determine type of target for this project
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::EXECUTABLE: {
+ // Get the name of the executable to generate.
+ std::string targetName;
+ std::string targetNameImport;
+ std::string targetNamePDB;
+ this->GeneratorTarget->GetExecutableNames(
+ targetName, this->TargetNameReal, targetNameImport, targetNamePDB,
+ this->ConfigName);
if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(
this->GeneratorTarget)) {
this->TagType = GhsMultiGpj::INTERGRITY_APPLICATION;
@@ -113,6 +130,13 @@ void cmGhsMultiTargetGenerator::Generate()
break;
}
case cmStateEnums::STATIC_LIBRARY: {
+ std::string targetName;
+ std::string targetNameSO;
+ std::string targetNameImport;
+ std::string targetNamePDB;
+ this->GeneratorTarget->GetLibraryNames(
+ targetName, targetNameSO, this->TargetNameReal, targetNameImport,
+ targetNamePDB, this->ConfigName);
this->TagType = GhsMultiGpj::LIBRARY;
break;
}
@@ -143,6 +167,7 @@ void cmGhsMultiTargetGenerator::Generate()
default:
return;
}
+
// Tell the global generator the name of the project file
this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME",
this->Name.c_str());
@@ -182,7 +207,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget()
cmGlobalGhsMultiGenerator::WriteDisclaimer(&fout);
bool const notKernel = this->IsNotKernel(config, language);
- this->WriteTypeSpecifics(fout, config, notKernel);
+ this->WriteTargetSpecifics(fout, config, notKernel);
this->SetCompilerFlags(config, language, notKernel);
this->WriteCompilerFlags(fout, config, language);
this->WriteCompilerDefinitions(fout, config, language);
@@ -224,34 +249,22 @@ cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator()
this->LocalGenerator->GetGlobalGenerator());
}
-void cmGhsMultiTargetGenerator::WriteTypeSpecifics(std::ostream& fout,
- const std::string& config,
- bool const notKernel)
+void cmGhsMultiTargetGenerator::WriteTargetSpecifics(std::ostream& fout,
+ const std::string& config,
+ bool const notKernel)
{
- std::string outputDir(this->GetOutputDirectory(config));
- std::string outputFilename(this->GetOutputFilename(config));
-
- if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
- std::string const& static_library_suffix =
- this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
- fout << " -o \"" << outputDir << outputFilename << static_library_suffix
- << "\"" << std::endl;
- } else if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
- if (notKernel && !this->IsTargetGroup()) {
- fout << " -relprog" << std::endl;
- }
- if (this->IsTargetGroup()) {
- fout << " -o \"" << outputDir << outputFilename << ".elf\""
- << std::endl;
- fout << " :extraOutputFile=\"" << outputDir << outputFilename
- << ".elf.ael\"" << std::endl;
- } else {
- std::string const executable_suffix =
- this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX");
- fout << " -o \"" << outputDir << outputFilename << executable_suffix
- << "\"" << std::endl;
- }
- }
+ std::string outpath;
+ std::string rootpath = this->LocalGenerator->GetCurrentBinaryDirectory();
+
+ // set target binary file destination
+ outpath = this->GeneratorTarget->GetDirectory(config);
+ outpath = this->LocalGenerator->ConvertToRelativePath(rootpath, outpath);
+ fout << " :binDirRelative=\"" << outpath << "\"" << std::endl;
+ fout << " -o \"" << this->TargetNameReal << "\"" << std::endl;
+
+ // set target object file destination
+ outpath = this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
+ fout << " :outputDirRelative=\"" << outpath << "\"" << std::endl;
}
void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
@@ -643,8 +656,6 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
*fout << " -o \"" << objectNames.find(si)->second << "\""
<< std::endl;
}
-
- this->WriteObjectDir(*fout, this->AbsBuildFilePath);
}
}
}
@@ -667,18 +678,6 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
}
}
-void cmGhsMultiTargetGenerator::WriteObjectDir(std::ostream& fout,
- std::string const& dir)
-{
- std::string workingDir(dir);
- cmSystemTools::ConvertToUnixSlashes(workingDir);
- if (!workingDir.empty()) {
- workingDir += "/";
- }
- workingDir += "Objs";
- fout << " -object_dir=\"" << workingDir << "\"" << std::endl;
-}
-
std::string cmGhsMultiTargetGenerator::GetOutputDirectory(
const std::string& config) const
{
diff --git a/Source/cmGhsMultiTargetGenerator.h b/Source/cmGhsMultiTargetGenerator.h
index 6ba110a..4523498 100644
--- a/Source/cmGhsMultiTargetGenerator.h
+++ b/Source/cmGhsMultiTargetGenerator.h
@@ -60,8 +60,8 @@ private:
bool IsTargetGroup() const { return this->TargetGroup; }
- void WriteTypeSpecifics(std::ostream& fout, const std::string& config,
- bool notKernel);
+ void WriteTargetSpecifics(std::ostream& fout, const std::string& config,
+ bool notKernel);
void WriteCompilerFlags(std::ostream& fout, const std::string& config,
const std::string& language);
void WriteCompilerDefinitions(std::ostream& fout, const std::string& config,
@@ -87,7 +87,6 @@ private:
cmGeneratorTarget* generatorTarget);
static void WriteObjectLangOverride(std::ostream* fout,
const cmSourceFile* sourceFile);
- static void WriteObjectDir(std::ostream& fout, std::string const& dir);
std::string GetOutputDirectory(const std::string& config) const;
std::string GetOutputFilename(const std::string& config) const;
static std::string ComputeLongestObjectDirectory(
@@ -115,8 +114,10 @@ private:
std::map<std::string, std::string> FlagsByLanguage;
std::map<std::string, std::string> DefinesByLanguage;
+ std::string TargetNameReal;
GhsMultiGpj::Types TagType;
std::string const Name;
+ std::string ConfigName; /* CMAKE_BUILD_TYPE */
};
#endif // ! cmGhsMultiTargetGenerator_h
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index f0f1154..7d1e594 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -41,6 +41,18 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry)
"Generates Green Hills MULTI files (experimental, work-in-progress).";
}
+void cmGlobalGhsMultiGenerator::ComputeTargetObjectDirectory(
+ cmGeneratorTarget* gt) const
+{
+ // Compute full path to object file directory for this target.
+ std::string dir;
+ dir += gt->LocalGenerator->GetCurrentBinaryDirectory();
+ dir += "/";
+ dir += gt->LocalGenerator->GetTargetDirectory(gt);
+ dir += "/";
+ gt->ObjectDirectory = dir;
+}
+
bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
cmMakefile* mf)
{
diff --git a/Source/cmGlobalGhsMultiGenerator.h b/Source/cmGlobalGhsMultiGenerator.h
index 8b81ba3..d992f89 100644
--- a/Source/cmGlobalGhsMultiGenerator.h
+++ b/Source/cmGlobalGhsMultiGenerator.h
@@ -63,6 +63,8 @@ public:
*/
bool FindMakeProgram(cmMakefile* mf) override;
+ void ComputeTargetObjectDirectory(cmGeneratorTarget* gt) const override;
+
cmGeneratedFileStream* GetBuildFileStream()
{
return this->TargetFolderBuildStreams[""];
diff --git a/Source/cmLocalGhsMultiGenerator.cxx b/Source/cmLocalGhsMultiGenerator.cxx
index 3679c3e..b539a1c 100644
--- a/Source/cmLocalGhsMultiGenerator.cxx
+++ b/Source/cmLocalGhsMultiGenerator.cxx
@@ -18,6 +18,15 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator()
{
}
+std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
+ cmGeneratorTarget const* target) const
+{
+ std::string dir;
+ dir += target->GetName();
+ dir += ".dir";
+ return dir;
+}
+
void cmLocalGhsMultiGenerator::GenerateTargetsDepthFirst(
cmGeneratorTarget* target, std::vector<cmGeneratorTarget*>& remaining)
{
diff --git a/Source/cmLocalGhsMultiGenerator.h b/Source/cmLocalGhsMultiGenerator.h
index 8e88205..1f55420 100644
--- a/Source/cmLocalGhsMultiGenerator.h
+++ b/Source/cmLocalGhsMultiGenerator.h
@@ -25,6 +25,9 @@ public:
*/
virtual void Generate();
+ std::string GetTargetDirectory(
+ cmGeneratorTarget const* target) const override;
+
private:
void GenerateTargetsDepthFirst(cmGeneratorTarget* target,
std::vector<cmGeneratorTarget*>& remaining);