2015-03-24 08:12:55 +03:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2015 Geoffrey Viola <geoffrey.viola@asirobots.com>
|
|
|
|
|
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
|
|
|
|
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
|
|
|
#ifndef cmGhsMultiTargetGenerator_h
|
|
|
|
#define cmGhsMultiTargetGenerator_h
|
|
|
|
|
|
|
|
#include "cmGhsMultiGpj.h"
|
|
|
|
|
2016-04-29 16:40:20 +03:00
|
|
|
#include "cmTarget.h"
|
|
|
|
|
2016-08-17 02:08:13 +03:00
|
|
|
class cmCustomCommand;
|
2015-03-24 08:12:55 +03:00
|
|
|
class cmGeneratedFileStream;
|
2016-08-17 02:08:13 +03:00
|
|
|
class cmGeneratorTarget;
|
2015-03-24 08:12:55 +03:00
|
|
|
class cmGlobalGhsMultiGenerator;
|
|
|
|
class cmLocalGhsMultiGenerator;
|
|
|
|
class cmMakefile;
|
|
|
|
class cmSourceFile;
|
|
|
|
|
|
|
|
class cmGhsMultiTargetGenerator
|
|
|
|
{
|
|
|
|
public:
|
2015-06-06 14:02:59 +03:00
|
|
|
cmGhsMultiTargetGenerator(cmGeneratorTarget* target);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
virtual ~cmGhsMultiTargetGenerator();
|
|
|
|
|
|
|
|
virtual void Generate();
|
|
|
|
|
|
|
|
bool IncludeThisTarget();
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> GetSources() const;
|
2015-03-24 08:12:55 +03:00
|
|
|
GhsMultiGpj::Types GetGpjTag() const;
|
2015-10-06 23:35:28 +03:00
|
|
|
static GhsMultiGpj::Types GetGpjTag(const cmGeneratorTarget* target);
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* GetAbsBuildFilePath() const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
return this->AbsBuildFilePath.c_str();
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* GetRelBuildFileName() const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
return this->RelBuildFileName.c_str();
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* GetAbsBuildFileName() const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
return this->AbsBuildFileName.c_str();
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* GetAbsOutputFileName() const
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
return this->AbsOutputFileName.c_str();
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
static std::string GetRelBuildFilePath(const cmGeneratorTarget* target);
|
|
|
|
static std::string GetAbsPathToRoot(const cmGeneratorTarget* target);
|
|
|
|
static std::string GetAbsBuildFilePath(const cmGeneratorTarget* target);
|
|
|
|
static std::string GetRelBuildFileName(const cmGeneratorTarget* target);
|
|
|
|
static std::string GetBuildFileName(const cmGeneratorTarget* target);
|
|
|
|
static std::string AddSlashIfNeededToPath(std::string const& input);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
|
|
|
private:
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalGhsMultiGenerator* GetGlobalGenerator() const;
|
|
|
|
cmGeneratedFileStream* GetFolderBuildStreams()
|
2015-03-24 08:12:55 +03:00
|
|
|
{
|
|
|
|
return this->FolderBuildStreams[""];
|
|
|
|
};
|
|
|
|
bool IsTargetGroup() const { return this->TargetGroup; }
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void WriteTypeSpecifics(const std::string& config, bool notKernel);
|
|
|
|
void WriteCompilerFlags(const std::string& config,
|
|
|
|
const std::string& language);
|
|
|
|
void WriteCompilerDefinitions(const std::string& config,
|
|
|
|
const std::string& language);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void SetCompilerFlags(std::string const& config, const std::string& language,
|
2015-03-24 08:12:55 +03:00
|
|
|
bool const notKernel);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string GetDefines(const std::string& langugae,
|
|
|
|
std::string const& config);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void WriteIncludes(const std::string& config, const std::string& language);
|
2016-03-27 06:28:31 +03:00
|
|
|
void WriteTargetLinkLibraries(std::string const& config,
|
|
|
|
std::string const& language);
|
2015-03-24 08:12:55 +03:00
|
|
|
void WriteCustomCommands();
|
2016-05-16 17:34:04 +03:00
|
|
|
void WriteCustomCommandsHelper(
|
|
|
|
std::vector<cmCustomCommand> const& commandsSet,
|
|
|
|
cmTarget::CustomCommandType commandType);
|
2016-05-05 07:49:27 +03:00
|
|
|
void WriteSources(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile*> const& objectSources,
|
|
|
|
std::map<const cmSourceFile*, std::string> const& objectNames);
|
|
|
|
static std::map<const cmSourceFile*, std::string> GetObjectNames(
|
|
|
|
std::vector<cmSourceFile*>* objectSources,
|
|
|
|
cmLocalGhsMultiGenerator* localGhsMultiGenerator,
|
|
|
|
cmGeneratorTarget* generatorTarget);
|
|
|
|
static void WriteObjectLangOverride(cmGeneratedFileStream* fileStream,
|
|
|
|
cmSourceFile* sourceFile);
|
|
|
|
static void WriteObjectDir(cmGeneratedFileStream* fileStream,
|
|
|
|
std::string const& dir);
|
|
|
|
std::string GetOutputDirectory(const std::string& config) const;
|
|
|
|
std::string GetOutputFilename(const std::string& config) const;
|
2016-05-05 07:49:27 +03:00
|
|
|
static std::string ComputeLongestObjectDirectory(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmLocalGhsMultiGenerator const* localGhsMultiGenerator,
|
|
|
|
cmGeneratorTarget* generatorTarget, cmSourceFile* const sourceFile);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool IsNotKernel(std::string const& config, const std::string& language);
|
2015-10-06 23:35:28 +03:00
|
|
|
static bool DetermineIfTargetGroup(const cmGeneratorTarget* target);
|
2016-05-16 17:34:04 +03:00
|
|
|
bool DetermineIfDynamicDownload(std::string const& config,
|
|
|
|
const std::string& language);
|
2015-03-24 08:12:55 +03:00
|
|
|
|
2015-06-06 14:02:59 +03:00
|
|
|
cmGeneratorTarget* GeneratorTarget;
|
2016-05-16 17:34:04 +03:00
|
|
|
cmLocalGhsMultiGenerator* LocalGenerator;
|
|
|
|
cmMakefile* Makefile;
|
2015-03-24 08:12:55 +03:00
|
|
|
std::string AbsBuildFilePath;
|
|
|
|
std::string RelBuildFilePath;
|
|
|
|
std::string AbsBuildFileName;
|
|
|
|
std::string RelBuildFileName;
|
|
|
|
std::string RelOutputFileName;
|
|
|
|
std::string AbsOutputFileName;
|
2016-05-16 17:34:04 +03:00
|
|
|
std::map<std::string, cmGeneratedFileStream*> FolderBuildStreams;
|
2015-03-24 08:12:55 +03:00
|
|
|
bool TargetGroup;
|
|
|
|
bool DynamicDownload;
|
|
|
|
static std::string const DDOption;
|
|
|
|
std::map<std::string, std::string> FlagsByLanguage;
|
|
|
|
std::map<std::string, std::string> DefinesByLanguage;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ! cmGhsMultiTargetGenerator_h
|