2012-10-11 02:01:48 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2004-2009 Kitware, Inc.
|
|
|
|
Copyright 2004 Alexander Neundorf (neundorf@kde.org)
|
|
|
|
|
|
|
|
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 cmExtraSublimeTextGenerator_h
|
|
|
|
#define cmExtraSublimeTextGenerator_h
|
|
|
|
|
|
|
|
#include "cmExternalMakefileProjectGenerator.h"
|
2012-11-12 00:07:49 +04:00
|
|
|
#include "cmSourceFile.h"
|
2012-10-11 02:01:48 +04:00
|
|
|
|
|
|
|
class cmLocalGenerator;
|
|
|
|
class cmMakefile;
|
|
|
|
class cmGeneratedFileStream;
|
2012-11-12 00:07:49 +04:00
|
|
|
class cmGeneratorTarget;
|
2012-10-11 02:01:48 +04:00
|
|
|
|
|
|
|
/** \class cmExtraSublimeTextGenerator
|
|
|
|
* \brief Write Sublime Text 2 project files for Makefile based projects
|
|
|
|
*/
|
|
|
|
class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
|
|
|
|
{
|
|
|
|
public:
|
2012-11-12 00:07:49 +04:00
|
|
|
typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags;
|
2012-10-11 02:01:48 +04:00
|
|
|
cmExtraSublimeTextGenerator();
|
|
|
|
|
2014-02-25 02:36:27 +04:00
|
|
|
virtual std::string GetName() const
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return cmExtraSublimeTextGenerator::GetActualName();
|
|
|
|
}
|
|
|
|
static std::string GetActualName() { return "Sublime Text 2"; }
|
2012-10-11 02:01:48 +04:00
|
|
|
static cmExternalMakefileProjectGenerator* New()
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
|
|
|
return new cmExtraSublimeTextGenerator;
|
|
|
|
}
|
2012-10-11 02:01:48 +04:00
|
|
|
/** Get the documentation entry for this generator. */
|
|
|
|
virtual void GetDocumentation(cmDocumentationEntry& entry,
|
2014-02-25 02:36:27 +04:00
|
|
|
const std::string& fullName) const;
|
2012-10-11 02:01:48 +04:00
|
|
|
|
|
|
|
virtual void Generate();
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
private:
|
2012-10-11 02:01:48 +04:00
|
|
|
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
|
|
|
|
|
|
|
|
void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
|
2016-05-16 17:34:04 +03:00
|
|
|
const std::string& filename);
|
2013-02-06 22:31:44 +04:00
|
|
|
|
2012-10-12 00:53:40 +04:00
|
|
|
/** Appends all targets as build systems to the project file and get all
|
|
|
|
* include directories and compiler definitions used.
|
|
|
|
*/
|
|
|
|
void AppendAllTargets(const std::vector<cmLocalGenerator*>& lgs,
|
2016-05-16 17:34:04 +03:00
|
|
|
const cmMakefile* mf, cmGeneratedFileStream& fout,
|
2012-11-12 00:07:49 +04:00
|
|
|
MapSourceFileFlags& sourceFileFlags);
|
2012-10-13 14:54:51 +04:00
|
|
|
/** Returns the build command that needs to be executed to build the
|
|
|
|
* specified target.
|
|
|
|
*/
|
2012-10-11 02:01:48 +04:00
|
|
|
std::string BuildMakeCommand(const std::string& make, const char* makefile,
|
2014-02-07 02:31:47 +04:00
|
|
|
const std::string& target);
|
2012-10-13 14:54:51 +04:00
|
|
|
/** Appends the specified target to the generated project file as a Sublime
|
|
|
|
* Text build system.
|
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
void AppendTarget(cmGeneratedFileStream& fout, const std::string& targetName,
|
|
|
|
cmLocalGenerator* lg, cmGeneratorTarget* target,
|
|
|
|
const char* make, const cmMakefile* makefile,
|
|
|
|
const char* compiler, MapSourceFileFlags& sourceFileFlags,
|
|
|
|
bool firstTarget);
|
2012-11-04 18:15:04 +04:00
|
|
|
/**
|
2012-11-12 00:07:49 +04:00
|
|
|
* Compute the flags for compilation of object files for a given @a language.
|
|
|
|
* @note Generally it is the value of the variable whose name is computed
|
|
|
|
* by LanguageFlagsVarName().
|
2012-11-04 18:15:04 +04:00
|
|
|
*/
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string ComputeFlagsForObject(cmSourceFile* source, cmLocalGenerator* lg,
|
2012-11-12 00:07:49 +04:00
|
|
|
cmGeneratorTarget* gtgt);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
|
2015-10-09 23:04:51 +03:00
|
|
|
cmGeneratorTarget* gtgt);
|
2012-10-11 02:01:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|