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. */
|
2012-10-11 02:01:48 +04:00
|
|
|
#ifndef cmExtraSublimeTextGenerator_h
|
|
|
|
#define cmExtraSublimeTextGenerator_h
|
|
|
|
|
2016-09-01 21:59:28 +03:00
|
|
|
#include <cmConfigure.h>
|
|
|
|
|
2012-10-11 02:01:48 +04:00
|
|
|
#include "cmExternalMakefileProjectGenerator.h"
|
|
|
|
|
2016-09-01 21:59:28 +03:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2012-10-11 02:01:48 +04:00
|
|
|
class cmGeneratedFileStream;
|
2012-11-12 00:07:49 +04:00
|
|
|
class cmGeneratorTarget;
|
2016-09-01 21:59:28 +03:00
|
|
|
class cmLocalGenerator;
|
|
|
|
class cmMakefile;
|
|
|
|
class cmSourceFile;
|
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:
|
2016-07-20 19:28:39 +03:00
|
|
|
static cmExternalMakefileProjectGeneratorFactory* GetFactory();
|
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();
|
|
|
|
|
2016-06-27 22:25:27 +03:00
|
|
|
void Generate() CM_OVERRIDE;
|
2012-10-11 02:01:48 +04:00
|
|
|
|
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
|