diff options
author | Brad King <brad.king@kitware.com> | 2014-08-13 15:20:20 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-08-13 18:48:03 (GMT) |
commit | e872744990f48777a1f1cebc791911363515092d (patch) | |
tree | 039a2a17d6647e645a7cd79efdc8c60c9a8d793d | |
parent | 0271a5f9ba3a8aa2b2e0a7d94a53ad3f9bb52a00 (diff) | |
download | CMake-e872744990f48777a1f1cebc791911363515092d.zip CMake-e872744990f48777a1f1cebc791911363515092d.tar.gz CMake-e872744990f48777a1f1cebc791911363515092d.tar.bz2 |
VS: Populate MASM tool build settings in .vcxproj files
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 92 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.h | 1 |
3 files changed, 99 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 9256b89..b9295e4 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -24,18 +24,22 @@ #include "cmVS10RCFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" +#include "cmVS10MASMFlagTable.h" #include "cmVS11CLFlagTable.h" #include "cmVS11RCFlagTable.h" #include "cmVS11LinkFlagTable.h" #include "cmVS11LibFlagTable.h" +#include "cmVS11MASMFlagTable.h" #include "cmVS12CLFlagTable.h" #include "cmVS12RCFlagTable.h" #include "cmVS12LinkFlagTable.h" #include "cmVS12LibFlagTable.h" +#include "cmVS12MASMFlagTable.h" #include "cmVS14CLFlagTable.h" #include "cmVS14RCFlagTable.h" #include "cmVS14LinkFlagTable.h" #include "cmVS14LibFlagTable.h" +#include "cmVS14MASMFlagTable.h" #include <cmsys/auto_ptr.hxx> @@ -111,6 +115,24 @@ cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const return 0; } +cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetMasmFlagTable() const +{ + if(this->MSTools) + { + cmLocalVisualStudioGenerator::VSVersion + v = this->LocalGenerator->GetVersion(); + if(v >= cmLocalVisualStudioGenerator::VS14) + { return cmVS14MASMFlagTable; } + else if(v >= cmLocalVisualStudioGenerator::VS12) + { return cmVS12MASMFlagTable; } + else if(v == cmLocalVisualStudioGenerator::VS11) + { return cmVS11MASMFlagTable; } + else + { return cmVS10MASMFlagTable; } + } + return 0; +} + static std::string cmVS10EscapeXML(std::string arg) { cmSystemTools::ReplaceString(arg, "&", "&"); @@ -251,6 +273,10 @@ void cmVisualStudio10TargetGenerator::Generate() { return; } + if(!this->ComputeMasmOptions()) + { + return; + } if(!this->ComputeLinkOptions()) { return; @@ -1646,6 +1672,71 @@ WriteRCOptions(std::string const& configName, this->WriteString("</ResourceCompile>\n", 2); } +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeMasmOptions() +{ + if(!this->GlobalGenerator->IsMasmEnabled()) + { + return true; + } + std::vector<std::string> const* configs = + this->GlobalGenerator->GetConfigurations(); + for(std::vector<std::string>::const_iterator i = configs->begin(); + i != configs->end(); ++i) + { + if(!this->ComputeMasmOptions(*i)) + { + return false; + } + } + return true; +} + +//---------------------------------------------------------------------------- +bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( + std::string const& configName) +{ + cmsys::auto_ptr<Options> pOptions( + new Options(this->LocalGenerator, Options::MasmCompiler, + this->GetMasmFlagTable())); + Options& masmOptions = *pOptions; + + std::string CONFIG = cmSystemTools::UpperCase(configName); + std::string configFlagsVar = std::string("CMAKE_ASM_MASM_FLAGS_") + CONFIG; + std::string flags = + std::string(this->Makefile->GetSafeDefinition("CMAKE_ASM_MASM_FLAGS")) + + std::string(" ") + + std::string(this->Makefile->GetSafeDefinition(configFlagsVar)); + + masmOptions.Parse(flags.c_str()); + this->MasmOptions[configName] = pOptions.release(); + return true; +} + +void cmVisualStudio10TargetGenerator:: +WriteMasmOptions(std::string const& configName, + std::vector<std::string> const& includes) +{ + if(!this->MSTools || !this->GlobalGenerator->IsMasmEnabled()) + { + return; + } + this->WriteString("<MASM>\n", 2); + + // Preprocessor definitions and includes are shared with clOptions. + Options& clOptions = *(this->ClOptions[configName]); + clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ", + "\n", "ASM_MASM"); + + Options& masmOptions = *(this->MasmOptions[configName]); + masmOptions.AppendFlag("IncludePaths", includes); + masmOptions.AppendFlag("IncludePaths", "%(IncludePaths)"); + masmOptions.OutputFlagMap(*this->BuildFileStream, " "); + masmOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); + + this->WriteString("</MASM>\n", 2); +} + void cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) @@ -1990,6 +2081,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() this->WriteClOptions(*i, includes); // output rc compile flags <ResourceCompile></ResourceCompile> this->WriteRCOptions(*i, includes); + this->WriteMasmOptions(*i, includes); } // output midl flags <Midl></Midl> this->WriteMidlOptions(*i, includes); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 4e9bcd1..93b72f4 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -78,6 +78,10 @@ private: bool ComputeRcOptions(std::string const& config); void WriteRCOptions(std::string const& config, std::vector<std::string> const & includes); + bool ComputeMasmOptions(); + bool ComputeMasmOptions(std::string const& config); + void WriteMasmOptions(std::string const& config, + std::vector<std::string> const& includes); bool ComputeLinkOptions(); bool ComputeLinkOptions(std::string const& config); void WriteLinkOptions(std::string const& config); @@ -109,12 +113,14 @@ private: cmIDEFlagTable const* GetRcFlagTable() const; cmIDEFlagTable const* GetLibFlagTable() const; cmIDEFlagTable const* GetLinkFlagTable() const; + cmIDEFlagTable const* GetMasmFlagTable() const; private: typedef cmVisualStudioGeneratorOptions Options; typedef std::map<std::string, Options*> OptionsMap; OptionsMap ClOptions; OptionsMap RcOptions; + OptionsMap MasmOptions; OptionsMap LinkOptions; std::string PathToVcxproj; cmTarget* Target; diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 47a7c62..8de6017 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -28,6 +28,7 @@ public: { Compiler, ResourceCompiler, + MasmCompiler, Linker, FortranCompiler }; |