Attached Files | vs_asm.diff [^] (15,413 bytes) 2010-02-23 13:04 [Show Content] [Hide Content]diff -ur cmake-2.8.0.orig/Source/cmCustomCommand.h cmake-2.8.0.vs_asm/Source/cmCustomCommand.h
--- cmake-2.8.0.orig/Source/cmCustomCommand.h 2009-11-13 10:32:54.000000000 -0800
+++ cmake-2.8.0.vs_asm/Source/cmCustomCommand.h 2010-02-19 08:53:16.000000000 -0800
@@ -81,4 +81,7 @@
ImplicitDependsList ImplicitDepends;
};
+
+typedef std::map<std::string, const cmCustomCommand *> cmMultiConfigCustomCommand;
+
#endif
diff -ur cmake-2.8.0.orig/Source/cmLocalVisualStudio7Generator.cxx cmake-2.8.0.vs_asm/Source/cmLocalVisualStudio7Generator.cxx
--- cmake-2.8.0.orig/Source/cmLocalVisualStudio7Generator.cxx 2009-11-13 10:32:57.000000000 -0800
+++ cmake-2.8.0.vs_asm/Source/cmLocalVisualStudio7Generator.cxx 2010-02-19 16:24:22.000000000 -0800
@@ -69,6 +69,7 @@
lang.insert("Fortran");
this->CreateCustomTargetsAndCommands(lang);
this->FixGlobalTargets();
+ this->FixObjectCommands(lang);
}
void cmLocalVisualStudio7Generator::Generate()
@@ -113,6 +114,142 @@
}
}
+void cmLocalVisualStudio7Generator::FixObjectCommands(std::set<cmStdString> const& lang)
+{
+ cmTargets &tgts = this->Makefile->GetTargets();
+ for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+ {
+ cmTarget& target = l->second;
+ switch(target.GetType())
+ {
+ case cmTarget::STATIC_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ case cmTarget::EXECUTABLE:
+ {
+ const std::vector<cmSourceFile *> &sourceFiles = target.GetSourceFiles();
+ for(std::vector<cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); sf++)
+ {
+ // If we already have a custom command, don't add a generalized one.
+ if((*sf)->GetCustomCommand() != 0)
+ continue;
+
+ // Check to see if the language of this file is already handled by the generator.
+ const char *sflang = (*sf)->GetLanguage();
+ if(sflang == 0)
+ continue;
+ bool found_sflang = false;
+ for(std::set<cmStdString>::const_iterator li = lang.begin(); li != lang.end(); li++)
+ {
+ if((*li) == sflang)
+ {
+ found_sflang = true;
+ break;
+ }
+ }
+
+ // Since it is not handled, we need to add a custom command based on the CMAKE_${sflang}_COMPILE_OBJECT variable
+ if(!found_sflang)
+ {
+ cmMultiConfigCustomCommand *commands = new cmMultiConfigCustomCommand();
+ std::vector<std::string> *configs = static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator)->GetConfigurations();
+ for(std::vector<std::string>::iterator config = configs->begin(); config != configs->end(); ++config)
+ {
+ // Determine the object file
+ std::string outfile = this->Makefile->GetStartOutputDirectory();
+ outfile += "/";
+ outfile += this->GetTargetDirectory(target);
+ outfile += "/";
+ outfile += *config;
+ outfile += "/";
+ std::string outfilebase = (*sf)->GetLocation().GetName();
+ std::string::size_type outext = outfilebase.find_last_of('.');
+ if (std::string::npos != outext)
+ outfilebase.erase(outext);
+ outfilebase += ".obj";
+ outfile += outfilebase;
+ std::vector<std::string> outfiles;
+ outfiles.push_back(outfile);
+
+ // Determine the commandline
+ cmCustomCommandLines lines;
+ cmCustomCommandLine line;
+ // Fetch the command line from the variable CMAKE_${sflang}_COMPILE_OBJECT
+ std::string cmake_compile_var = "CMAKE_";
+ cmake_compile_var += sflang;
+ cmake_compile_var += "_COMPILE_OBJECT";
+ std::string cmake_compile_line = this->Makefile->GetRequiredDefinition(cmake_compile_var.c_str());
+ // Now substitute variables of interest
+ RuleVariables vars;
+ vars.RuleLauncher = cmake_compile_var.c_str();
+ vars.CMTarget = ⌖
+ // Object file (<OBJECT>)
+ vars.Object = outfile.c_str();
+ // Source file (<SOURCE>)
+ vars.Source = (*sf)->GetFullPath().c_str();
+ // Flags (<FLAGS>)
+ std::string cmake_flags_var = "CMAKE_";
+ cmake_flags_var += sflang;
+ cmake_flags_var += "_FLAGS";
+ std::string cmake_flags;
+ // global language flags (CMAKE_${sflang}_FLAGS)
+ if(this->Makefile->IsDefinitionSet(cmake_flags_var.c_str()))
+ {
+ cmake_flags += this->Makefile->GetDefinition(cmake_flags_var.c_str());
+ cmake_flags += " ";
+ }
+ // config specific language flags (CMAKE_${sflang}_FLAGS)
+ cmake_flags_var += "_";
+ cmake_flags_var += cmSystemTools::UpperCase(*config);
+ if(this->Makefile->IsDefinitionSet(cmake_flags_var.c_str()))
+ {
+ cmake_flags += this->Makefile->GetDefinition(cmake_flags_var.c_str());
+ cmake_flags += " ";
+ }
+ // source file specific flags (COMPILE_FLAGS)
+ if(const char *cflags = (*sf)->GetProperty("COMPILE_FLAGS"))
+ {
+ cmake_flags += cflags;
+ cmake_flags += " ";
+ }
+ vars.Flags = cmake_flags.c_str();
+ this->ExpandRuleVariables(cmake_compile_line, vars);
+ // Now split up the command for insertion into the cmCustomCommandLine object
+ std::stringstream ss(cmake_compile_line);
+ std::string item;
+ while(std::getline(ss, item, ' '))
+ {
+ line.push_back(item);
+ }
+ lines.push_back(line);
+
+ // Set the comment
+ std::string comment = "Building ";
+ comment += sflang;
+ comment += " object ";
+ comment += outfilebase;
+ comment += "...";
+
+ // Set the working directory
+ std::string workingdir;
+
+ // Build the command object and store it in the multiconfig map
+ cmCustomCommand *cmd = new cmCustomCommand(outfiles, (*sf)->GetDepends(), lines, comment.c_str(), workingdir.c_str());
+ (*commands)[*config] = cmd;
+ }
+
+ // Store the completed multiconfig map in the source file
+ (*sf)->SetMultiConfigCustomCommand(commands);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
// TODO
// for CommandLine= need to repleace quotes with "
// write out configurations
@@ -1413,7 +1550,11 @@
// Tell MS-Dev what the source is. If the compiler knows how to
// build it, then it will.
fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
- if(cmCustomCommand const* command = (*sf)->GetCustomCommand())
+ if(cmMultiConfigCustomCommand const* commands = (*sf)->GetMultiConfigCustomCommand())
+ {
+ this->WriteMultiConfigCustomRule(fout, source.c_str(), *commands, fcinfo);
+ }
+ else if(cmCustomCommand const* command = (*sf)->GetCustomCommand())
{
this->WriteCustomRule(fout, source.c_str(), *command, fcinfo);
}
@@ -1514,8 +1655,25 @@
const cmCustomCommand& command,
FCInfo& fcinfo)
{
- std::string comment = this->ConstructComment(command);
-
+ // Build a multiconfig map from the command and call the multiconfig version
+ std::vector<std::string>::iterator i;
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ cmMultiConfigCustomCommand commands;
+ for(i = configs->begin(); i != configs->end(); ++i)
+ {
+ commands[*i] = &command;
+ }
+ this->WriteMultiConfigCustomRule(fout, source, commands, fcinfo);
+}
+
+void cmLocalVisualStudio7Generator::
+WriteMultiConfigCustomRule(std::ostream& fout,
+ const char* source,
+ const cmMultiConfigCustomCommand& commands,
+ FCInfo& fcinfo)
+{
// Write the rule for each configuration.
std::vector<std::string>::iterator i;
std::vector<std::string> *configs =
@@ -1533,6 +1691,8 @@
}
for(i = configs->begin(); i != configs->end(); ++i)
{
+ const cmCustomCommand *command = commands.find(*i)->second;
+ std::string comment = this->ConstructComment(*command);
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i];
fout << "\t\t\t\t<FileConfiguration\n";
fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n";
@@ -1545,11 +1705,11 @@
}
std::string script =
- this->ConstructScript(command.GetCommandLines(),
- command.GetWorkingDirectory(),
+ this->ConstructScript(command->GetCommandLines(),
+ command->GetWorkingDirectory(),
i->c_str(),
- command.GetEscapeOldStyle(),
- command.GetEscapeAllowMakeVars());
+ command->GetEscapeOldStyle(),
+ command->GetEscapeAllowMakeVars());
fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"" << customTool << "\"\n"
<< "\t\t\t\t\tDescription=\""
@@ -1557,7 +1717,7 @@
<< "\t\t\t\t\tCommandLine=\""
<< this->EscapeForXML(script.c_str()) << "\"\n"
<< "\t\t\t\t\tAdditionalDependencies=\"";
- if(command.GetDepends().empty())
+ if(command->GetDepends().empty())
{
// There are no real dependencies. Produce an artificial one to
// make sure the rule runs reliably.
@@ -1572,8 +1732,8 @@
{
// Write out the dependencies for the rule.
for(std::vector<std::string>::const_iterator d =
- command.GetDepends().begin();
- d != command.GetDepends().end();
+ command->GetDepends().begin();
+ d != command->GetDepends().end();
++d)
{
// Get the real name of the dependency in case it is a CMake target.
@@ -1584,7 +1744,7 @@
}
fout << "\"\n";
fout << "\t\t\t\t\tOutputs=\"";
- if(command.GetOutputs().empty())
+ if(command->GetOutputs().empty())
{
fout << source << "_force";
}
@@ -1593,8 +1753,8 @@
// Write a rule for the output generated by this command.
const char* sep = "";
for(std::vector<std::string>::const_iterator o =
- command.GetOutputs().begin();
- o != command.GetOutputs().end();
+ command->GetOutputs().begin();
+ o != command->GetOutputs().end();
++o)
{
fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str());
diff -ur cmake-2.8.0.orig/Source/cmLocalVisualStudio7Generator.h cmake-2.8.0.vs_asm/Source/cmLocalVisualStudio7Generator.h
--- cmake-2.8.0.orig/Source/cmLocalVisualStudio7Generator.h 2009-11-13 10:32:57.000000000 -0800
+++ cmake-2.8.0.vs_asm/Source/cmLocalVisualStudio7Generator.h 2010-02-19 16:09:07.000000000 -0800
@@ -20,6 +20,7 @@
class cmCustomCommand;
class cmSourceGroup;
+typedef std::map<std::string, const cmCustomCommand *> cmMultiConfigCustomCommand;
class cmLocalVisualStudio7GeneratorOptions;
class cmLocalVisualStudio7GeneratorFCInfo;
@@ -81,6 +82,7 @@
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
void FixGlobalTargets();
+ void FixObjectCommands(std::set<cmStdString> const& lang);
void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
@@ -115,6 +117,10 @@
const char* source,
const cmCustomCommand& command,
FCInfo& fcinfo);
+ void WriteMultiConfigCustomRule(std::ostream& fout,
+ const char* source,
+ const cmMultiConfigCustomCommand& commands,
+ FCInfo& fcinfo);
void WriteTargetVersionAttribute(std::ostream& fout, cmTarget& target);
void WriteGroup(const cmSourceGroup *sg,
diff -ur cmake-2.8.0.orig/Source/cmSourceFile.cxx cmake-2.8.0.vs_asm/Source/cmSourceFile.cxx
--- cmake-2.8.0.orig/Source/cmSourceFile.cxx 2009-11-13 10:32:58.000000000 -0800
+++ cmake-2.8.0.vs_asm/Source/cmSourceFile.cxx 2010-02-19 16:08:49.000000000 -0800
@@ -22,6 +22,7 @@
Location(mf, name)
{
this->CustomCommand = 0;
+ this->MultiConfigCustomCommand = 0;
this->Properties.SetCMakeInstance(mf->GetCMakeInstance());
this->FindFullPathFailed = false;
}
@@ -30,6 +31,7 @@
cmSourceFile::~cmSourceFile()
{
this->SetCustomCommand(0);
+ this->SetMultiConfigCustomCommand(0);
}
//----------------------------------------------------------------------------
@@ -369,6 +371,34 @@
}
//----------------------------------------------------------------------------
+cmMultiConfigCustomCommand* cmSourceFile::GetMultiConfigCustomCommand()
+{
+ return this->MultiConfigCustomCommand;
+}
+
+//----------------------------------------------------------------------------
+cmMultiConfigCustomCommand const* cmSourceFile::GetMultiConfigCustomCommand() const
+{
+ return this->MultiConfigCustomCommand;
+}
+
+//----------------------------------------------------------------------------
+void cmSourceFile::SetMultiConfigCustomCommand(cmMultiConfigCustomCommand *ccs)
+{
+ cmMultiConfigCustomCommand* old = this->MultiConfigCustomCommand;
+ this->MultiConfigCustomCommand = ccs;
+ if(old != 0)
+ {
+ for(cmMultiConfigCustomCommand::iterator i = old->begin(); i != old->end(); i++)
+ {
+ delete i->second;
+ }
+ delete old;
+ }
+}
+
+
+//----------------------------------------------------------------------------
void cmSourceFile::DefineProperties(cmake *cm)
{
// define properties
diff -ur cmake-2.8.0.orig/Source/cmSourceFile.h cmake-2.8.0.vs_asm/Source/cmSourceFile.h
--- cmake-2.8.0.orig/Source/cmSourceFile.h 2009-11-13 10:32:58.000000000 -0800
+++ cmake-2.8.0.vs_asm/Source/cmSourceFile.h 2010-02-19 15:47:25.000000000 -0800
@@ -41,6 +41,9 @@
cmCustomCommand* GetCustomCommand();
cmCustomCommand const* GetCustomCommand() const;
void SetCustomCommand(cmCustomCommand *cc);
+ cmMultiConfigCustomCommand* GetMultiConfigCustomCommand();
+ cmMultiConfigCustomCommand const* GetMultiConfigCustomCommand() const;
+ void SetMultiConfigCustomCommand(cmMultiConfigCustomCommand *ccs);
///! Set/Get a property of this source file
void SetProperty(const char *prop, const char *value);
@@ -103,6 +106,7 @@
cmSourceFileLocation Location;
cmPropertyMap Properties;
cmCustomCommand* CustomCommand;
+ cmMultiConfigCustomCommand *MultiConfigCustomCommand;
std::string Extension;
std::string Language;
std::string FullPath;
custom-build.zip [^] (965 bytes) 2010-03-14 08:00
cmLocalGenerator.diff [^] (1,624 bytes) 2010-04-13 07:35 [Show Content] [Hide Content]--- C:\tmp\cmake-2.8.0-rc4-orig\cmake-2.8.0-rc4\Source\cmLocalGenerator.cxx 2009-10-28 11:38:30.000000000 +0200
+++ C:\tmp\cmake-2.8.0-rc4-patch\cmake-2.8.0-rc4\Source\cmLocalGenerator.cxx 2009-11-02 18:11:56.666162100 +0200
@@ -779,16 +779,46 @@
return;
}
// if the language is not in the set lang then create custom
// commands to build the target
if(lang.count(llang) == 0)
{
this->AddBuildTargetRule(llang, target);
}
+ else
+ {
+ // Add all the sources outputs to the depends of the target
+ std::vector<cmSourceFile*> const& classes = target.GetSourceFiles();
+ for(std::vector<cmSourceFile*>::const_iterator i = classes.begin();
+ i != classes.end(); ++i)
+ {
+ cmSourceFile* sf = *i;
+ const char* lang = sf->GetLanguage();
+ if(lang &&
+ strncmp(lang,"ASM",3)==0 &&
+ !sf->GetCustomCommand() &&
+ !sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
+ !sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
+ {
+ std::string dir_max;
+ dir_max += this->Makefile->GetCurrentOutputDirectory();
+ dir_max += "/";
+ std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
+ if(!obj.empty())
+ {
+ std::string ofname = this->Makefile->GetCurrentOutputDirectory();
+ ofname += "/";
+ ofname += obj;
+ this->AddCustomCommandToCreateObject(ofname.c_str(),
+ sf->GetLanguage(), *(*i), target);
+ }
+ }
+ }
+ }
}
break;
default:
break;
}
}
}
0001-generator-expression.patch [^] (3,386 bytes) 2012-08-20 13:09 [Show Content] [Hide Content]From 2c7668fa63be0a551ff452a06e8b1b2b4349684c Mon Sep 17 00:00:00 2001
From: Brian Bassett <bbassett@tibco.com>
Date: Fri, 27 Apr 2012 14:24:10 -0700
Subject: [PATCH 1/2] Add new generator expression for getting the
configuration specific version of a variable (i.e.,
$<CONFIG_SPECIFIC:CMAKE_ASM_MASM_FLAGS> ==
$(CMAKE_ASM_MASM_FLAGS_DEBUG).)
---
Source/cmCustomCommandGenerator.cxx | 6 +++++-
Source/cmGeneratorExpression.cxx | 27 +++++++++++++++++++++++++++
Source/cmGeneratorExpression.h | 2 ++
3 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index a650129..ed6ebe5 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -60,7 +60,11 @@ cmCustomCommandGenerator
{
std::string arg = this->GE->Process(commandLine[j]);
cmd += " ";
- if(this->OldStyle)
+ if(commandLine[j].find("$<CONFIG_SPECIFIC:") != std::string::npos)
+ {
+ cmd += arg.c_str();
+ }
+ else if(this->OldStyle)
{
cmd += this->LG->EscapeForShellOldStyle(arg.c_str());
}
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index f88ab0b..59ecac6 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -25,6 +25,9 @@ cmGeneratorExpression::cmGeneratorExpression(
"_FILE(|_NAME|_DIR):" // Filename component.
"([A-Za-z0-9_.-]+)" // Target name.
">$");
+ this->ConfigSpecific.compile("^\\$<CONFIG_SPECIFIC:"
+ "([A-Za-z_0-9/.+-]+)" // CMake variable
+ ">$");
}
//----------------------------------------------------------------------------
@@ -112,6 +115,13 @@ bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result)
return false;
}
}
+ else if(this->ConfigSpecific.find(expr))
+ {
+ if(!this->EvaluateConfigSpecific(result))
+ {
+ return false;
+ }
+ }
else if(strcmp(expr, "$<CONFIGURATION>") == 0)
{
result = this->Config? this->Config : "";
@@ -191,3 +201,20 @@ bool cmGeneratorExpression::EvaluateTargetInfo(std::string& result)
}
return true;
}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorExpression::EvaluateConfigSpecific(std::string& result)
+{
+ if(this->Config)
+ {
+ std::string var = this->ConfigSpecific.match(1);
+ var += "_";
+ var += cmsys::SystemTools::UpperCase(this->Config);
+ result = this->Makefile->GetRequiredDefinition(var.c_str());
+ }
+ else
+ {
+ result = "";
+ }
+ return true;
+}
\ No newline at end of file
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 1a9d4c6..ca00ebc 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -51,8 +51,10 @@ private:
std::vector<char> Data;
std::stack<size_t> Barriers;
cmsys::RegularExpression TargetInfo;
+ cmsys::RegularExpression ConfigSpecific;
std::set<cmTarget*> Targets;
bool Evaluate();
bool Evaluate(const char* expr, std::string& result);
bool EvaluateTargetInfo(std::string& result);
+ bool EvaluateConfigSpecific(std::string& result);
};
--
1.7.6.msysgit.0
0002-visual-studio-assembly-files.patch [^] (8,112 bytes) 2012-08-20 13:09 [Show Content] [Hide Content]From bb07bb62dfa28effc6a21a9014993664d3f726a5 Mon Sep 17 00:00:00 2001
From: Brian Bassett <bbassett@tibco.com>
Date: Fri, 27 Apr 2012 15:09:14 -0700
Subject: [PATCH 2/2] Correctly generate custom tool build entries for
assembly files in Visual Studio projects (Bug #8170).
---
Source/cmLocalVisualStudio7Generator.cxx | 130 +++++++++++++++++++++++++++-
Source/cmLocalVisualStudio7Generator.h | 1 +
Source/cmVisualStudio10TargetGenerator.cxx | 1 +
3 files changed, 131 insertions(+), 1 deletions(-)
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 9faf46d..d062a6c 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -92,6 +92,7 @@ void cmLocalVisualStudio7Generator::AddHelperCommands()
this->FixGlobalTargets();
+ this->FixObjectCommands(lang);
}
void cmLocalVisualStudio7Generator::Generate()
@@ -158,6 +159,131 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
}
}
+void cmLocalVisualStudio7Generator::FixObjectCommands(std::set<cmStdString> const& lang)
+{
+ cmTargets &tgts = this->Makefile->GetTargets();
+ for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++)
+ {
+ cmTarget& target = l->second;
+ switch(target.GetType())
+ {
+ case cmTarget::STATIC_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ case cmTarget::EXECUTABLE:
+ {
+ const std::vector<cmSourceFile *> &sourceFiles = target.GetSourceFiles();
+ for(std::vector<cmSourceFile *>::const_iterator sf = sourceFiles.begin(); sf != sourceFiles.end(); sf++)
+ {
+ // If we already have a custom command, don't add a generalized one.
+ if((*sf)->GetCustomCommand() != 0)
+ continue;
+
+ // Check to see if the language of this file is already handled by the generator.
+ const char *sflang = (*sf)->GetLanguage();
+ if(sflang == 0)
+ continue;
+ bool found_sflang = false;
+ for(std::set<cmStdString>::const_iterator li = lang.begin(); li != lang.end(); li++)
+ {
+ if((*li) == sflang)
+ {
+ found_sflang = true;
+ break;
+ }
+ }
+
+ // Since it is not handled, we need to add a custom command based on the CMAKE_${sflang}_COMPILE_OBJECT variable
+ if(!found_sflang)
+ {
+ // Determine the object file
+ std::string outfile = this->Makefile->GetStartOutputDirectory();
+ outfile += "/";
+ outfile += this->GetTargetDirectory(target);
+ outfile += "/$<CONFIGURATION>/";
+ std::string outfilebase = (*sf)->GetLocation().GetName();
+ std::string::size_type outext = outfilebase.find_last_of('.');
+ if (std::string::npos != outext)
+ outfilebase.erase(outext);
+ std::string cmake_objext_var = "CMAKE_";
+ cmake_objext_var += sflang;
+ cmake_objext_var += "_OUTPUT_EXTENSION";
+ outfilebase += this->Makefile->GetRequiredDefinition(cmake_objext_var.c_str());
+ outfile += outfilebase;
+ std::vector<std::string> outfiles;
+ outfiles.push_back(outfile);
+
+ // Determine the commandline
+ cmCustomCommandLines lines;
+ cmCustomCommandLine line;
+ // Fetch the command line from the variable CMAKE_${sflang}_COMPILE_OBJECT
+ std::string cmake_compile_var = "CMAKE_";
+ cmake_compile_var += sflang;
+ cmake_compile_var += "_COMPILE_OBJECT";
+ std::string cmake_compile_line = this->Makefile->GetRequiredDefinition(cmake_compile_var.c_str());
+ // Now substitute variables of interest
+ RuleVariables vars;
+ vars.RuleLauncher = cmake_compile_var.c_str();
+ vars.CMTarget = ⌖
+ // Object file (<OBJECT>)
+ if (outfile.find(" ") != std::string::npos)
+ outfile = "\"" + outfile + "\"";
+ vars.Object = outfile.c_str();
+ // Source file (<SOURCE>)
+ std::string sfpath = (*sf)->GetFullPath();
+ if (sfpath.find(" ") != std::string::npos)
+ sfpath = "\"" + sfpath + "\"";
+ vars.Source = sfpath.c_str();
+ // Flags (<FLAGS>)
+ std::string cmake_flags_var = "CMAKE_";
+ cmake_flags_var += sflang;
+ cmake_flags_var += "_FLAGS";
+ std::string cmake_flags;
+ // global language flags (CMAKE_${sflang}_FLAGS)
+ if(this->Makefile->IsDefinitionSet(cmake_flags_var.c_str()))
+ {
+ cmake_flags += this->Makefile->GetRequiredDefinition(cmake_flags_var.c_str());
+ cmake_flags += " ";
+ }
+ // config specific language flags (CMAKE_${sflang}_FLAGS_${config})
+ cmake_flags += "$<CONFIG_SPECIFIC:";
+ cmake_flags += cmake_flags_var;
+ cmake_flags += "> ";
+ // source file specific flags (COMPILE_FLAGS)
+ if(const char *cflags = (*sf)->GetProperty("COMPILE_FLAGS"))
+ {
+ cmake_flags += cflags;
+ cmake_flags += " ";
+ }
+ vars.Flags = cmake_flags.c_str();
+ this->ExpandRuleVariables(cmake_compile_line, vars);
+ // Now split up the command for insertion into the cmCustomCommandLine object
+ cmSystemTools::ParseWindowsCommandLine(cmake_compile_line.c_str(), line);
+ lines.push_back(line);
+
+ // Set the comment
+ std::string comment = "Building ";
+ comment += sflang;
+ comment += " object ";
+ comment += outfilebase;
+ comment += "...";
+
+ // Set the working directory
+ std::string workingdir;
+
+ // Build the command object and store it in the source file
+ cmCustomCommand *cmd = new cmCustomCommand(this->Makefile, outfiles, (*sf)->GetDepends(), lines, comment.c_str(), workingdir.c_str());
+ (*sf)->SetCustomCommand(cmd);
+ }
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
// TODO
// for CommandLine= need to repleace quotes with "
// write out configurations
@@ -1828,7 +1954,9 @@ WriteCustomRule(std::ostream& fout,
o != command.GetOutputs().end();
++o)
{
- fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str());
+ std::string ostr = *o;
+ cmSystemTools::ReplaceString(ostr, "$<CONFIGURATION>", i->c_str());
+ fout << sep << this->ConvertToXMLOutputPathSingle(ostr.c_str());
sep = ";";
}
}
diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h
index 9aa408e..c4a07ba 100644
--- a/Source/cmLocalVisualStudio7Generator.h
+++ b/Source/cmLocalVisualStudio7Generator.h
@@ -73,6 +73,7 @@ private:
std::string GetBuildTypeLinkerFlags(std::string rootLinkerFlags,
const char* configName);
void FixGlobalTargets();
+ void FixObjectCommands(std::set<cmStdString> const& lang);
void WriteProjectFiles();
void WriteVCProjHeader(std::ostream& fout, const char *libName,
cmTarget &tgt, std::vector<cmSourceGroup> &sgs);
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6caaad1..167091a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -532,6 +532,7 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
{
std::string out = *o;
this->ConvertToWindowsSlash(out);
+ cmSystemTools::ReplaceString(out, "$<CONFIGURATION>", i->c_str());
(*this->BuildFileStream ) << sep << out;
sep = ";";
}
--
1.7.6.msysgit.0
0001-asm_file_support_vs2010_vs2012.patch [^] (2,556 bytes) 2012-10-25 17:54 [Show Content] [Hide Content]From 1751161e14f3e46ec81f2b4be5be777dfd7c6ece Mon Sep 17 00:00:00 2001
From: test <tst>
Date: Fri, 26 Oct 2012 00:52:14 +0300
Subject: [PATCH] asm_file_support_vs2010_vs2012
---
Source/cmVisualStudio10TargetGenerator.cxx | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a2ecfdf..e193907 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -270,6 +270,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n", 1);
this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1);
+ this->WriteString("<Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.props\" />\n", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
this->WriteString("<Import Project=\"" VS10_USER_PROPS "\""
@@ -288,6 +289,7 @@ void cmVisualStudio10TargetGenerator::Generate()
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
" />\n", 1);
this->WriteString("<ImportGroup Label=\"ExtensionTargets\">\n", 1);
+ this->WriteString("<Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.targets\" />\n", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("</Project>", 0);
// The groups are stored in a separate file for VS 10
@@ -848,8 +850,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
const char* lang = (*si)->GetLanguage();
bool cl = strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0;
bool rc = strcmp(lang, "RC") == 0;
- const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : "None");
- this->WriteSource(tool, *si, " ");
+ bool is_asm = strcmp(lang, "ASM_MASM") == 0;
+ const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : (is_asm? "MASM" : "None"));
+ this->WriteSource(tool, *si, " ");
// ouput any flags specific to this source file
if(cl && this->OutputSourceSpecificFlags(*si))
{
@@ -861,7 +864,12 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
{
this->WriteString("</ResourceCompile>\n", 2);
}
- else
+ else if (is_asm)
+ {
+ (*this->BuildFileStream ) << " >\n";
+ this->WriteString("<FileType>Document</FileType>\n", 3);
+ this->WriteString("</MASM>\n", 2);
+ } else
{
(*this->BuildFileStream ) << " />\n";
}
--
1.7.11
0001-new_asm_file_support_vs2010_vs2012.patch [^] (2,566 bytes) 2013-06-05 10:04 [Show Content] [Hide Content]From 93e732a7c071422f6d576b0bc2f336e575f9c8c8 Mon Sep 17 00:00:00 2001
From: test <test@localhost>
Date: Wed, 5 Jun 2013 17:00:10 +0300
Subject: [PATCH] asm_file_support_vs2010_vs2012
---
Source/cmVisualStudio10TargetGenerator.cxx | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f8de3a8..dd4c425 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -288,6 +288,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n", 1);
this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1);
+ this->WriteString("<Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.props\" />\n", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
this->WriteString("<Import Project=\"" VS10_USER_PROPS "\""
@@ -307,6 +308,7 @@ void cmVisualStudio10TargetGenerator::Generate()
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
" />\n", 1);
this->WriteString("<ImportGroup Label=\"ExtensionTargets\">\n", 1);
+ this->WriteString("<Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.targets\" />\n", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("</Project>", 0);
// The groups are stored in a separate file for VS 10
@@ -928,8 +930,9 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
const char* lang = (*si)->GetLanguage();
bool cl = strcmp(lang, "C") == 0 || strcmp(lang, "CXX") == 0;
bool rc = strcmp(lang, "RC") == 0;
- const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : "None");
- this->WriteSource(tool, *si, " ");
+ bool is_asm = (strcmp(lang, "ASM_MASM") == 0);
+ const char* tool = cl? "ClCompile" : (rc? "ResourceCompile" : (is_asm? "MASM" : "None"));
+ this->WriteSource(tool, *si, " ");
// ouput any flags specific to this source file
if(cl && this->OutputSourceSpecificFlags(*si))
{
@@ -941,7 +944,12 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
{
this->WriteString("</ResourceCompile>\n", 2);
}
- else
+ else if (is_asm)
+ {
+ (*this->BuildFileStream ) << " >\n";
+ this->WriteString("<FileType>Document</FileType>\n", 3);
+ this->WriteString("</MASM>\n", 2);
+ } else
{
(*this->BuildFileStream ) << " />\n";
}
--
1.8.1.2
|