summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx268
1 files changed, 178 insertions, 90 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8882c45..1f45ce3 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -80,10 +80,10 @@ struct cmVisualStudio10TargetGenerator::Elem
bool HasContent = false;
std::string Tag;
- Elem(std::ostream& s, const std::string& tag)
+ Elem(std::ostream& s, std::string tag)
: S(s)
, Indent(0)
- , Tag(tag)
+ , Tag(std::move(tag))
{
this->StartElement();
}
@@ -200,7 +200,7 @@ struct cmVisualStudio10TargetGenerator::OptionsHelper
}
};
-static std::string cmVS10EscapeComment(std::string comment)
+static std::string cmVS10EscapeComment(std::string const& comment)
{
// MSBuild takes the CDATA of a <Message></Message> element and just
// does "echo $CDATA" with no escapes. We must encode the string.
@@ -275,8 +275,8 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
this->NsightTegra = gg->IsNsightTegra();
this->Android = gg->TargetsAndroid();
- for (int i = 0; i < 4; ++i) {
- this->NsightTegraVersion[i] = 0;
+ for (unsigned int& version : this->NsightTegraVersion) {
+ version = 0;
}
sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u",
&this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
@@ -293,9 +293,7 @@ cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
this->ClassifyAllConfigSources();
}
-cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
-{
-}
+cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() = default;
std::string cmVisualStudio10TargetGenerator::CalcCondition(
const std::string& config) const
@@ -358,7 +356,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->GeneratorTarget->CheckCxxModuleStatus(config);
}
- if (this->GeneratorTarget->HaveCxx20ModuleSources()) {
+ if (this->GeneratorTarget->HaveCxx20ModuleSources() &&
+ !this->GlobalGenerator->SupportsCxxModuleDyndep()) {
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The \"", this->GeneratorTarget->GetName(),
@@ -406,6 +405,9 @@ void cmVisualStudio10TargetGenerator::Generate()
if (!this->ComputeCudaLinkOptions()) {
return;
}
+ if (!this->ComputeMarmasmOptions()) {
+ return;
+ }
if (!this->ComputeMasmOptions()) {
return;
}
@@ -423,7 +425,7 @@ void cmVisualStudio10TargetGenerator::Generate()
cmStrCat(this->LocalGenerator->GetCurrentBinaryDirectory(), '/',
this->Name, ProjectFileExtension);
cmGeneratedFileStream BuildFileStream(path);
- const std::string PathToProjectFile = path;
+ const std::string& PathToProjectFile = path;
BuildFileStream.SetCopyIfDifferent(true);
// Write the encoding header into the file
@@ -453,7 +455,7 @@ void cmVisualStudio10TargetGenerator::Generate()
void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
cmGeneratedFileStream& BuildFileStream)
{
- BuildFileStream << "<?xml version=\"1.0\" encoding=\""
+ BuildFileStream << R"(<?xml version="1.0" encoding=")"
<< this->GlobalGenerator->Encoding() << "\"?>";
{
Elem e0(BuildFileStream, "Project");
@@ -725,13 +727,18 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
: customDir +
this->GlobalGenerator
->GetPlatformToolsetCudaVSIntegrationSubdirString() +
- "extras\\visual_studio_integration\\MSBuildExtensions\\";
+ R"(extras\visual_studio_integration\MSBuildExtensions\)";
Elem(e1, "Import")
.Attribute("Project",
std::move(cudaPath) + "CUDA " +
this->GlobalGenerator->GetPlatformToolsetCuda() +
".props");
}
+ if (this->GlobalGenerator->IsMarmasmEnabled()) {
+ Elem(e1, "Import")
+ .Attribute("Project",
+ "$(VCTargetsPath)\\BuildCustomizations\\marmasm.props");
+ }
if (this->GlobalGenerator->IsMasmEnabled()) {
Elem(e1, "Import")
.Attribute("Project",
@@ -823,13 +830,18 @@ void cmVisualStudio10TargetGenerator::WriteClassicMsBuildProjectFile(
: customDir +
this->GlobalGenerator
->GetPlatformToolsetCudaVSIntegrationSubdirString() +
- "extras\\visual_studio_integration\\MSBuildExtensions\\";
+ R"(extras\visual_studio_integration\MSBuildExtensions\)";
Elem(e1, "Import")
.Attribute("Project",
std::move(cudaPath) + "CUDA " +
this->GlobalGenerator->GetPlatformToolsetCuda() +
".targets");
}
+ if (this->GlobalGenerator->IsMarmasmEnabled()) {
+ Elem(e1, "Import")
+ .Attribute("Project",
+ "$(VCTargetsPath)\\BuildCustomizations\\marmasm.targets");
+ }
if (this->GlobalGenerator->IsMasmEnabled()) {
Elem(e1, "Import")
.Attribute("Project",
@@ -979,6 +991,8 @@ void cmVisualStudio10TargetGenerator::WriteSdkStyleProjectFile(
this->WriteDotNetDocumentationFile(e0);
this->WriteAllSources(e0);
+ this->WriteEmbeddedResourceGroup(e0);
+ this->WriteXamlFilesGroup(e0);
this->WriteDotNetReferences(e0);
this->WritePackageReferences(e0);
this->WriteProjectReferences(e0);
@@ -1020,8 +1034,9 @@ void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1)
std::vector<std::string> keys = this->GeneratorTarget->GetPropertyKeys();
for (std::string const& keyIt : keys) {
static const cm::string_view prefix = "VS_GLOBAL_";
- if (!cmHasPrefix(keyIt, prefix))
+ if (!cmHasPrefix(keyIt, prefix)) {
continue;
+ }
cm::string_view globalKey = cm::string_view(keyIt).substr(prefix.length());
// Skip invalid or separately-handled properties.
if (globalKey.empty() || globalKey == "PROJECT_TYPES" ||
@@ -1029,8 +1044,9 @@ void cmVisualStudio10TargetGenerator::WriteCommonPropertyGroupGlobals(Elem& e1)
continue;
}
cmValue value = this->GeneratorTarget->GetProperty(keyIt);
- if (!value)
+ if (!value) {
continue;
+ }
e1.Element(globalKey, *value);
}
}
@@ -1043,14 +1059,11 @@ bool cmVisualStudio10TargetGenerator::HasCustomCommands() const
return true;
}
- for (cmGeneratorTarget::AllConfigSource const& si :
- this->GeneratorTarget->GetAllConfigSources()) {
- if (si.Source->GetCustomCommand()) {
- return true;
- }
- }
-
- return false;
+ auto const& config_sources = this->GeneratorTarget->GetAllConfigSources();
+ return std::any_of(config_sources.begin(), config_sources.end(),
+ [](cmGeneratorTarget::AllConfigSource const& si) {
+ return si.Source->GetCustomCommand();
+ });
}
void cmVisualStudio10TargetGenerator::WritePackageReferences(Elem& e0)
@@ -1220,7 +1233,7 @@ void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup(Elem& e0)
e2.Attribute("Include", obj);
if (this->ProjectType != VsProjectType::csproj) {
- std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
+ std::string hFileName = obj.substr(0, obj.find_last_of('.')) + ".h";
e2.Element("DependentUpon", hFileName);
for (std::string const& c : this->Configurations) {
@@ -1912,7 +1925,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
fout.write(magic, 3);
- fout << "<?xml version=\"1.0\" encoding=\""
+ fout << R"(<?xml version="1.0" encoding=")"
<< this->GlobalGenerator->Encoding() << "\"?>";
{
Elem e0(fout, "Project");
@@ -2068,7 +2081,7 @@ void cmVisualStudio10TargetGenerator::WriteHeaderSource(
e2.Element("FileType", "CppForm");
} else if (this->IsXamlHeader(fileName)) {
e2.Element("DependentUpon",
- fileName.substr(0, fileName.find_last_of(".")));
+ fileName.substr(0, fileName.find_last_of('.')));
}
this->FinishWritingSource(e2, toolSettings);
}
@@ -2077,7 +2090,7 @@ void cmVisualStudio10TargetGenerator::ParseSettingsProperty(
const std::string& settingsPropertyValue, ConfigToSettings& toolSettings)
{
if (!settingsPropertyValue.empty()) {
- cmGeneratorExpression ge;
+ cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(settingsPropertyValue);
@@ -2104,7 +2117,7 @@ void cmVisualStudio10TargetGenerator::ParseSettingsProperty(
bool cmVisualStudio10TargetGenerator::PropertyIsSameInAllConfigs(
const ConfigToSettings& toolSettings, const std::string& propName)
{
- std::string firstPropValue = "";
+ std::string firstPropValue;
for (const auto& configToSettings : toolSettings) {
const std::unordered_map<std::string, std::string>& settings =
configToSettings.second;
@@ -2177,7 +2190,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
}
// Figure out if there's any additional flags to use
if (cmValue saf = sf->GetProperty("VS_SHADER_FLAGS")) {
- cmGeneratorExpression ge;
+ cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*saf);
for (const std::string& config : this->Configurations) {
@@ -2190,7 +2203,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
}
// Figure out if debug information should be generated
if (cmValue sed = sf->GetProperty("VS_SHADER_ENABLE_DEBUG")) {
- cmGeneratorExpression ge;
+ cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*sed);
for (const std::string& config : this->Configurations) {
@@ -2204,7 +2217,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
}
// Figure out if optimizations should be disabled
if (cmValue sdo = sf->GetProperty("VS_SHADER_DISABLE_OPTIMIZATIONS")) {
- cmGeneratorExpression ge;
+ cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*sdo);
for (const std::string& config : this->Configurations) {
@@ -2318,26 +2331,23 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(
this->FinishWritingSource(e2, toolSettings);
if (!deployContent.empty()) {
- cmGeneratorExpression ge;
+ cmGeneratorExpression ge(*this->LocalGenerator->GetCMakeInstance());
std::unique_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(deployContent);
// Deployment location cannot be set on a configuration basis
if (!deployLocation.empty()) {
e2.Element("Link", deployLocation + "\\%(FileName)%(Extension)");
}
- for (size_t i = 0; i != this->Configurations.size(); ++i) {
- if (cge->Evaluate(this->LocalGenerator, this->Configurations[i]) ==
- "1") {
+ for (auto& config : this->Configurations) {
+ if (cge->Evaluate(this->LocalGenerator, config) == "1") {
e2.WritePlatformConfigTag("DeploymentContent",
"'$(Configuration)|$(Platform)'=='" +
- this->Configurations[i] + "|" +
- this->Platform + "'",
+ config + "|" + this->Platform + "'",
"true");
} else {
e2.WritePlatformConfigTag("ExcludedFromBuild",
"'$(Configuration)|$(Platform)'=='" +
- this->Configurations[i] + "|" +
- this->Platform + "'",
+ config + "|" + this->Platform + "'",
"true");
}
}
@@ -2388,8 +2398,9 @@ void cmVisualStudio10TargetGenerator::WriteSource(Elem& e2,
// added with the plain filename without any path. This means the file will
// show up at root-level of the csproj (where CMakeLists.txt etc. are).
std::string link = this->GetCSharpSourceLink(sf);
- if (link.empty())
+ if (link.empty()) {
link = cmsys::SystemTools::GetFilenameName(sf->GetFullPath());
+ }
e2.Element("Link", link);
}
@@ -2485,6 +2496,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
const std::string& lang = si.Source->GetLanguage();
if (lang == "C" || lang == "CXX") {
tool = "ClCompile";
+ } else if (lang == "ASM_MARMASM" &&
+ this->GlobalGenerator->IsMarmasmEnabled()) {
+ tool = "MARMASM";
} else if (lang == "ASM_MASM" &&
this->GlobalGenerator->IsMasmEnabled()) {
tool = "MASM";
@@ -2519,7 +2533,7 @@ void cmVisualStudio10TargetGenerator::WriteAllSources(Elem& e0)
Elem e2(e1, tool);
bool isCSharp = (si.Source->GetLanguage() == "CSharp");
- if (isCSharp && exclude_configs.size() > 0) {
+ if (isCSharp && !exclude_configs.empty()) {
std::stringstream conditions;
bool firstConditionSet{ false };
for (const auto& ci : include_configs) {
@@ -2661,7 +2675,7 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
? "C"
: this->GlobalGenerator->GetLanguageFromExtension(ext.c_str());
std::string lang = this->LocalGenerator->GetSourceFileLanguage(sf);
- const char* compileAs = 0;
+ const char* compileAs = nullptr;
if (lang != extLang) {
if (lang == "CXX") {
// force a C++ file type
@@ -2699,6 +2713,8 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
}
for (std::string const& config : this->Configurations) {
+ this->GeneratorTarget->NeedCxxModuleSupport(lang, config);
+
std::string configUpper = cmSystemTools::UpperCase(config);
std::string configDefines = defines;
std::string defPropName = cmStrCat("COMPILE_DEFINITIONS_", configUpper);
@@ -2711,6 +2727,31 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
configDefines += *ccdefs;
}
+ bool const shouldScanForModules = lang == "CXX"_s &&
+ this->GeneratorTarget->NeedDyndepForSource(lang, config, source);
+ auto const* fs =
+ this->GeneratorTarget->GetFileSetForSource(config, source);
+ const char* compileAsPerConfig = compileAs;
+ if (fs &&
+ (fs->GetType() == "CXX_MODULES"_s ||
+ fs->GetType() == "CXX_MODULE_HEADER_UNITS"_s)) {
+ if (lang == "CXX"_s) {
+ if (fs->GetType() == "CXX_MODULES"_s) {
+ compileAsPerConfig = "CompileAsCppModule";
+ } else {
+ compileAsPerConfig = "CompileAsHeaderUnit";
+ }
+ } else {
+ this->Makefile->IssueMessage(
+ MessageType::FATAL_ERROR,
+ cmStrCat(
+ "Target \"", this->GeneratorTarget->Target->GetName(),
+ "\" contains the source\n ", source->GetFullPath(),
+ "\nin a file set of type \"", fs->GetType(),
+ R"(" but the source is not classified as a "CXX" source.)"));
+ }
+ }
+
// We have pch state in the following situation:
// 1. We have SKIP_PRECOMPILE_HEADERS == true
// 2. We are creating the pre-compiled header
@@ -2733,13 +2774,16 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
// if we have flags or defines for this config then
// use them
if (!flags.empty() || !options.empty() || !configDefines.empty() ||
- !includes.empty() || compileAs || noWinRT || !options.empty() ||
- needsPCHFlags) {
+ !includes.empty() || compileAsPerConfig || noWinRT ||
+ !options.empty() || needsPCHFlags) {
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmIDEFlagTable const* flagtable = nullptr;
const std::string& srclang = source->GetLanguage();
if (srclang == "C" || srclang == "CXX") {
flagtable = gg->GetClFlagTable();
+ } else if (srclang == "ASM_MARMASM" &&
+ this->GlobalGenerator->IsMarmasmEnabled()) {
+ flagtable = gg->GetMarmasmFlagTable();
} else if (srclang == "ASM_MASM" &&
this->GlobalGenerator->IsMasmEnabled()) {
flagtable = gg->GetMasmFlagTable();
@@ -2756,8 +2800,13 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
cmVS10GeneratorOptions clOptions(
this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler,
flagtable, this);
- if (compileAs) {
- clOptions.AddFlag("CompileAs", compileAs);
+ if (compileAsPerConfig) {
+ clOptions.AddFlag("CompileAs", compileAsPerConfig);
+ }
+ if (shouldScanForModules) {
+ clOptions.AddFlag("ScanSourceforModuleDependencies", "true");
+ } else {
+ clOptions.AddFlag("ScanSourceforModuleDependencies", "false");
}
if (noWinRT) {
clOptions.AddFlag("CompileAsWinRT", "false");
@@ -2842,10 +2891,9 @@ void cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
if (this->IsXamlSource(source->GetFullPath())) {
const std::string& fileName = source->GetFullPath();
e2.Element("DependentUpon",
- fileName.substr(0, fileName.find_last_of(".")));
+ fileName.substr(0, fileName.find_last_of('.')));
}
if (this->ProjectType == VsProjectType::csproj) {
- std::string f = source->GetFullPath();
using CsPropMap = std::map<std::string, std::string>;
CsPropMap sourceFileTags;
this->GetCSharpSourceProperties(&sf, sourceFileTags);
@@ -2886,7 +2934,7 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions(
if (ttype >= cmStateEnums::UTILITY) {
e1.WritePlatformConfigTag(
- "IntDir", cond, "$(Platform)\\$(Configuration)\\$(ProjectName)\\");
+ "IntDir", cond, R"($(Platform)\$(Configuration)\$(ProjectName)\)");
} else {
std::string intermediateDir = cmStrCat(
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget), '/',
@@ -3053,12 +3101,9 @@ std::vector<std::string> cmVisualStudio10TargetGenerator::GetIncludes(
bool cmVisualStudio10TargetGenerator::ComputeClOptions()
{
- for (std::string const& c : this->Configurations) {
- if (!this->ComputeClOptions(c)) {
- return false;
- }
- }
- return true;
+ return std::all_of(
+ this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) { return this->ComputeClOptions(c); });
}
bool cmVisualStudio10TargetGenerator::ComputeClOptions(
@@ -3274,6 +3319,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
this->GeneratorTarget->GetLanguages(languages, configName);
if (languages.count("C")) {
std::string flagsC;
+ this->LocalGenerator->AddLanguageFlags(
+ flagsC, this->GeneratorTarget, cmBuildStep::Compile, "C", configName);
this->LocalGenerator->AddCompileOptions(flagsC, this->GeneratorTarget,
"C", configName);
Options optC(this->LocalGenerator, Options::Compiler,
@@ -3316,9 +3363,12 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
}
}
- if (this->ProjectType != VsProjectType::csproj && clOptions.IsManaged()) {
+ if (this->ProjectType != VsProjectType::csproj &&
+ (clOptions.IsManaged() || clOptions.HasFlag("CLRSupport"))) {
this->Managed = true;
- std::string managedType = clOptions.GetFlag("CompileAsManaged");
+ std::string managedType = clOptions.HasFlag("CompileAsManaged")
+ ? clOptions.GetFlag("CompileAsManaged")
+ : "Mixed";
if (managedType == "Safe" || managedType == "Pure") {
// force empty calling convention if safe clr is used
clOptions.AddFlag("CallingConvention", "");
@@ -3411,7 +3461,7 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
// add AdditionalUsingDirectories
if (this->AdditionalUsingDirectories.count(configName) > 0) {
std::string dirs;
- for (auto u : this->AdditionalUsingDirectories[configName]) {
+ for (auto const& u : this->AdditionalUsingDirectories[configName]) {
if (!dirs.empty()) {
dirs.append(";");
}
@@ -3424,12 +3474,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
{
- for (std::string const& c : this->Configurations) {
- if (!this->ComputeRcOptions(c)) {
- return false;
- }
- }
- return true;
+ return std::all_of(
+ this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) { return this->ComputeRcOptions(c); });
}
bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
@@ -3478,13 +3525,12 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions()
if (!this->GlobalGenerator->IsCudaEnabled()) {
return true;
}
- for (std::string const& c : this->Configurations) {
- if (this->GeneratorTarget->IsLanguageUsed("CUDA", c) &&
- !this->ComputeCudaOptions(c)) {
- return false;
- }
- }
- return true;
+ return std::all_of(this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) {
+ return !this->GeneratorTarget->IsLanguageUsed("CUDA",
+ c) ||
+ this->ComputeCudaOptions(c);
+ });
}
bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
@@ -3570,7 +3616,7 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaOptions(
// limitation by creating the directory and passing the flag ourselves.
pdb = this->ConvertPath(pdb, true);
ConvertToWindowsSlash(pdb);
- std::string const clFd = "-Xcompiler=\"-Fd\\\"" + pdb + "\\\"\"";
+ std::string const clFd = R"(-Xcompiler="-Fd\")" + pdb + R"(\"")";
cudaOptions.AppendFlagString("AdditionalOptions", clFd);
}
}
@@ -3654,12 +3700,9 @@ bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions()
if (!this->GlobalGenerator->IsCudaEnabled()) {
return true;
}
- for (std::string const& c : this->Configurations) {
- if (!this->ComputeCudaLinkOptions(c)) {
- return false;
- }
- }
- return true;
+ return std::all_of(
+ this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) { return this->ComputeCudaLinkOptions(c); });
}
bool cmVisualStudio10TargetGenerator::ComputeCudaLinkOptions(
@@ -3748,17 +3791,64 @@ void cmVisualStudio10TargetGenerator::WriteCudaLinkOptions(
cudaLinkOptions.OutputFlagMap();
}
+bool cmVisualStudio10TargetGenerator::ComputeMarmasmOptions()
+{
+ if (!this->GlobalGenerator->IsMarmasmEnabled()) {
+ return true;
+ }
+ return std::all_of(
+ this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) { return this->ComputeMarmasmOptions(c); });
+}
+
+bool cmVisualStudio10TargetGenerator::ComputeMarmasmOptions(
+ std::string const& configName)
+{
+ cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
+ auto pOptions = cm::make_unique<Options>(
+ this->LocalGenerator, Options::MarmasmCompiler, gg->GetMarmasmFlagTable());
+ Options& marmasmOptions = *pOptions;
+
+ std::string flags;
+ this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget,
+ cmBuildStep::Compile, "ASM_MARMASM",
+ configName);
+
+ marmasmOptions.Parse(flags);
+
+ // Get includes for this target
+ marmasmOptions.AddIncludes(this->GetIncludes(configName, "ASM_MARMASM"));
+
+ this->MarmasmOptions[configName] = std::move(pOptions);
+ return true;
+}
+
+void cmVisualStudio10TargetGenerator::WriteMarmasmOptions(
+ Elem& e1, std::string const& configName)
+{
+ if (!this->MSTools || !this->GlobalGenerator->IsMarmasmEnabled()) {
+ return;
+ }
+ Elem e2(e1, "MARMASM");
+
+ // Preprocessor definitions and includes are shared with clOptions.
+ OptionsHelper clOptions(*(this->ClOptions[configName]), e2);
+ clOptions.OutputPreprocessorDefinitions("ASM_MARMASM");
+
+ OptionsHelper marmasmOptions(*(this->MarmasmOptions[configName]), e2);
+ marmasmOptions.OutputAdditionalIncludeDirectories("ASM_MARMASM");
+ marmasmOptions.PrependInheritedString("AdditionalOptions");
+ marmasmOptions.OutputFlagMap();
+}
+
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
{
if (!this->GlobalGenerator->IsMasmEnabled()) {
return true;
}
- for (std::string const& c : this->Configurations) {
- if (!this->ComputeMasmOptions(c)) {
- return false;
- }
- }
- return true;
+ return std::all_of(
+ this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) { return this->ComputeMasmOptions(c); });
}
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
@@ -3810,12 +3900,9 @@ bool cmVisualStudio10TargetGenerator::ComputeNasmOptions()
if (!this->GlobalGenerator->IsNasmEnabled()) {
return true;
}
- for (std::string const& c : this->Configurations) {
- if (!this->ComputeNasmOptions(c)) {
- return false;
- }
- }
- return true;
+ return std::all_of(
+ this->Configurations.begin(), this->Configurations.end(),
+ [this](std::string const& c) { return this->ComputeNasmOptions(c); });
}
bool cmVisualStudio10TargetGenerator::ComputeNasmOptions(
@@ -4452,6 +4539,7 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups(Elem& e0)
// output rc compile flags <ResourceCompile></ResourceCompile>
this->WriteRCOptions(e1, c);
this->WriteCudaOptions(e1, c);
+ this->WriteMarmasmOptions(e1, c);
this->WriteMasmOptions(e1, c);
this->WriteNasmOptions(e1, c);
}