GHS: Port to cmGeneratorTarget.
This commit is contained in:
parent
b92d0b2c94
commit
b74aa0e3d2
@ -22,23 +22,22 @@
|
|||||||
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
|
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
|
||||||
|
|
||||||
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
|
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget *target)
|
||||||
: Target(target->Target)
|
: GeneratorTarget(target)
|
||||||
, GeneratorTarget(target)
|
|
||||||
, LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
|
, LocalGenerator(static_cast<cmLocalGhsMultiGenerator *>(
|
||||||
target->GetLocalGenerator()))
|
target->GetLocalGenerator()))
|
||||||
, Makefile(target->Target->GetMakefile())
|
, Makefile(target->Target->GetMakefile())
|
||||||
, TargetGroup(DetermineIfTargetGroup(target))
|
, TargetGroup(DetermineIfTargetGroup(target))
|
||||||
, DynamicDownload(false)
|
, DynamicDownload(false)
|
||||||
{
|
{
|
||||||
this->RelBuildFilePath = this->GetRelBuildFilePath(target->Target);
|
this->RelBuildFilePath = this->GetRelBuildFilePath(target);
|
||||||
|
|
||||||
this->RelOutputFileName =
|
this->RelOutputFileName =
|
||||||
this->RelBuildFilePath + this->Target->GetName() + ".a";
|
this->RelBuildFilePath + target->GetName() + ".a";
|
||||||
|
|
||||||
this->RelBuildFileName = this->RelBuildFilePath;
|
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);
|
absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot);
|
||||||
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
|
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
|
||||||
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
|
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
|
||||||
@ -51,7 +50,8 @@ cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
|
cmGhsMultiTargetGenerator::GetRelBuildFilePath(
|
||||||
|
const cmGeneratorTarget *target)
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
char const *folderProp = target->GetProperty("FOLDER");
|
char const *folderProp = target->GetProperty("FOLDER");
|
||||||
@ -66,15 +66,13 @@ cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target)
|
cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmGeneratorTarget *target)
|
||||||
{
|
{
|
||||||
cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator()
|
return target->GetLocalGenerator()->GetBinaryDirectory();
|
||||||
->GetGeneratorTarget(target);
|
|
||||||
return gt->GetLocalGenerator()->GetBinaryDirectory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target)
|
cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmGeneratorTarget *target)
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target);
|
output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target);
|
||||||
@ -84,7 +82,7 @@ cmGhsMultiTargetGenerator::GetAbsBuildFilePath(const cmTarget *target)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string
|
std::string
|
||||||
cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target)
|
cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmGeneratorTarget *target)
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
|
output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
|
||||||
@ -93,7 +91,8 @@ cmGhsMultiTargetGenerator::GetRelBuildFileName(const cmTarget *target)
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cmGhsMultiTargetGenerator::GetBuildFileName(const cmTarget *target)
|
std::string
|
||||||
|
cmGhsMultiTargetGenerator::GetBuildFileName(const cmGeneratorTarget *target)
|
||||||
{
|
{
|
||||||
std::string output;
|
std::string output;
|
||||||
output = target->GetName();
|
output = target->GetName();
|
||||||
@ -161,7 +160,8 @@ void cmGhsMultiTargetGenerator::Generate()
|
|||||||
bool cmGhsMultiTargetGenerator::IncludeThisTarget()
|
bool cmGhsMultiTargetGenerator::IncludeThisTarget()
|
||||||
{
|
{
|
||||||
bool output = true;
|
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] &&
|
if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
|
||||||
'\0' == excludeFromAll[1])
|
'\0' == excludeFromAll[1])
|
||||||
{
|
{
|
||||||
@ -367,13 +367,13 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
|
|||||||
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
|
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
|
||||||
++tdsI)
|
++tdsI)
|
||||||
{
|
{
|
||||||
const cmTarget *tg = (*tdsI)->Target;
|
const cmGeneratorTarget *tg = *tdsI;
|
||||||
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
|
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
|
||||||
<< "\"" << std::endl;
|
<< "\"" << std::endl;
|
||||||
}
|
}
|
||||||
// library targets
|
// library targets
|
||||||
cmTarget::LinkLibraryVectorType llv =
|
cmTarget::LinkLibraryVectorType llv =
|
||||||
this->Target->GetOriginalLinkLibraries();
|
this->GeneratorTarget->Target->GetOriginalLinkLibraries();
|
||||||
for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
|
for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
|
||||||
llvI != llv.end(); ++llvI)
|
llvI != llv.end(); ++llvI)
|
||||||
{
|
{
|
||||||
@ -391,9 +391,11 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries()
|
|||||||
|
|
||||||
void cmGhsMultiTargetGenerator::WriteCustomCommands()
|
void cmGhsMultiTargetGenerator::WriteCustomCommands()
|
||||||
{
|
{
|
||||||
WriteCustomCommandsHelper(this->Target->GetPreBuildCommands(),
|
WriteCustomCommandsHelper(
|
||||||
|
this->GeneratorTarget->Target->GetPreBuildCommands(),
|
||||||
cmTarget::PRE_BUILD);
|
cmTarget::PRE_BUILD);
|
||||||
WriteCustomCommandsHelper(this->Target->GetPostBuildCommands(),
|
WriteCustomCommandsHelper(
|
||||||
|
this->GeneratorTarget->Target->GetPostBuildCommands(),
|
||||||
cmTarget::POST_BUILD);
|
cmTarget::POST_BUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,7 +520,7 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
|
|||||||
std::string outputDir(AbsBuildFilePath);
|
std::string outputDir(AbsBuildFilePath);
|
||||||
|
|
||||||
const char *runtimeOutputProp =
|
const char *runtimeOutputProp =
|
||||||
this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
|
this->GeneratorTarget->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
|
||||||
if (NULL != runtimeOutputProp)
|
if (NULL != runtimeOutputProp)
|
||||||
{
|
{
|
||||||
outputDir = runtimeOutputProp;
|
outputDir = runtimeOutputProp;
|
||||||
@ -526,7 +528,8 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
|
|||||||
|
|
||||||
std::string configCapped(cmSystemTools::UpperCase(config));
|
std::string configCapped(cmSystemTools::UpperCase(config));
|
||||||
const char *runtimeOutputSProp =
|
const char *runtimeOutputSProp =
|
||||||
this->Target->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
|
this->GeneratorTarget
|
||||||
|
->GetProperty("RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
|
||||||
if (NULL != runtimeOutputSProp)
|
if (NULL != runtimeOutputSProp)
|
||||||
{
|
{
|
||||||
outputDir = runtimeOutputSProp;
|
outputDir = runtimeOutputSProp;
|
||||||
@ -544,9 +547,10 @@ cmGhsMultiTargetGenerator::GetOutputDirectory(const std::string &config) const
|
|||||||
std::string
|
std::string
|
||||||
cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
|
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)
|
if (NULL != outputNameProp)
|
||||||
{
|
{
|
||||||
outputFilename = outputNameProp;
|
outputFilename = outputNameProp;
|
||||||
@ -554,7 +558,7 @@ cmGhsMultiTargetGenerator::GetOutputFilename(const std::string &config) const
|
|||||||
|
|
||||||
std::string configCapped(cmSystemTools::UpperCase(config));
|
std::string configCapped(cmSystemTools::UpperCase(config));
|
||||||
const char *outputNameSProp =
|
const char *outputNameSProp =
|
||||||
this->Target->GetProperty(configCapped + "_OUTPUT_NAME");
|
this->GeneratorTarget->GetProperty(configCapped + "_OUTPUT_NAME");
|
||||||
if (NULL != outputNameSProp)
|
if (NULL != outputNameSProp)
|
||||||
{
|
{
|
||||||
outputFilename = outputNameSProp;
|
outputFilename = outputNameSProp;
|
||||||
|
@ -54,11 +54,11 @@ public:
|
|||||||
return this->AbsOutputFileName.c_str();
|
return this->AbsOutputFileName.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GetRelBuildFilePath(const cmTarget *target);
|
static std::string GetRelBuildFilePath(const cmGeneratorTarget *target);
|
||||||
static std::string GetAbsPathToRoot(const cmTarget *target);
|
static std::string GetAbsPathToRoot(const cmGeneratorTarget *target);
|
||||||
static std::string GetAbsBuildFilePath(const cmTarget *target);
|
static std::string GetAbsBuildFilePath(const cmGeneratorTarget *target);
|
||||||
static std::string GetRelBuildFileName(const cmTarget *target);
|
static std::string GetRelBuildFileName(const cmGeneratorTarget *target);
|
||||||
static std::string GetBuildFileName(const cmTarget *target);
|
static std::string GetBuildFileName(const cmGeneratorTarget *target);
|
||||||
static std::string AddSlashIfNeededToPath(std::string const &input);
|
static std::string AddSlashIfNeededToPath(std::string const &input);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -99,7 +99,6 @@ private:
|
|||||||
bool DetermineIfDynamicDownload(std::string const &config,
|
bool DetermineIfDynamicDownload(std::string const &config,
|
||||||
const std::string &language);
|
const std::string &language);
|
||||||
|
|
||||||
cmTarget *Target;
|
|
||||||
cmGeneratorTarget* GeneratorTarget;
|
cmGeneratorTarget* GeneratorTarget;
|
||||||
cmLocalGhsMultiGenerator *LocalGenerator;
|
cmLocalGhsMultiGenerator *LocalGenerator;
|
||||||
cmMakefile *Makefile;
|
cmMakefile *Makefile;
|
||||||
|
@ -487,7 +487,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
|
|||||||
tgtsI != tgts.end(); ++tgtsI)
|
tgtsI != tgts.end(); ++tgtsI)
|
||||||
{
|
{
|
||||||
const cmGeneratorTarget *tgt = *tgtsI;
|
const cmGeneratorTarget *tgt = *tgtsI;
|
||||||
if (IsTgtForBuild(tgt->Target))
|
if (IsTgtForBuild(tgt))
|
||||||
{
|
{
|
||||||
char const *rawFolderName = tgt->GetProperty("FOLDER");
|
char const *rawFolderName = tgt->GetProperty("FOLDER");
|
||||||
if (NULL == rawFolderName)
|
if (NULL == rawFolderName)
|
||||||
@ -504,7 +504,7 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
|
|||||||
GhsMultiGpj::PROJECT);
|
GhsMultiGpj::PROJECT);
|
||||||
}
|
}
|
||||||
std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(
|
std::vector<cmsys::String> splitPath = cmSystemTools::SplitString(
|
||||||
cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt->Target));
|
cmGhsMultiTargetGenerator::GetRelBuildFileName(tgt));
|
||||||
std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" +
|
std::string foldNameRelBuildFile(*(splitPath.end() - 2) + "/" +
|
||||||
splitPath.back());
|
splitPath.back());
|
||||||
*this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile
|
*this->TargetFolderBuildStreams[folderName] << foldNameRelBuildFile
|
||||||
@ -516,13 +516,12 @@ void cmGlobalGhsMultiGenerator::UpdateBuildFiles(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt)
|
bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmGeneratorTarget *tgt)
|
||||||
{
|
{
|
||||||
const std::string config =
|
const std::string config =
|
||||||
tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
tgt->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
||||||
std::vector<cmSourceFile *> tgtSources;
|
std::vector<cmSourceFile *> tgtSources;
|
||||||
cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt);
|
tgt->GetSourceFiles(tgtSources, config);
|
||||||
gt->GetSourceFiles(tgtSources, config);
|
|
||||||
bool tgtInBuild = true;
|
bool tgtInBuild = true;
|
||||||
char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL");
|
char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL");
|
||||||
if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
|
if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
|
||||||
|
@ -111,7 +111,7 @@ private:
|
|||||||
GhsMultiGpj::Types projType);
|
GhsMultiGpj::Types projType);
|
||||||
static std::string GetFileNameFromPath(std::string const &path);
|
static std::string GetFileNameFromPath(std::string const &path);
|
||||||
void UpdateBuildFiles(std::vector<cmGeneratorTarget*> tgts);
|
void UpdateBuildFiles(std::vector<cmGeneratorTarget*> tgts);
|
||||||
bool IsTgtForBuild(const cmTarget *tgt);
|
bool IsTgtForBuild(const cmGeneratorTarget *tgt);
|
||||||
|
|
||||||
std::vector<cmGeneratedFileStream *> TargetSubProjects;
|
std::vector<cmGeneratedFileStream *> TargetSubProjects;
|
||||||
std::map<std::string, cmGeneratedFileStream *> TargetFolderBuildStreams;
|
std::map<std::string, cmGeneratedFileStream *> TargetFolderBuildStreams;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user