VS: Add MASM support to VS 8 and 9 (#8170, #14984)

This commit is contained in:
Brad King 2014-08-07 15:20:49 -04:00
parent a43f44000d
commit 0f8522a6c9
2 changed files with 55 additions and 1 deletions

View File

@ -44,6 +44,16 @@ private:
extern cmVS7FlagTable cmLocalVisualStudio7GeneratorFlagTable[];
static void cmConvertToWindowsSlash(std::string& s)
{
std::string::size_type pos = 0;
while((pos = s.find('/', pos)) != std::string::npos)
{
s[pos] = '\\';
pos++;
}
}
//----------------------------------------------------------------------------
cmLocalVisualStudio7Generator::cmLocalVisualStudio7Generator(VSVersion v):
cmLocalVisualStudioGenerator(v)
@ -862,6 +872,31 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
}
}
fout << "/>\n"; // end of <Tool Name=VCCLCompilerTool
if(gg->IsMasmEnabled() && !this->FortranProject)
{
Options masmOptions(this, Options::MasmCompiler, 0, 0);
fout <<
"\t\t\t<Tool\n"
"\t\t\t\tName=\"MASM\"\n"
"\t\t\t\tIncludePaths=\""
;
const char* sep = "";
for(i = includes.begin(); i != includes.end(); ++i)
{
std::string inc = *i;
cmConvertToWindowsSlash(inc);
fout << sep << this->EscapeForXML(inc);
sep = ";";
}
fout << "\"\n";
// Use same preprocessor definitions as VCCLCompilerTool.
targetOptions.OutputPreprocessorDefinitions(fout, "\t\t\t\t", "\n",
"ASM_MASM");
masmOptions.OutputFlagMap(fout, "\t\t\t\t");
fout <<
"\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"
"\t\t\t/>\n";
}
tool = "VCCustomBuildTool";
if(this->FortranProject)
{
@ -1700,6 +1735,7 @@ bool cmLocalVisualStudio7Generator
{
aCompilerTool = "VFFortranCompilerTool";
}
std::string const& lang = (*sf)->GetLanguage();
std::string ext = (*sf)->GetExtension();
ext = cmSystemTools::LowerCase(ext);
if(ext == "idl")
@ -1727,6 +1763,11 @@ bool cmLocalVisualStudio7Generator
aCompilerTool = "VFCustomBuildTool";
}
}
if (gg->IsMasmEnabled() && !this->FortranProject &&
lang == "ASM_MASM")
{
aCompilerTool = "MASM";
}
for(std::map<std::string, cmLVS7GFileConfig>::const_iterator
fci = fcinfo.FileConfigMap.begin();
fci != fcinfo.FileConfigMap.end(); ++fci)
@ -2095,6 +2136,16 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
<< "\t<Platforms>\n"
<< "\t\t<Platform\n\t\t\tName=\"" << gg->GetPlatformName() << "\"/>\n"
<< "\t</Platforms>\n";
if(gg->IsMasmEnabled())
{
fout <<
"\t<ToolFiles>\n"
"\t\t<DefaultToolFile\n"
"\t\t\tFileName=\"masm.rules\"\n"
"\t\t/>\n"
"\t</ToolFiles>\n"
;
}
}

View File

@ -1680,7 +1680,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
endif()
if(MSVC AND NOT MSVC_VERSION LESS 1310
AND NOT CMAKE_GENERATOR MATCHES "Visual Studio [6789]( |$)")
AND NOT CMAKE_GENERATOR MATCHES "Visual Studio [67]( |$)"
AND (NOT CMAKE_GENERATOR MATCHES "Visual Studio [89]( |$)"
OR CMAKE_SIZEOF_VOID_P EQUAL 4)
)
ADD_TEST_MACRO(VSMASM VSMASM)
endif()