GHS: Port to cmGeneratorTarget.

This commit is contained in:
Stephen Kelly
2015-10-21 21:31:00 +02:00
parent b92d0b2c94
commit b74aa0e3d2
4 changed files with 41 additions and 39 deletions
+30 -26
View File
@@ -22,23 +22,22 @@
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
: Target(target->Target)
, GeneratorTarget(target)
: GeneratorTarget(target)
, LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
target->GetLocalGenerator()))
, Makefile(target->Target->GetMakefile())
, TargetGroup(DetermineIfTargetGroup(target))
, DynamicDownload(false)
{
this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target);
this->RelBuildFilePath = this->GetRelBuildFilePath(target);
this->RelOutputFileName =
this->RelBuildFilePath + this->Target->GetName() + ".a";
this->RelBuildFilePath + target->GetName() + ".a";
this->RelBuildFileName = this->RelBuildFilePath;
this->RelBuildFileName += this->GetBuildFileName(target->Target);
this->RelBuildFileName += this->GetBuildFileName(target);
std::string absPathToRoot = this->GetAbsPathToRoot(target->Target);
std::string absPathToRoot = this->GetAbsPathToRoot(target);
absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot);
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
@@ -51,7 +50,8 @@ cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
}
std::string
cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
cmGhsMultiTargetGenerator::GetRelBuildFilePath(
const cmGeneratorTarget *target)
{
std::string output;
char const *folderProp = target->GetProperty("FOLDER");
@@ -66,15 +66,13 @@ cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
}
std::string
cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target)
cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmGeneratorTarget *target)
{
cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator()
->GetGeneratorTarget(target);
return gt->GetLocalGenerator()->GetBinaryDirectory();
return target->GetLocalGenerator()->GetBinaryDirectory();
}
std::string
cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target)
cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmGeneratorTarget *target)
{
std::string output;
output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target);
@@ -84,7 +82,7 @@ cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target)
}
std::string
cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target)
cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmGeneratorTarget *target)
{
std::string output;
output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
@@ -93,7 +91,8 @@ cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target)
return output;
}
std::string cmGhsMultiTargetGenerator::GetBuildFileName(const cmTarget *target)
std::string
cmGhsMultiTargetGenerator::GetBuildFileName(const cmGeneratorTarget *target)
{
std::string output;
output = target->GetName();
@@ -161,7 +160,8 @@ void cmGhsMultiTargetGenerator::Generate()
bool cmGhsMultiTargetGenerator::IncludeThisTarget()
{
bool output = true;
char const *excludeFromAll = this->Target->GetProperty("EXCLUDE_FROM_ALL");
char const *excludeFromAll =
this->GeneratorTarget->GetProperty("EXCLUDE_FROM_ALL");
if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
'\0' == excludeFromAll[1])
{
@@ -367,13 +367,13 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
++tdsI)
{
const cmTarget *tg = (*tdsI)->Target;
const cmGeneratorTarget *tg = *tdsI;
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
<< "\"" << std::endl;
}
// library targets
cmTarget::LinkLibraryVectorType llv =
this->Target->GetOriginalLinkLibraries();
this->GeneratorTarget->Target->GetOriginalLinkLibraries();
for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
llvI != llv.end(); ++llvI)
{
@@ -391,10 +391,12 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
void cmGhsMultiTargetGenerator::WriteCustomCommands()
{
WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(),
cmTarget::PRE_BUILD);
WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(),
cmTarget::POST_BUILD);
WriteCustomCommandsHelper(
this->GeneratorTarget->Target->GetPreBuildCommands(),
cmTarget::PRE_BUILD);
WriteCustomCommandsHelper(
this->GeneratorTarget->Target->GetPostBuildCommands(),
cmTarget::POST_BUILD);
}
void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
@@ -518,7 +520,7 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
std::string outputDir(AbsBuildFilePath);
const char *runtimeOutputProp =
this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
this->GeneratorTarget->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
if (NULL != runtimeOutputProp)
{
outputDir = runtimeOutputProp;
@@ -526,7 +528,8 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
std::string configCapped(cmSystemTools::UpperCase(config));
const char *runtimeOutputSProp =
this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
this->GeneratorTarget
->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
if (NULL != runtimeOutputSProp)
{
outputDir = runtimeOutputSProp;
@@ -544,9 +547,10 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
std::string
cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
{
std::string outputFilename(this->Target->GetName());
std::string outputFilename(this->GeneratorTarget->GetName());
const char *outputNameProp = this->Target->GetProperty("OUTPUT_NAME");
const char *outputNameProp =
this->GeneratorTarget->GetProperty("OUTPUT_NAME");
if (NULL != outputNameProp)
{
outputFilename = outputNameProp;
@@ -554,7 +558,7 @@ cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
std::string configCapped(cmSystemTools::UpperCase(config));
const char *outputNameSProp =
this->Target->GetProperty(configCapped + "_OUTPUT_NAME");
this->GeneratorTarget->GetProperty(configCapped + "_OUTPUT_NAME");
if (NULL != outputNameSProp)
{
outputFilename = outputNameSProp;