summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-08-22 14:37:55 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-08-22 14:37:55 (GMT)
commit8c30014982345567b80ec0dad6bd9eb40dfda505 (patch)
treeeb404629813faddbcafa301d87d10151a94e03cc /Source/cmVisualStudio10TargetGenerator.cxx
parentb4d3e7a7b0b4b9bdff55249633d902a35f26c02a (diff)
parentcbd1d42b34bf83ca24de1b98c5963a2941206300 (diff)
downloadCMake-8c30014982345567b80ec0dad6bd9eb40dfda505.zip
CMake-8c30014982345567b80ec0dad6bd9eb40dfda505.tar.gz
CMake-8c30014982345567b80ec0dad6bd9eb40dfda505.tar.bz2
Merge topic 'vs-masm'
cbd1d42b Help: Add notes for topic 'vs-masm' 0f8522a6 VS: Add MASM support to VS 8 and 9 (#8170, #14984) a43f4400 VS: Move internal MasmEnabled member up to VS 7 generator df3b007d VS: Add test for MASM support e8727449 VS: Populate MASM tool build settings in .vcxproj files 0271a5f9 VS: Manually fix MASM flag table entries 1d662e48 VS: Generate MASM flag tables from MSBuild tool files 4f6940df VS: Fix ASM_MASM support in VS >= 10 d7866c52 ASM_MASM: Fix selection of ml64 0374abdb ASM_MASM: Add preprocessor definitions to compile lines 5b0a46e1 ASM_MASM: Do not require compiler to be a full path 802dbe52 cmLocalVisualStudio7Generator: Rename local 'lang' var
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx94
1 files changed, 93 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ef343b6..09a9252 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, "&", "&amp;");
@@ -251,6 +273,10 @@ void cmVisualStudio10TargetGenerator::Generate()
{
return;
}
+ if(!this->ComputeMasmOptions())
+ {
+ return;
+ }
if(!this->ComputeLinkOptions())
{
return;
@@ -1192,7 +1218,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
{
tool = "ClCompile";
}
- else if (lang == "ASM_NASM" &&
+ else if (lang == "ASM_MASM" &&
this->GlobalGenerator->IsMasmEnabled())
{
tool = "MASM";
@@ -1715,6 +1741,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)
@@ -2059,6 +2150,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);