diff options
author | Morné Chamberlain <thefreeman.za@gmail.com> | 2012-11-11 20:07:49 (GMT) |
---|---|---|
committer | Morné Chamberlain <thefreeman.za@gmail.com> | 2012-11-11 20:07:49 (GMT) |
commit | 304b885d365b5814838e3c595bc17342553d3b68 (patch) | |
tree | d9fe42123e9fac22d02de50e3a43dfc2166581c8 /Source/cmExtraSublimeTextGenerator.h | |
parent | 5b2aa3dd9af903e7aae0a252d2119847ceac4aa0 (diff) | |
download | CMake-304b885d365b5814838e3c595bc17342553d3b68.zip CMake-304b885d365b5814838e3c595bc17342553d3b68.tar.gz CMake-304b885d365b5814838e3c595bc17342553d3b68.tar.bz2 |
Sublime Text 2 Gen: Per-source Compile flags are now saved in a separate file.
We no longer write sublimeclang_options to the project file, but instead
write a separate .sublimeclang-options JSON file that contains a map
of source file paths to compile flags for that file.
Diffstat (limited to 'Source/cmExtraSublimeTextGenerator.h')
-rw-r--r-- | Source/cmExtraSublimeTextGenerator.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Source/cmExtraSublimeTextGenerator.h b/Source/cmExtraSublimeTextGenerator.h index fe8832f..26e09a6 100644 --- a/Source/cmExtraSublimeTextGenerator.h +++ b/Source/cmExtraSublimeTextGenerator.h @@ -14,11 +14,13 @@ #define cmExtraSublimeTextGenerator_h #include "cmExternalMakefileProjectGenerator.h" +#include "cmSourceFile.h" class cmLocalGenerator; class cmMakefile; class cmTarget; class cmGeneratedFileStream; +class cmGeneratorTarget; /** \class cmExtraSublimeTextGenerator * \brief Write Sublime Text 2 project files for Makefile based projects @@ -26,6 +28,7 @@ class cmGeneratedFileStream; class cmExtraSublimeTextGenerator : public cmExternalMakefileProjectGenerator { public: + typedef std::map<std::string, std::vector<std::string> > MapSourceFileFlags; cmExtraSublimeTextGenerator(); virtual const char* GetName() const @@ -45,14 +48,15 @@ private: void CreateNewProjectFile(const std::vector<cmLocalGenerator*>& lgs, const std::string& filename); + void WriteSublimeClangOptionsFile(const MapSourceFileFlags& sourceFileFlags, + const std::string& filename); /** 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, const cmMakefile* mf, cmGeneratedFileStream& fout, - std::set<std::string>& includeDirs, - std::set<std::string>& defines); + MapSourceFileFlags& sourceFileFlags); /** Returns the build command that needs to be executed to build the * specified target. */ @@ -63,18 +67,24 @@ private: */ void AppendTarget(cmGeneratedFileStream& fout, const char* targetName, + cmLocalGenerator* lg, cmTarget* target, const char* make, const cmMakefile* makefile, const char* compiler, - std::set<std::string>& includeDirs, - std::set<std::string>& defines, bool firstTarget); + MapSourceFileFlags& sourceFileFlags, bool firstTarget); /** - * Extracts compile flags from a variable. - * flag would typically be "-D" or "-I" + * 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(). */ - void ExtractFlags(const char* value, const std::string& flag, - std::set<std::string> &defines); + std::string ComputeFlagsForObject(cmSourceFile *source, + cmLocalGenerator* lg, + cmTarget *target, + cmGeneratorTarget* gtgt); + + std::string ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, + cmTarget *target, cmGeneratorTarget* gtgt); }; #endif |