2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2015-03-24 08:12:55 +03:00
|
|
|
#include "cmGhsMultiTargetGenerator.h"
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmGeneratedFileStream.h"
|
2016-09-01 21:59:28 +03:00
|
|
|
#include "cmGeneratorTarget.h"
|
2015-03-24 08:12:55 +03:00
|
|
|
#include "cmGlobalGhsMultiGenerator.h"
|
|
|
|
#include "cmLocalGhsMultiGenerator.h"
|
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmSourceFile.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmTarget.h"
|
2015-03-24 08:12:55 +03:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
|
2015-10-21 22:31:00 +03:00
|
|
|
: GeneratorTarget(target)
|
2016-05-16 17:34:04 +03:00
|
|
|
, LocalGenerator(
|
|
|
|
static_cast<cmLocalGhsMultiGenerator*>(target->GetLocalGenerator()))
|
2015-06-06 14:02:59 +03:00
|
|
|
, Makefile(target->Target->GetMakefile())
|
2015-10-06 23:35:28 +03:00
|
|
|
, TargetGroup(DetermineIfTargetGroup(target))
|
2015-03-24 08:12:55 +03:00
|
|
|
, DynamicDownload(false)
|
|
|
|
{
|
2015-10-21 22:31:00 +03:00
|
|
|
this->RelBuildFilePath = this->GetRelBuildFilePath(target);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
this->RelOutputFileName = this->RelBuildFilePath + target->GetName() + ".a";
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
this->RelBuildFileName = this->RelBuildFilePath;
|
2015-10-21 22:31:00 +03:00
|
|
|
this->RelBuildFileName += this->GetBuildFileName(target);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2015-10-21 22:31:00 +03:00
|
|
|
std::string absPathToRoot = this->GetAbsPathToRoot(target);
|
2015-03-24 08:12:55 +03:00
|
|
|
absPathToRoot = this->AddSlashIfNeededToPath(absPathToRoot);
|
|
|
|
this->AbsBuildFilePath = absPathToRoot + this->RelBuildFilePath;
|
|
|
|
this->AbsBuildFileName = absPathToRoot + this->RelBuildFileName;
|
|
|
|
this->AbsOutputFileName = absPathToRoot + this->RelOutputFileName;
|
|
|
|
}
|
|
|
|
|
|
|
|
cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
|
|
|
|
{
|
|
|
|
cmDeleteAll(this->FolderBuildStreams);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetRelBuildFilePath(
|
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string output;
|
2016-05-16 17:34:04 +03:00
|
|
|
char const* folderProp = target->GetProperty("FOLDER");
|
2015-03-24 08:12:55 +03:00
|
|
|
output = NULL == folderProp ? "" : folderProp;
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(output);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!output.empty()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output += "/";
|
|
|
|
}
|
|
|
|
output += target->GetName() + "/";
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetAbsPathToRoot(
|
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2015-10-21 22:31:00 +03:00
|
|
|
return target->GetLocalGenerator()->GetBinaryDirectory();
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetAbsBuildFilePath(
|
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string output;
|
|
|
|
output = cmGhsMultiTargetGenerator::GetAbsPathToRoot(target);
|
|
|
|
output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output);
|
|
|
|
output += cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
|
2016-05-16 17:34:04 +03:00
|
|
|
return output;
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetRelBuildFileName(
|
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string output;
|
|
|
|
output = cmGhsMultiTargetGenerator::GetRelBuildFilePath(target);
|
|
|
|
output = cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(output);
|
|
|
|
output += cmGhsMultiTargetGenerator::GetBuildFileName(target);
|
2016-05-16 17:34:04 +03:00
|
|
|
return output;
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetBuildFileName(
|
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string output;
|
|
|
|
output = target->GetName();
|
|
|
|
output += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::AddSlashIfNeededToPath(
|
|
|
|
std::string const& input)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string output(input);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!cmHasLiteralSuffix(output, "/")) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output += "/";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmGhsMultiTargetGenerator::Generate()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> objectSources = this->GetSources();
|
|
|
|
if (!objectSources.empty() && this->IncludeThisTarget()) {
|
|
|
|
if (!cmSystemTools::FileExists(this->AbsBuildFilePath.c_str())) {
|
2015-03-24 08:12:55 +03:00
|
|
|
cmSystemTools::MakeDirectory(this->AbsBuildFilePath.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
cmGlobalGhsMultiGenerator::Open(std::string(""), this->AbsBuildFileName,
|
|
|
|
&this->FolderBuildStreams);
|
|
|
|
cmGlobalGhsMultiGenerator::OpenBuildFileStream(
|
|
|
|
this->GetFolderBuildStreams());
|
|
|
|
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (0 == config.length()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
config = "RELEASE";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-08-04 20:19:49 +03:00
|
|
|
const std::string language(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetLinkerLanguage(config));
|
2015-03-24 08:12:55 +03:00
|
|
|
config = cmSystemTools::UpperCase(config);
|
|
|
|
this->DynamicDownload = this->DetermineIfDynamicDownload(config, language);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->DynamicDownload) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << "#component integrity_dynamic_download"
|
|
|
|
<< std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
GhsMultiGpj::WriteGpjTag(this->GetGpjTag(), this->GetFolderBuildStreams());
|
|
|
|
cmGlobalGhsMultiGenerator::WriteDisclaimer(this->GetFolderBuildStreams());
|
|
|
|
|
|
|
|
bool const notKernel = this->IsNotKernel(config, language);
|
|
|
|
this->WriteTypeSpecifics(config, notKernel);
|
|
|
|
this->SetCompilerFlags(config, language, notKernel);
|
|
|
|
this->WriteCompilerFlags(config, language);
|
|
|
|
this->WriteCompilerDefinitions(config, language);
|
|
|
|
this->WriteIncludes(config, language);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
2016-03-27 06:28:31 +03:00
|
|
|
this->WriteTargetLinkLibraries(config, language);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
this->WriteCustomCommands();
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::map<const cmSourceFile*, std::string> objectNames =
|
|
|
|
cmGhsMultiTargetGenerator::GetObjectNames(
|
|
|
|
&objectSources, this->LocalGenerator, this->GeneratorTarget);
|
2016-05-05 07:49:27 +03:00
|
|
|
|
|
|
|
this->WriteSources(objectSources, objectNames);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool cmGhsMultiTargetGenerator::IncludeThisTarget()
|
|
|
|
{
|
|
|
|
bool output = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
char const* excludeFromAll =
|
|
|
|
this->GeneratorTarget->GetProperty("EXCLUDE_FROM_ALL");
|
2015-03-24 08:12:55 +03:00
|
|
|
if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&
|
2016-05-16 17:34:04 +03:00
|
|
|
'\0' == excludeFromAll[1]) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output = false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> cmGhsMultiTargetGenerator::GetSources() const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> output;
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
2015-08-29 18:51:15 +03:00
|
|
|
this->GeneratorTarget->GetSourceFiles(output, config);
|
2015-03-24 08:12:55 +03:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag() const
|
|
|
|
{
|
2015-10-06 23:35:28 +03:00
|
|
|
return cmGhsMultiTargetGenerator::GetGpjTag(this->GeneratorTarget);
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2015-10-06 23:35:28 +03:00
|
|
|
GhsMultiGpj::Types cmGhsMultiTargetGenerator::GetGpjTag(
|
2016-05-16 17:34:04 +03:00
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
GhsMultiGpj::Types output;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (cmGhsMultiTargetGenerator::DetermineIfTargetGroup(target)) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output = GhsMultiGpj::INTERGRITY_APPLICATION;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (target->GetType() == cmState::STATIC_LIBRARY) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output = GhsMultiGpj::LIBRARY;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-03-24 08:12:55 +03:00
|
|
|
output = GhsMultiGpj::PROGRAM;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalGhsMultiGenerator* cmGhsMultiTargetGenerator::GetGlobalGenerator()
|
|
|
|
const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
return static_cast<cmGlobalGhsMultiGenerator*>(
|
2015-03-24 08:12:55 +03:00
|
|
|
this->LocalGenerator->GetGlobalGenerator());
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmGhsMultiTargetGenerator::WriteTypeSpecifics(const std::string& config,
|
2015-03-24 08:12:55 +03:00
|
|
|
bool const notKernel)
|
|
|
|
{
|
|
|
|
std::string outputDir(this->GetOutputDirectory(config));
|
|
|
|
std::string outputFilename(this->GetOutputFilename(config));
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
|
2016-03-21 14:00:35 +03:00
|
|
|
std::string const static_library_suffix =
|
|
|
|
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LIBRARY_SUFFIX");
|
2016-05-16 17:34:04 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -o \"" << outputDir
|
|
|
|
<< outputFilename << static_library_suffix
|
|
|
|
<< "\"" << std::endl;
|
|
|
|
} else if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
|
|
|
if (notKernel && !this->IsTargetGroup()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -relprog" << std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (this->IsTargetGroup()) {
|
2015-09-06 08:15:26 +03:00
|
|
|
*this->GetFolderBuildStreams()
|
2016-05-16 17:34:04 +03:00
|
|
|
<< " -o \"" << outputDir << outputFilename << ".elf\"" << std::endl;
|
2015-09-06 08:15:26 +03:00
|
|
|
*this->GetFolderBuildStreams() << " :extraOutputFile=\"" << outputDir
|
|
|
|
<< outputFilename << ".elf.ael\""
|
2015-03-24 08:12:55 +03:00
|
|
|
<< std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2016-03-21 14:00:35 +03:00
|
|
|
std::string const executable_suffix =
|
|
|
|
this->Makefile->GetSafeDefinition("CMAKE_EXECUTABLE_SUFFIX");
|
2016-05-16 17:34:04 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -o \"" << outputDir
|
|
|
|
<< outputFilename << executable_suffix
|
|
|
|
<< "\"" << std::endl;
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config,
|
|
|
|
const std::string& language,
|
2015-03-24 08:12:55 +03:00
|
|
|
bool const notKernel)
|
|
|
|
{
|
|
|
|
std::map<std::string, std::string>::iterator i =
|
|
|
|
this->FlagsByLanguage.find(language);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (i == this->FlagsByLanguage.end()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string flags;
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* lang = language.c_str();
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (notKernel) {
|
2015-03-24 08:12:55 +03:00
|
|
|
this->LocalGenerator->AddLanguageFlags(flags, lang, config);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
this->LocalGenerator->AddLanguageFlags(
|
|
|
|
flags, lang + std::string("_GHS_KERNEL"), config);
|
|
|
|
}
|
|
|
|
this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang,
|
|
|
|
config);
|
|
|
|
this->LocalGenerator->AddVisibilityPresetFlags(
|
|
|
|
flags, this->GeneratorTarget, lang);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
// Append old-style preprocessor definition flags.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (std::string(" ") != std::string(this->Makefile->GetDefineFlags())) {
|
2015-03-24 08:12:55 +03:00
|
|
|
this->LocalGenerator->AppendFlags(flags,
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Makefile->GetDefineFlags());
|
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
// Add target-specific flags.
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget, lang,
|
|
|
|
config);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
std::map<std::string, std::string>::value_type entry(language, flags);
|
|
|
|
i = this->FlagsByLanguage.insert(entry).first;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetDefines(const std::string& language,
|
|
|
|
std::string const& config)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::map<std::string, std::string>::iterator i =
|
|
|
|
this->DefinesByLanguage.find(language);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (i == this->DefinesByLanguage.end()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::set<std::string> defines;
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* lang = language.c_str();
|
2015-03-24 08:12:55 +03:00
|
|
|
// Add the export symbol definition for shared library objects.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
this->LocalGenerator->AppendDefines(defines, exportMacro);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
// Add preprocessor definitions for this target and configuration.
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->AddCompileDefinitions(defines, this->GeneratorTarget,
|
|
|
|
config, language);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
std::string definesString;
|
|
|
|
this->LocalGenerator->JoinDefines(defines, definesString, lang);
|
|
|
|
|
|
|
|
std::map<std::string, std::string>::value_type entry(language,
|
2016-05-16 17:34:04 +03:00
|
|
|
definesString);
|
2015-03-24 08:12:55 +03:00
|
|
|
i = this->DefinesByLanguage.insert(entry).first;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
return i->second;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::string const&,
|
|
|
|
const std::string& language)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::map<std::string, std::string>::iterator flagsByLangI =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->FlagsByLanguage.find(language);
|
|
|
|
if (flagsByLangI != this->FlagsByLanguage.end()) {
|
|
|
|
if (!flagsByLangI->second.empty()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << " " << flagsByLangI->second
|
2016-05-16 17:34:04 +03:00
|
|
|
<< std::endl;
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmGhsMultiTargetGenerator::WriteCompilerDefinitions(
|
2016-05-16 17:34:04 +03:00
|
|
|
const std::string& config, const std::string& language)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::vector<std::string> compileDefinitions;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config,
|
|
|
|
language);
|
2015-03-24 08:12:55 +03:00
|
|
|
for (std::vector<std::string>::const_iterator cdI =
|
|
|
|
compileDefinitions.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
cdI != compileDefinitions.end(); ++cdI) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -D" << (*cdI) << std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmGhsMultiTargetGenerator::WriteIncludes(const std::string& config,
|
|
|
|
const std::string& language)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2016-05-24 16:37:09 +03:00
|
|
|
std::vector<std::string> includes;
|
|
|
|
this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget,
|
|
|
|
language, config);
|
|
|
|
|
2015-03-24 08:12:55 +03:00
|
|
|
for (std::vector<std::string>::const_iterator includes_i = includes.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
includes_i != includes.end(); ++includes_i) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -I\"" << *includes_i << "\""
|
|
|
|
<< std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-03-27 06:28:31 +03:00
|
|
|
void cmGhsMultiTargetGenerator::WriteTargetLinkLibraries(
|
|
|
|
std::string const& config, std::string const& language)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
// library directories
|
|
|
|
cmTargetDependSet tds =
|
2015-06-06 14:08:17 +03:00
|
|
|
this->GetGlobalGenerator()->GetTargetDirectDepends(this->GeneratorTarget);
|
2015-03-24 08:12:55 +03:00
|
|
|
for (cmTargetDependSet::iterator tdsI = tds.begin(); tdsI != tds.end();
|
2016-05-16 17:34:04 +03:00
|
|
|
++tdsI) {
|
|
|
|
const cmGeneratorTarget* tg = *tdsI;
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -L\"" << GetAbsBuildFilePath(tg)
|
|
|
|
<< "\"" << std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
// library targets
|
|
|
|
cmTarget::LinkLibraryVectorType llv =
|
2015-10-21 22:31:00 +03:00
|
|
|
this->GeneratorTarget->Target->GetOriginalLinkLibraries();
|
2015-03-24 08:12:55 +03:00
|
|
|
for (cmTarget::LinkLibraryVectorType::const_iterator llvI = llv.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
llvI != llv.end(); ++llvI) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string libName = llvI->first;
|
|
|
|
// if it is a user defined target get the full path to the lib
|
2016-05-16 17:34:04 +03:00
|
|
|
cmTarget* tg(GetGlobalGenerator()->FindTarget(libName));
|
|
|
|
if (NULL != tg) {
|
2015-03-24 08:12:55 +03:00
|
|
|
libName = tg->GetName() + ".a";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << " -l\"" << libName << "\""
|
|
|
|
<< std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-03-27 06:28:31 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->TargetGroup) {
|
2016-03-27 06:28:31 +03:00
|
|
|
std::string linkLibraries;
|
|
|
|
std::string flags;
|
|
|
|
std::string linkFlags;
|
|
|
|
std::string frameworkPath;
|
|
|
|
std::string linkPath;
|
|
|
|
std::string createRule =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetCreateRuleVariable(language, config);
|
2016-03-27 06:28:31 +03:00
|
|
|
bool useWatcomQuote =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Makefile->IsOn(createRule + "_USE_WATCOM_QUOTE");
|
2016-03-27 06:28:31 +03:00
|
|
|
this->LocalGenerator->GetTargetFlags(
|
2016-06-07 17:30:58 +03:00
|
|
|
config, linkLibraries, flags, linkFlags, frameworkPath, linkPath,
|
2016-03-27 06:28:31 +03:00
|
|
|
this->GeneratorTarget, useWatcomQuote);
|
|
|
|
linkFlags = cmSystemTools::TrimWhitespace(linkFlags);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!linkPath.empty()) {
|
2016-03-27 06:28:31 +03:00
|
|
|
linkPath = " " + linkPath.substr(0U, linkPath.size() - 1U);
|
|
|
|
*this->GetFolderBuildStreams() << linkPath;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-03-27 06:28:31 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!linkFlags.empty()) {
|
2016-03-27 06:28:31 +03:00
|
|
|
*this->GetFolderBuildStreams() << " " << linkFlags << std::endl;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmGhsMultiTargetGenerator::WriteCustomCommands()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
WriteCustomCommandsHelper(this->GeneratorTarget->GetPreBuildCommands(),
|
|
|
|
cmTarget::PRE_BUILD);
|
|
|
|
WriteCustomCommandsHelper(this->GeneratorTarget->GetPostBuildCommands(),
|
|
|
|
cmTarget::POST_BUILD);
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmCustomCommand> const& commandsSet,
|
2015-03-24 08:12:55 +03:00
|
|
|
cmTarget::CustomCommandType const commandType)
|
|
|
|
{
|
|
|
|
for (std::vector<cmCustomCommand>::const_iterator commandsSetI =
|
|
|
|
commandsSet.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
commandsSetI != commandsSet.end(); ++commandsSetI) {
|
|
|
|
cmCustomCommandLines const& commands = commandsSetI->GetCommandLines();
|
2015-03-24 08:12:55 +03:00
|
|
|
for (cmCustomCommandLines::const_iterator commandI = commands.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
commandI != commands.end(); ++commandI) {
|
|
|
|
switch (commandType) {
|
2015-03-24 08:12:55 +03:00
|
|
|
case cmTarget::PRE_BUILD:
|
|
|
|
*this->GetFolderBuildStreams() << " :preexecShellSafe=";
|
|
|
|
break;
|
|
|
|
case cmTarget::POST_BUILD:
|
|
|
|
*this->GetFolderBuildStreams() << " :postexecShellSafe=";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
assert("Only pre and post are supported");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
cmCustomCommandLine const& command = *commandI;
|
2015-03-24 08:12:55 +03:00
|
|
|
for (cmCustomCommandLine::const_iterator commandLineI = command.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
commandLineI != command.end(); ++commandLineI) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string subCommandE =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->EscapeForShell(*commandLineI, true);
|
|
|
|
if (!command.empty()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams()
|
|
|
|
<< (command.begin() == commandLineI ? "'" : " ");
|
2016-05-16 17:34:04 +03:00
|
|
|
// Need to double escape backslashes
|
2015-03-24 08:12:55 +03:00
|
|
|
cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\");
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
*this->GetFolderBuildStreams() << subCommandE;
|
|
|
|
}
|
|
|
|
if (!command.empty()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*this->GetFolderBuildStreams() << "'" << std::endl;
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::map<const cmSourceFile*, std::string>
|
2016-04-24 22:47:48 +03:00
|
|
|
cmGhsMultiTargetGenerator::GetObjectNames(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*>* const objectSources,
|
|
|
|
cmLocalGhsMultiGenerator* const localGhsMultiGenerator,
|
|
|
|
cmGeneratorTarget* const generatorTarget)
|
|
|
|
{
|
|
|
|
std::map<std::string, std::vector<cmSourceFile*> > filenameToSource;
|
|
|
|
std::map<cmSourceFile*, std::string> sourceToFilename;
|
|
|
|
for (std::vector<cmSourceFile*>::const_iterator sf = objectSources->begin();
|
|
|
|
sf != objectSources->end(); ++sf) {
|
2016-04-24 22:47:48 +03:00
|
|
|
const std::string filename =
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::GetFilenameName((*sf)->GetFullPath());
|
2016-04-24 22:47:48 +03:00
|
|
|
const std::string lower_filename = cmSystemTools::LowerCase(filename);
|
2016-05-05 07:49:27 +03:00
|
|
|
filenameToSource[lower_filename].push_back(*sf);
|
|
|
|
sourceToFilename[*sf] = lower_filename;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-05-05 07:49:27 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> duplicateSources;
|
|
|
|
for (std::map<std::string, std::vector<cmSourceFile*> >::const_iterator
|
|
|
|
msvSourceI = filenameToSource.begin();
|
|
|
|
msvSourceI != filenameToSource.end(); ++msvSourceI) {
|
|
|
|
if (msvSourceI->second.size() > 1) {
|
2016-05-05 07:49:27 +03:00
|
|
|
duplicateSources.insert(duplicateSources.end(),
|
|
|
|
msvSourceI->second.begin(),
|
|
|
|
msvSourceI->second.end());
|
2016-04-24 22:47:48 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-04-24 22:47:48 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::map<const cmSourceFile*, std::string> objectNamesCorrected;
|
2016-05-05 07:49:27 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile*>::const_iterator sf =
|
|
|
|
duplicateSources.begin();
|
|
|
|
sf != duplicateSources.end(); ++sf) {
|
2016-05-05 07:49:27 +03:00
|
|
|
std::string const longestObjectDirectory(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
|
|
|
|
localGhsMultiGenerator, generatorTarget, *sf));
|
2016-05-15 18:59:43 +03:00
|
|
|
std::string objFilenameName =
|
|
|
|
localGhsMultiGenerator->GetObjectFileNameWithoutTarget(
|
|
|
|
**sf, longestObjectDirectory);
|
|
|
|
cmsys::SystemTools::ReplaceString(objFilenameName, "/", "_");
|
|
|
|
objectNamesCorrected[*sf] = objFilenameName;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-04-24 22:47:48 +03:00
|
|
|
|
2016-05-05 07:49:27 +03:00
|
|
|
return objectNamesCorrected;
|
2016-04-24 22:47:48 +03:00
|
|
|
}
|
|
|
|
|
2015-03-24 08:12:55 +03:00
|
|
|
void cmGhsMultiTargetGenerator::WriteSources(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> const& objectSources,
|
|
|
|
std::map<const cmSourceFile*, std::string> const& objectNames)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile*>::const_iterator si = objectSources.begin();
|
|
|
|
si != objectSources.end(); ++si) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::vector<cmSourceGroup> sourceGroups(this->Makefile->GetSourceGroups());
|
2016-05-16 17:34:04 +03:00
|
|
|
char const* sourceFullPath = (*si)->GetFullPath().c_str();
|
|
|
|
cmSourceGroup* sourceGroup =
|
2015-03-24 08:12:55 +03:00
|
|
|
this->Makefile->FindSourceGroup(sourceFullPath, sourceGroups);
|
|
|
|
std::string sgPath(sourceGroup->GetFullName());
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(sgPath);
|
|
|
|
cmGlobalGhsMultiGenerator::AddFilesUpToPath(
|
|
|
|
this->GetFolderBuildStreams(), &this->FolderBuildStreams,
|
2015-10-07 02:17:48 +03:00
|
|
|
this->LocalGenerator->GetBinaryDirectory(), sgPath,
|
2015-03-24 08:12:55 +03:00
|
|
|
GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
|
|
|
|
|
2015-09-06 08:15:26 +03:00
|
|
|
std::string fullSourcePath((*si)->GetFullPath());
|
2016-05-16 17:34:04 +03:00
|
|
|
if ((*si)->GetExtension() == "int" || (*si)->GetExtension() == "bsp") {
|
2015-09-06 08:15:26 +03:00
|
|
|
*this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
// WORKAROUND: GHS MULTI needs the path to use backslashes without quotes
|
2015-09-06 08:15:26 +03:00
|
|
|
// to open files in search as of version 6.1.6
|
|
|
|
cmsys::SystemTools::ReplaceString(fullSourcePath, "/", "\\");
|
|
|
|
*this->FolderBuildStreams[sgPath] << fullSourcePath << std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
if ("ld" != (*si)->GetExtension() && "int" != (*si)->GetExtension() &&
|
2016-05-16 17:34:04 +03:00
|
|
|
"bsp" != (*si)->GetExtension()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
|
2016-05-16 17:34:04 +03:00
|
|
|
if (objectNames.end() != objectNames.find(*si)) {
|
|
|
|
*this->FolderBuildStreams[sgPath]
|
2016-05-15 18:59:43 +03:00
|
|
|
<< " -o \"" << objectNames.find(*si)->second << "\"" << std::endl;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
this->WriteObjectDir(this->FolderBuildStreams[sgPath],
|
|
|
|
this->AbsBuildFilePath + sgPath);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGeneratedFileStream* fileStream, cmSourceFile* sourceFile)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
|
|
|
|
if (NULL != rawLangProp) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string sourceLangProp(rawLangProp);
|
|
|
|
std::string extension(sourceFile->GetExtension());
|
2016-05-16 17:34:04 +03:00
|
|
|
if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
|
2015-03-24 08:12:55 +03:00
|
|
|
*fileStream << " -dotciscxx" << std::endl;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmGhsMultiTargetGenerator::WriteObjectDir(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGeneratedFileStream* fileStream, std::string const& dir)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string workingDir(dir);
|
|
|
|
cmSystemTools::ConvertToUnixSlashes(workingDir);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!workingDir.empty()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
workingDir += "/";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
workingDir += "Objs";
|
|
|
|
*fileStream << " -object_dir=\"" << workingDir << "\"" << std::endl;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetOutputDirectory(
|
|
|
|
const std::string& config) const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::string outputDir(AbsBuildFilePath);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* runtimeOutputProp =
|
2015-10-21 22:31:00 +03:00
|
|
|
this->GeneratorTarget->GetProperty("RUNTIME_OUTPUT_DIRECTORY");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (NULL != runtimeOutputProp) {
|
2015-03-24 08:12:55 +03:00
|
|
|
outputDir = runtimeOutputProp;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
std::string configCapped(cmSystemTools::UpperCase(config));
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* runtimeOutputSProp = this->GeneratorTarget->GetProperty(
|
|
|
|
"RUNTIME_OUTPUT_DIRECTORY_" + configCapped);
|
|
|
|
if (NULL != runtimeOutputSProp) {
|
2015-03-24 08:12:55 +03:00
|
|
|
outputDir = runtimeOutputSProp;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
cmSystemTools::ConvertToUnixSlashes(outputDir);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!outputDir.empty()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
outputDir += "/";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
return outputDir;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::GetOutputFilename(
|
|
|
|
const std::string& config) const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
2015-10-21 22:31:00 +03:00
|
|
|
std::string outputFilename(this->GeneratorTarget->GetName());
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* outputNameProp =
|
|
|
|
this->GeneratorTarget->GetProperty("OUTPUT_NAME");
|
|
|
|
if (NULL != outputNameProp) {
|
2015-03-24 08:12:55 +03:00
|
|
|
outputFilename = outputNameProp;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
std::string configCapped(cmSystemTools::UpperCase(config));
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* outputNameSProp =
|
2015-10-21 22:31:00 +03:00
|
|
|
this->GeneratorTarget->GetProperty(configCapped + "_OUTPUT_NAME");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (NULL != outputNameSProp) {
|
2015-03-24 08:12:55 +03:00
|
|
|
outputFilename = outputNameSProp;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
return outputFilename;
|
|
|
|
}
|
|
|
|
|
2016-05-05 07:49:27 +03:00
|
|
|
std::string cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmLocalGhsMultiGenerator const* localGhsMultiGenerator,
|
|
|
|
cmGeneratorTarget* const generatorTarget, cmSourceFile* const sourceFile)
|
2016-05-05 07:49:27 +03:00
|
|
|
{
|
|
|
|
std::string dir_max;
|
|
|
|
dir_max +=
|
2016-05-16 17:34:04 +03:00
|
|
|
localGhsMultiGenerator->GetMakefile()->GetCurrentBinaryDirectory();
|
2016-05-05 07:49:27 +03:00
|
|
|
dir_max += "/";
|
|
|
|
dir_max += generatorTarget->Target->GetName();
|
|
|
|
dir_max += "/";
|
|
|
|
std::vector<cmSourceGroup> sourceGroups(
|
2016-05-16 17:34:04 +03:00
|
|
|
localGhsMultiGenerator->GetMakefile()->GetSourceGroups());
|
|
|
|
char const* const sourceFullPath = sourceFile->GetFullPath().c_str();
|
|
|
|
cmSourceGroup* sourceGroup =
|
|
|
|
localGhsMultiGenerator->GetMakefile()->FindSourceGroup(sourceFullPath,
|
|
|
|
sourceGroups);
|
2016-05-05 07:49:27 +03:00
|
|
|
std::string const sgPath(sourceGroup->GetFullName());
|
|
|
|
dir_max += sgPath;
|
|
|
|
dir_max += "/Objs/libs/";
|
|
|
|
dir_max += generatorTarget->Target->GetName();
|
|
|
|
dir_max += "/";
|
|
|
|
return dir_max;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmGhsMultiTargetGenerator::IsNotKernel(std::string const& config,
|
|
|
|
const std::string& language)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
bool output;
|
|
|
|
std::vector<std::string> options;
|
2015-08-05 00:43:56 +03:00
|
|
|
this->GeneratorTarget->GetCompileOptions(options, config, language);
|
2015-03-24 08:12:55 +03:00
|
|
|
output =
|
|
|
|
options.end() == std::find(options.begin(), options.end(), "-kernel");
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2015-10-06 23:35:28 +03:00
|
|
|
bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(
|
2016-05-16 17:34:04 +03:00
|
|
|
const cmGeneratorTarget* target)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
bool output = false;
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> sources;
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string config =
|
2016-05-16 17:34:04 +03:00
|
|
|
target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
|
2015-08-29 18:51:15 +03:00
|
|
|
target->GetSourceFiles(sources, config);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile*>::const_iterator sources_i = sources.begin();
|
|
|
|
sources.end() != sources_i; ++sources_i) {
|
|
|
|
if ("int" == (*sources_i)->GetExtension()) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output = true;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cmGhsMultiTargetGenerator::DetermineIfDynamicDownload(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string const& config, const std::string& language)
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
std::vector<std::string> options;
|
|
|
|
bool output = false;
|
2015-08-05 00:43:56 +03:00
|
|
|
this->GeneratorTarget->GetCompileOptions(options, config, language);
|
2015-03-24 08:12:55 +03:00
|
|
|
for (std::vector<std::string>::const_iterator options_i = options.begin();
|
2016-05-16 17:34:04 +03:00
|
|
|
options_i != options.end(); ++options_i) {
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string option = *options_i;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->DDOption == option) {
|
2015-03-24 08:12:55 +03:00
|
|
|
output = true;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-24 08:12:55 +03:00
|
|
|
return output;
|
|
|
|
}
|