cmake/Source/cmExtraSublimeTextGenerator.h

77 lines
2.8 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2013-03-16 19:13:01 +02:00
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include <map>
#include <string>
#include <vector>
2020-02-01 23:06:01 +01:00
#include "cmExternalMakefileProjectGenerator.h"
2013-03-16 19:13:01 +02:00
class cmGeneratedFileStream;
class cmGeneratorTarget;
2016-10-30 18:24:19 +01:00
class cmLocalGenerator;
class cmMakefile;
class cmSourceFile;
2013-03-16 19:13:01 +02:00
/** \class cmExtraSublimeTextGenerator
* \brief Write Sublime Text 2 project files for Makefile based projects
*/
class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator
{
public:
2016-10-30 18:24:19 +01:00
static cmExternalMakefileProjectGeneratorFactory* GetFactory();
2020-02-01 23:06:01 +01:00
using MapSourceFileFlags = std::map<std::string, std::vector<std::string>>;
2013-03-16 19:13:01 +02:00
cmExtraSublimeTextGenerator();
2018-01-26 17:06:56 +01:00
void Generate() override;
2013-03-16 19:13:01 +02:00
2016-07-09 11:21:54 +02:00
private:
2013-03-16 19:13:01 +02:00
void CreateProjectFile(const std::vector<cmLocalGenerator*>& lgs);
void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs,
2016-07-09 11:21:54 +02:00
const std::string& filename);
2013-03-16 19:13:01 +02: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-07-09 11:21:54 +02:00
const cmMakefile* mf, cmGeneratedFileStream& fout,
2013-03-16 19:13:01 +02:00
MapSourceFileFlags& sourceFileFlags);
/** Returns the build command that needs to be executed to build the
* specified target.
*/
2020-08-30 11:54:41 +02:00
std::string BuildMakeCommand(const std::string& make,
const std::string& makefile,
2015-04-27 22:25:09 +02:00
const std::string& target);
2013-03-16 19:13:01 +02:00
/** Appends the specified target to the generated project file as a Sublime
* Text build system.
*/
2016-07-09 11:21:54 +02: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);
2013-03-16 19:13:01 +02: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().
*/
2016-07-09 11:21:54 +02:00
std::string ComputeFlagsForObject(cmSourceFile* source, cmLocalGenerator* lg,
2013-03-16 19:13:01 +02:00
cmGeneratorTarget* gtgt);
2016-07-09 11:21:54 +02:00
std::string ComputeDefines(cmSourceFile* source, cmLocalGenerator* lg,
2016-03-13 13:35:51 +01:00
cmGeneratorTarget* gtgt);
2017-04-14 19:02:05 +02:00
2018-04-23 21:13:27 +02:00
std::string ComputeIncludes(cmSourceFile* source, cmLocalGenerator* lg,
cmGeneratorTarget* gtgt);
bool Open(const std::string& bindir, const std::string& projectName,
bool dryRun) override;
2017-04-14 19:02:05 +02:00
bool ExcludeBuildFolder;
std::string EnvSettings;
2013-03-16 19:13:01 +02:00
};