2009-09-28 19:43:28 +04:00
|
|
|
/*============================================================================
|
|
|
|
CMake - Cross Platform Makefile Generator
|
|
|
|
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
see accompanying file Copyright.txt for details.
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2009-09-28 19:43:28 +04:00
|
|
|
This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the License for more information.
|
|
|
|
============================================================================*/
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmVisualStudio10TargetGenerator.h"
|
2009-10-22 16:24:11 +04:00
|
|
|
#include "cmGlobalVisualStudio10Generator.h"
|
2012-03-07 20:56:21 +04:00
|
|
|
#include "cmGeneratorTarget.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmTarget.h"
|
|
|
|
#include "cmComputeLinkInformation.h"
|
|
|
|
#include "cmGeneratedFileStream.h"
|
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmSourceFile.h"
|
|
|
|
#include "cmVisualStudioGeneratorOptions.h"
|
|
|
|
#include "cmLocalVisualStudio7Generator.h"
|
2014-03-10 23:47:19 +04:00
|
|
|
#include "cmCustomCommandGenerator.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmVS10CLFlagTable.h"
|
2014-07-10 03:01:18 +04:00
|
|
|
#include "cmVS10RCFlagTable.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmVS10LinkFlagTable.h"
|
2009-06-28 16:59:56 +04:00
|
|
|
#include "cmVS10LibFlagTable.h"
|
2012-08-22 18:49:47 +04:00
|
|
|
#include "cmVS11CLFlagTable.h"
|
2014-07-10 03:01:18 +04:00
|
|
|
#include "cmVS11RCFlagTable.h"
|
2012-08-22 18:49:47 +04:00
|
|
|
#include "cmVS11LinkFlagTable.h"
|
|
|
|
#include "cmVS11LibFlagTable.h"
|
2013-06-29 00:28:53 +04:00
|
|
|
#include "cmVS12CLFlagTable.h"
|
2014-07-10 03:01:18 +04:00
|
|
|
#include "cmVS12RCFlagTable.h"
|
2013-06-29 00:28:53 +04:00
|
|
|
#include "cmVS12LinkFlagTable.h"
|
|
|
|
#include "cmVS12LibFlagTable.h"
|
2014-06-24 23:29:08 +04:00
|
|
|
#include "cmVS14CLFlagTable.h"
|
2014-07-10 03:01:18 +04:00
|
|
|
#include "cmVS14RCFlagTable.h"
|
2014-06-24 23:29:08 +04:00
|
|
|
#include "cmVS14LinkFlagTable.h"
|
|
|
|
#include "cmVS14LibFlagTable.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2009-10-23 19:34:37 +04:00
|
|
|
#include <cmsys/auto_ptr.hxx>
|
|
|
|
|
2014-06-03 21:34:21 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
|
2012-08-22 18:49:47 +04:00
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
cmLocalVisualStudioGenerator::VSVersion
|
|
|
|
v = this->LocalGenerator->GetVersion();
|
|
|
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
|
|
|
{ return cmVS14CLFlagTable; }
|
|
|
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
|
|
|
{ return cmVS12CLFlagTable; }
|
|
|
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
|
|
|
{ return cmVS11CLFlagTable; }
|
|
|
|
else
|
|
|
|
{ return cmVS10CLFlagTable; }
|
|
|
|
}
|
|
|
|
return 0;
|
2012-08-22 18:49:47 +04:00
|
|
|
}
|
|
|
|
|
2014-07-10 03:01:18 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
|
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
cmLocalVisualStudioGenerator::VSVersion
|
|
|
|
v = this->LocalGenerator->GetVersion();
|
|
|
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
|
|
|
{ return cmVS14RCFlagTable; }
|
|
|
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
|
|
|
{ return cmVS12RCFlagTable; }
|
|
|
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
|
|
|
{ return cmVS11RCFlagTable; }
|
|
|
|
else
|
|
|
|
{ return cmVS10RCFlagTable; }
|
|
|
|
}
|
|
|
|
return 0;
|
2014-07-10 03:01:18 +04:00
|
|
|
}
|
|
|
|
|
2014-06-03 21:34:21 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLibFlagTable() const
|
2012-08-22 18:49:47 +04:00
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
cmLocalVisualStudioGenerator::VSVersion
|
|
|
|
v = this->LocalGenerator->GetVersion();
|
|
|
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
|
|
|
{ return cmVS14LibFlagTable; }
|
|
|
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
|
|
|
{ return cmVS12LibFlagTable; }
|
|
|
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
|
|
|
{ return cmVS11LibFlagTable; }
|
|
|
|
else
|
|
|
|
{ return cmVS10LibFlagTable; }
|
|
|
|
}
|
|
|
|
return 0;
|
2012-08-22 18:49:47 +04:00
|
|
|
}
|
|
|
|
|
2014-06-03 21:34:21 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetLinkFlagTable() const
|
2012-08-22 18:49:47 +04:00
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
cmLocalVisualStudioGenerator::VSVersion
|
|
|
|
v = this->LocalGenerator->GetVersion();
|
|
|
|
if(v >= cmLocalVisualStudioGenerator::VS14)
|
|
|
|
{ return cmVS14LinkFlagTable; }
|
|
|
|
else if(v >= cmLocalVisualStudioGenerator::VS12)
|
|
|
|
{ return cmVS12LinkFlagTable; }
|
|
|
|
else if(v == cmLocalVisualStudioGenerator::VS11)
|
|
|
|
{ return cmVS11LinkFlagTable; }
|
|
|
|
else
|
|
|
|
{ return cmVS10LinkFlagTable; }
|
|
|
|
}
|
|
|
|
return 0;
|
2012-08-22 18:49:47 +04:00
|
|
|
}
|
|
|
|
|
2009-09-07 18:11:20 +04:00
|
|
|
static std::string cmVS10EscapeXML(std::string arg)
|
|
|
|
{
|
|
|
|
cmSystemTools::ReplaceString(arg, "&", "&");
|
|
|
|
cmSystemTools::ReplaceString(arg, "<", "<");
|
|
|
|
cmSystemTools::ReplaceString(arg, ">", ">");
|
|
|
|
return arg;
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2010-10-02 00:12:00 +04:00
|
|
|
static std::string cmVS10EscapeComment(std::string comment)
|
|
|
|
{
|
|
|
|
// MSBuild takes the CDATA of a <Message></Message> element and just
|
|
|
|
// does "echo $CDATA" with no escapes. We must encode the string.
|
|
|
|
// http://technet.microsoft.com/en-us/library/cc772462%28WS.10%29.aspx
|
|
|
|
std::string echoable;
|
|
|
|
for(std::string::iterator c = comment.begin(); c != comment.end(); ++c)
|
|
|
|
{
|
|
|
|
switch (*c)
|
|
|
|
{
|
|
|
|
case '\r': break;
|
|
|
|
case '\n': echoable += '\t'; break;
|
|
|
|
case '"': /* no break */
|
|
|
|
case '|': /* no break */
|
|
|
|
case '&': /* no break */
|
|
|
|
case '<': /* no break */
|
|
|
|
case '>': /* no break */
|
|
|
|
case '^': echoable += '^'; /* no break */
|
|
|
|
default: echoable += *c; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return echoable;
|
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
cmVisualStudio10TargetGenerator::
|
|
|
|
cmVisualStudio10TargetGenerator(cmTarget* target,
|
2009-10-22 16:24:11 +04:00
|
|
|
cmGlobalVisualStudio10Generator* gg)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
this->GlobalGenerator = gg;
|
|
|
|
this->Target = target;
|
2012-03-07 20:56:21 +04:00
|
|
|
this->GeneratorTarget = gg->GetGeneratorTarget(target);
|
2009-06-26 00:41:57 +04:00
|
|
|
this->Makefile = target->GetMakefile();
|
2012-08-13 21:42:58 +04:00
|
|
|
this->LocalGenerator =
|
2009-06-26 00:41:57 +04:00
|
|
|
(cmLocalVisualStudio7Generator*)
|
|
|
|
this->Makefile->GetLocalGenerator();
|
2009-07-14 22:16:46 +04:00
|
|
|
this->Name = this->Target->GetName();
|
|
|
|
this->GlobalGenerator->CreateGUID(this->Name.c_str());
|
|
|
|
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
|
2009-10-22 16:24:11 +04:00
|
|
|
this->Platform = gg->GetPlatformName();
|
2014-06-10 18:13:00 +04:00
|
|
|
this->MSTools = true;
|
2009-07-14 00:58:24 +04:00
|
|
|
this->BuildFileStream = 0;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
|
|
|
|
{
|
2009-10-23 19:34:37 +04:00
|
|
|
for(OptionsMap::iterator i = this->ClOptions.begin();
|
|
|
|
i != this->ClOptions.end(); ++i)
|
|
|
|
{
|
|
|
|
delete i->second;
|
|
|
|
}
|
2012-10-26 18:16:45 +04:00
|
|
|
for(OptionsMap::iterator i = this->LinkOptions.begin();
|
|
|
|
i != this->LinkOptions.end(); ++i)
|
|
|
|
{
|
|
|
|
delete i->second;
|
|
|
|
}
|
2009-07-14 00:58:24 +04:00
|
|
|
if(!this->BuildFileStream)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
if (this->BuildFileStream->Close())
|
|
|
|
{
|
|
|
|
this->GlobalGenerator
|
|
|
|
->FileReplacedDuringGenerate(this->PathToVcxproj);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
delete this->BuildFileStream;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
|
|
|
|
const char* tag,
|
2014-02-10 07:48:34 +04:00
|
|
|
const std::string& config,
|
2009-06-26 00:41:57 +04:00
|
|
|
int indentLevel,
|
|
|
|
const char* attribute,
|
|
|
|
const char* end,
|
|
|
|
std::ostream* stream)
|
|
|
|
|
|
|
|
{
|
|
|
|
if(!stream)
|
|
|
|
{
|
|
|
|
stream = this->BuildFileStream;
|
|
|
|
}
|
|
|
|
stream->fill(' ');
|
2012-08-13 21:42:58 +04:00
|
|
|
stream->width(indentLevel*2 );
|
2009-06-26 00:41:57 +04:00
|
|
|
(*stream ) << "";
|
2012-08-13 21:42:58 +04:00
|
|
|
(*stream ) << "<" << tag
|
2009-06-26 19:50:09 +04:00
|
|
|
<< " Condition=\"'$(Configuration)|$(Platform)'=='";
|
2009-10-22 16:24:11 +04:00
|
|
|
(*stream ) << config << "|" << this->Platform << "'\"";
|
2009-06-26 00:41:57 +04:00
|
|
|
if(attribute)
|
|
|
|
{
|
|
|
|
(*stream ) << attribute;
|
|
|
|
}
|
|
|
|
// close the tag
|
|
|
|
(*stream ) << ">";
|
|
|
|
if(end)
|
|
|
|
{
|
|
|
|
(*stream ) << end;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteString(const char* line,
|
|
|
|
int indentLevel)
|
|
|
|
{
|
|
|
|
this->BuildFileStream->fill(' ');
|
|
|
|
this->BuildFileStream->width(indentLevel*2 );
|
|
|
|
// write an empty string to get the fill level indent to print
|
|
|
|
(*this->BuildFileStream ) << "";
|
|
|
|
(*this->BuildFileStream ) << line;
|
|
|
|
}
|
|
|
|
|
2009-10-22 18:21:35 +04:00
|
|
|
#define VS10_USER_PROPS "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"
|
2009-07-14 00:58:24 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::Generate()
|
2009-07-14 22:16:46 +04:00
|
|
|
{
|
|
|
|
// do not generate external ms projects
|
2013-11-20 15:44:04 +04:00
|
|
|
if(this->Target->GetType() == cmTarget::INTERFACE_LIBRARY
|
|
|
|
|| this->Target->GetProperty("EXTERNAL_MSPROJECT"))
|
2009-07-14 22:16:46 +04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// Tell the global generator the name of the project file
|
2009-07-14 00:58:24 +04:00
|
|
|
this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
|
2009-06-26 00:41:57 +04:00
|
|
|
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
|
|
|
|
".vcxproj");
|
2012-03-12 18:55:07 +04:00
|
|
|
if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
|
2009-10-23 19:34:37 +04:00
|
|
|
{
|
2010-09-30 16:48:38 +04:00
|
|
|
if(!this->ComputeClOptions())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2014-07-10 03:01:18 +04:00
|
|
|
if(!this->ComputeRcOptions())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2012-10-26 18:16:45 +04:00
|
|
|
if(!this->ComputeLinkOptions())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-10-23 19:34:37 +04:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
cmMakefile* mf = this->Target->GetMakefile();
|
|
|
|
std::string path = mf->GetStartOutputDirectory();
|
|
|
|
path += "/";
|
2009-07-14 00:58:24 +04:00
|
|
|
path += this->Name;
|
2009-06-26 00:41:57 +04:00
|
|
|
path += ".vcxproj";
|
|
|
|
this->BuildFileStream =
|
|
|
|
new cmGeneratedFileStream(path.c_str());
|
2009-07-10 17:12:39 +04:00
|
|
|
this->PathToVcxproj = path;
|
2009-06-26 00:41:57 +04:00
|
|
|
this->BuildFileStream->SetCopyIfDifferent(true);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
// Write the encoding header into the file
|
|
|
|
char magic[] = {0xEF,0xBB, 0xBF};
|
|
|
|
this->BuildFileStream->write(magic, 3);
|
2013-08-20 22:59:59 +04:00
|
|
|
|
|
|
|
//get the tools version to use
|
|
|
|
const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
|
2013-11-13 20:29:07 +04:00
|
|
|
std::string project_defaults=
|
2014-03-14 18:48:42 +04:00
|
|
|
"<?xml version=\"1.0\" encoding=\"" +
|
|
|
|
this->GlobalGenerator->Encoding() + "\"?>\n";
|
2013-08-20 22:59:59 +04:00
|
|
|
project_defaults.append("<Project DefaultTargets=\"Build\" ToolsVersion=\"");
|
|
|
|
project_defaults.append(toolsVer +"\" ");
|
|
|
|
project_defaults.append(
|
|
|
|
"xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
|
|
|
|
this->WriteString(project_defaults.c_str(),0);
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteProjectConfigurations();
|
|
|
|
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
|
|
|
|
this->WriteString("<ProjectGUID>", 2);
|
|
|
|
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
|
|
|
|
|
2014-07-31 21:22:35 +04:00
|
|
|
if(this->MSTools && this->Target->GetType() <= cmTarget::UTILITY)
|
|
|
|
{
|
|
|
|
this->WriteApplicationTypeSettings();
|
|
|
|
}
|
|
|
|
|
2011-11-23 23:11:00 +04:00
|
|
|
const char* vsProjectTypes =
|
|
|
|
this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES");
|
|
|
|
if(vsProjectTypes)
|
|
|
|
{
|
|
|
|
this->WriteString("<ProjectTypes>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsProjectTypes) <<
|
|
|
|
"</ProjectTypes>\n";
|
|
|
|
}
|
|
|
|
|
2011-06-14 17:45:52 +04:00
|
|
|
const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
|
|
|
|
const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
|
|
|
|
const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
|
|
|
|
|
2011-11-01 04:04:08 +04:00
|
|
|
if( vsProjectName && vsLocalPath && vsProvider )
|
2011-06-14 17:45:52 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<SccProjectName>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName) <<
|
|
|
|
"</SccProjectName>\n";
|
|
|
|
this->WriteString("<SccLocalPath>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsLocalPath) <<
|
|
|
|
"</SccLocalPath>\n";
|
|
|
|
this->WriteString("<SccProvider>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsProvider) <<
|
|
|
|
"</SccProvider>\n";
|
2011-11-01 04:04:08 +04:00
|
|
|
|
|
|
|
const char* vsAuxPath = this->Target->GetProperty("VS_SCC_AUXPATH");
|
|
|
|
if( vsAuxPath )
|
|
|
|
{
|
|
|
|
this->WriteString("<SccAuxPath>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsAuxPath) <<
|
|
|
|
"</SccAuxPath>\n";
|
|
|
|
}
|
2011-06-14 17:45:52 +04:00
|
|
|
}
|
|
|
|
|
2011-11-23 23:11:00 +04:00
|
|
|
const char* vsGlobalKeyword =
|
|
|
|
this->Target->GetProperty("VS_GLOBAL_KEYWORD");
|
|
|
|
if(!vsGlobalKeyword)
|
|
|
|
{
|
|
|
|
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->WriteString("<Keyword>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword) <<
|
|
|
|
"</Keyword>\n";
|
|
|
|
}
|
|
|
|
|
2013-05-30 04:16:36 +04:00
|
|
|
const char* vsGlobalRootNamespace =
|
|
|
|
this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE");
|
|
|
|
if(vsGlobalRootNamespace)
|
|
|
|
{
|
|
|
|
this->WriteString("<RootNamespace>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalRootNamespace) <<
|
|
|
|
"</RootNamespace>\n";
|
|
|
|
}
|
|
|
|
|
2009-10-22 16:24:11 +04:00
|
|
|
this->WriteString("<Platform>", 2);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(this->Platform)
|
|
|
|
<< "</Platform>\n";
|
2010-09-10 00:21:57 +04:00
|
|
|
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
|
|
|
|
if(!projLabel)
|
|
|
|
{
|
|
|
|
projLabel = this->Name.c_str();
|
|
|
|
}
|
|
|
|
this->WriteString("<ProjectName>", 2);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "</ProjectName>\n";
|
2013-06-14 15:28:00 +04:00
|
|
|
if(const char* targetFrameworkVersion = this->Target->GetProperty(
|
|
|
|
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
|
|
|
|
{
|
|
|
|
this->WriteString("<TargetFrameworkVersion>", 2);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion)
|
2013-06-14 15:28:00 +04:00
|
|
|
<< "</TargetFrameworkVersion>\n";
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</PropertyGroup>\n", 1);
|
|
|
|
this->WriteString("<Import Project="
|
|
|
|
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
|
|
|
|
1);
|
|
|
|
this->WriteProjectConfigurationValues();
|
|
|
|
this->WriteString(
|
|
|
|
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\n", 1);
|
|
|
|
this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1);
|
2013-08-05 18:34:10 +04:00
|
|
|
if (this->GlobalGenerator->IsMasmEnabled())
|
|
|
|
{
|
|
|
|
this->WriteString("<Import Project=\"$(VCTargetsPath)\\"
|
|
|
|
"BuildCustomizations\\masm.props\" />\n", 2);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ImportGroup>\n", 1);
|
|
|
|
this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
|
2009-10-22 18:21:35 +04:00
|
|
|
this->WriteString("<Import Project=\"" VS10_USER_PROPS "\""
|
|
|
|
" Condition=\"exists('" VS10_USER_PROPS "')\""
|
2014-07-30 22:10:49 +04:00
|
|
|
" Label=\"LocalAppDataPlatform\" />\n", 2);
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ImportGroup>\n", 1);
|
|
|
|
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
|
|
|
|
this->WritePathAndIncrementalLinkOptions();
|
|
|
|
this->WriteItemDefinitionGroups();
|
|
|
|
this->WriteCustomCommands();
|
2012-03-19 19:25:21 +04:00
|
|
|
this->WriteAllSources();
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteDotNetReferences();
|
2013-06-28 11:04:01 +04:00
|
|
|
this->WriteEmbeddedResourceGroup();
|
2012-02-03 18:07:12 +04:00
|
|
|
this->WriteWinRTReferences();
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteProjectReferences();
|
|
|
|
this->WriteString(
|
|
|
|
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
|
|
|
|
" />\n", 1);
|
|
|
|
this->WriteString("<ImportGroup Label=\"ExtensionTargets\">\n", 1);
|
2013-08-05 18:34:10 +04:00
|
|
|
if (this->GlobalGenerator->IsMasmEnabled())
|
|
|
|
{
|
|
|
|
this->WriteString("<Import Project=\"$(VCTargetsPath)\\"
|
|
|
|
"BuildCustomizations\\masm.targets\" />\n", 2);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ImportGroup>\n", 1);
|
|
|
|
this->WriteString("</Project>", 0);
|
|
|
|
// The groups are stored in a separate file for VS 10
|
|
|
|
this->WriteGroups();
|
|
|
|
}
|
|
|
|
|
2011-11-23 23:11:00 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
|
|
|
|
{
|
2012-02-03 23:32:17 +04:00
|
|
|
std::vector<std::string> references;
|
|
|
|
if(const char* vsDotNetReferences =
|
|
|
|
this->Target->GetProperty("VS_DOTNET_REFERENCES"))
|
|
|
|
{
|
|
|
|
cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
|
|
|
|
}
|
|
|
|
if(!references.empty())
|
2011-11-23 23:11:00 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2012-02-03 23:32:17 +04:00
|
|
|
for(std::vector<std::string>::iterator ri = references.begin();
|
|
|
|
ri != references.end(); ++ri)
|
2011-11-23 23:11:00 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<Reference Include=\"", 2);
|
2012-02-03 23:32:17 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("<CopyLocalSatelliteAssemblies>true"
|
|
|
|
"</CopyLocalSatelliteAssemblies>\n", 3);
|
|
|
|
this->WriteString("<ReferenceOutputAssembly>true"
|
|
|
|
"</ReferenceOutputAssembly>\n", 3);
|
|
|
|
this->WriteString("</Reference>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-28 11:04:01 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
|
|
|
|
{
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> resxObjs;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetResxSources(resxObjs, "");
|
2013-06-28 11:04:01 +04:00
|
|
|
if(!resxObjs.empty())
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2014-03-13 02:06:05 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
|
2013-06-28 11:04:01 +04:00
|
|
|
oi != resxObjs.end(); ++oi)
|
|
|
|
{
|
|
|
|
std::string obj = (*oi)->GetFullPath();
|
|
|
|
this->WriteString("<EmbeddedResource Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
|
|
|
(*this->BuildFileStream ) << obj << "\">\n";
|
|
|
|
|
|
|
|
this->WriteString("<DependentUpon>", 3);
|
|
|
|
std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
|
|
|
|
(*this->BuildFileStream ) << hFileName;
|
|
|
|
this->WriteString("</DependentUpon>\n", 3);
|
|
|
|
|
|
|
|
std::vector<std::string> const * configs =
|
|
|
|
this->GlobalGenerator->GetConfigurations();
|
|
|
|
for(std::vector<std::string>::const_iterator i = configs->begin();
|
|
|
|
i != configs->end(); ++i)
|
|
|
|
{
|
|
|
|
this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
|
|
|
|
if(this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE"))
|
|
|
|
{
|
|
|
|
(*this->BuildFileStream ) << "$(RootNamespace).";
|
|
|
|
}
|
|
|
|
(*this->BuildFileStream ) << "%(Filename)";
|
|
|
|
(*this->BuildFileStream ) << ".resources";
|
|
|
|
(*this->BuildFileStream ) << "</LogicalName>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
this->WriteString("</EmbeddedResource>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-03 18:07:12 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
|
|
|
|
{
|
2012-02-03 23:32:17 +04:00
|
|
|
std::vector<std::string> references;
|
|
|
|
if(const char* vsWinRTReferences =
|
|
|
|
this->Target->GetProperty("VS_WINRT_REFERENCES"))
|
|
|
|
{
|
|
|
|
cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
|
|
|
|
}
|
|
|
|
if(!references.empty())
|
2012-02-03 18:07:12 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2012-02-03 23:32:17 +04:00
|
|
|
for(std::vector<std::string>::iterator ri = references.begin();
|
|
|
|
ri != references.end(); ++ri)
|
2012-02-03 18:07:12 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<Reference Include=\"", 2);
|
2012-02-03 23:32:17 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
|
2012-02-03 18:07:12 +04:00
|
|
|
this->WriteString("<IsWinMDFile>true</IsWinMDFile>\n", 3);
|
|
|
|
this->WriteString("</Reference>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup Label=\"ProjectConfigurations\">\n", 1);
|
|
|
|
std::vector<std::string> *configs =
|
|
|
|
static_cast<cmGlobalVisualStudio7Generator *>
|
|
|
|
(this->GlobalGenerator)->GetConfigurations();
|
|
|
|
for(std::vector<std::string>::iterator i = configs->begin();
|
|
|
|
i != configs->end(); ++i)
|
|
|
|
{
|
|
|
|
this->WriteString("<ProjectConfiguration Include=\"", 2);
|
2009-10-22 16:24:11 +04:00
|
|
|
(*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<Configuration>", 3);
|
|
|
|
(*this->BuildFileStream ) << *i << "</Configuration>\n";
|
2009-10-22 16:24:11 +04:00
|
|
|
this->WriteString("<Platform>", 3);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(this->Platform)
|
|
|
|
<< "</Platform>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ProjectConfiguration>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
|
|
|
{
|
|
|
|
std::vector<std::string> *configs =
|
|
|
|
static_cast<cmGlobalVisualStudio7Generator *>
|
|
|
|
(this->GlobalGenerator)->GetConfigurations();
|
|
|
|
for(std::vector<std::string>::iterator i = configs->begin();
|
|
|
|
i != configs->end(); ++i)
|
|
|
|
{
|
|
|
|
this->WritePlatformConfigTag("PropertyGroup",
|
|
|
|
i->c_str(),
|
|
|
|
1, " Label=\"Configuration\"", "\n");
|
|
|
|
std::string configType = "<ConfigurationType>";
|
|
|
|
switch(this->Target->GetType())
|
|
|
|
{
|
|
|
|
case cmTarget::SHARED_LIBRARY:
|
|
|
|
case cmTarget::MODULE_LIBRARY:
|
|
|
|
configType += "DynamicLibrary";
|
|
|
|
break;
|
2012-03-12 18:55:07 +04:00
|
|
|
case cmTarget::OBJECT_LIBRARY:
|
2009-06-26 00:41:57 +04:00
|
|
|
case cmTarget::STATIC_LIBRARY:
|
|
|
|
configType += "StaticLibrary";
|
|
|
|
break;
|
|
|
|
case cmTarget::EXECUTABLE:
|
|
|
|
configType += "Application";
|
|
|
|
break;
|
|
|
|
case cmTarget::UTILITY:
|
|
|
|
configType += "Utility";
|
|
|
|
break;
|
2012-11-07 16:45:52 +04:00
|
|
|
case cmTarget::GLOBAL_TARGET:
|
|
|
|
case cmTarget::UNKNOWN_LIBRARY:
|
2012-11-02 18:47:40 +04:00
|
|
|
case cmTarget::INTERFACE_LIBRARY:
|
2012-11-07 16:45:52 +04:00
|
|
|
break;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
configType += "</ConfigurationType>\n";
|
2012-08-13 21:42:58 +04:00
|
|
|
this->WriteString(configType.c_str(), 2);
|
2011-11-04 21:29:41 +04:00
|
|
|
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
this->WriteMSToolConfigurationValues(*i);
|
|
|
|
}
|
2011-11-04 21:29:41 +04:00
|
|
|
|
2014-06-05 22:57:23 +04:00
|
|
|
this->WriteString("</PropertyGroup>\n", 1);
|
|
|
|
}
|
|
|
|
}
|
2011-11-04 21:29:41 +04:00
|
|
|
|
2014-06-05 22:57:23 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmVisualStudio10TargetGenerator
|
|
|
|
::WriteMSToolConfigurationValues(std::string const& config)
|
|
|
|
{
|
|
|
|
cmGlobalVisualStudio10Generator* gg =
|
|
|
|
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
|
|
|
|
const char* mfcFlag =
|
|
|
|
this->Target->GetMakefile()->GetDefinition("CMAKE_MFC_FLAG");
|
|
|
|
std::string mfcFlagValue = mfcFlag ? mfcFlag : "0";
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2014-06-05 22:57:23 +04:00
|
|
|
std::string useOfMfcValue = "false";
|
|
|
|
if(mfcFlagValue == "1")
|
|
|
|
{
|
|
|
|
useOfMfcValue = "Static";
|
|
|
|
}
|
|
|
|
else if(mfcFlagValue == "2")
|
|
|
|
{
|
|
|
|
useOfMfcValue = "Dynamic";
|
|
|
|
}
|
|
|
|
std::string mfcLine = "<UseOfMfc>";
|
|
|
|
mfcLine += useOfMfcValue + "</UseOfMfc>\n";
|
|
|
|
this->WriteString(mfcLine.c_str(), 2);
|
|
|
|
|
|
|
|
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
|
|
|
|
this->ClOptions[config]->UsingUnicode()) ||
|
|
|
|
this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
|
|
|
|
{
|
|
|
|
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
|
|
|
|
}
|
|
|
|
else if (this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
|
|
|
|
this->ClOptions[config]->UsingSBCS())
|
|
|
|
{
|
|
|
|
this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
|
|
|
|
}
|
|
|
|
if(const char* toolset = gg->GetPlatformToolset())
|
|
|
|
{
|
|
|
|
std::string pts = "<PlatformToolset>";
|
|
|
|
pts += toolset;
|
|
|
|
pts += "</PlatformToolset>\n";
|
|
|
|
this->WriteString(pts.c_str(), 2);
|
|
|
|
}
|
|
|
|
if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
|
|
|
|
{
|
|
|
|
this->WriteString("<WindowsAppContainer>true"
|
|
|
|
"</WindowsAppContainer>\n", 2);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteCustomCommands()
|
2009-09-07 18:12:18 +04:00
|
|
|
{
|
|
|
|
this->SourcesVisited.clear();
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> customCommands;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetCustomCommands(customCommands, "");
|
2014-03-13 02:06:05 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator
|
2013-11-10 14:22:44 +04:00
|
|
|
si = customCommands.begin();
|
|
|
|
si != customCommands.end(); ++si)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2012-03-07 20:56:21 +04:00
|
|
|
this->WriteCustomCommand(*si);
|
2009-09-07 18:12:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
2014-03-13 02:50:42 +04:00
|
|
|
void cmVisualStudio10TargetGenerator
|
|
|
|
::WriteCustomCommand(cmSourceFile const* sf)
|
2009-09-07 18:12:18 +04:00
|
|
|
{
|
|
|
|
if(this->SourcesVisited.insert(sf).second)
|
|
|
|
{
|
|
|
|
if(std::vector<cmSourceFile*> const* depends =
|
2012-10-11 02:57:11 +04:00
|
|
|
this->GeneratorTarget->GetSourceDepends(sf))
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2009-09-07 18:12:18 +04:00
|
|
|
for(std::vector<cmSourceFile*>::const_iterator di = depends->begin();
|
|
|
|
di != depends->end(); ++di)
|
|
|
|
{
|
|
|
|
this->WriteCustomCommand(*di);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2009-09-07 18:12:18 +04:00
|
|
|
if(cmCustomCommand const* command = sf->GetCustomCommand())
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
|
|
|
this->WriteCustomRule(sf, *command);
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
void
|
2014-03-13 02:50:42 +04:00
|
|
|
cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile const* source,
|
2012-08-13 21:42:58 +04:00
|
|
|
cmCustomCommand const &
|
2009-06-26 00:41:57 +04:00
|
|
|
command)
|
|
|
|
{
|
|
|
|
std::string sourcePath = source->GetFullPath();
|
2012-04-18 23:50:49 +04:00
|
|
|
// VS 10 will always rebuild a custom command attached to a .rule
|
|
|
|
// file that doesn't exist so create the file explicitly.
|
2012-04-18 22:42:43 +04:00
|
|
|
if (source->GetPropertyAsBool("__CMAKE_RULE"))
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
if(!cmSystemTools::FileExists(sourcePath.c_str()))
|
|
|
|
{
|
2011-06-07 16:59:03 +04:00
|
|
|
// Make sure the path exists for the file
|
|
|
|
std::string path = cmSystemTools::GetFilenamePath(sourcePath);
|
|
|
|
cmSystemTools::MakeDirectory(path.c_str());
|
2014-01-04 09:47:13 +04:00
|
|
|
cmsys::ofstream fout(sourcePath.c_str());
|
2009-06-26 00:41:57 +04:00
|
|
|
if(fout)
|
|
|
|
{
|
|
|
|
fout << "# generated from CMake\n";
|
|
|
|
fout.flush();
|
|
|
|
fout.close();
|
|
|
|
}
|
2011-06-07 16:59:03 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string error = "Could not create file: [";
|
|
|
|
error += sourcePath;
|
|
|
|
error += "] ";
|
|
|
|
cmSystemTools::Error
|
|
|
|
(error.c_str(), cmSystemTools::GetLastSystemError().c_str());
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
|
|
|
|
std::vector<std::string> *configs =
|
|
|
|
static_cast<cmGlobalVisualStudio7Generator *>
|
2012-08-13 21:42:58 +04:00
|
|
|
(this->GlobalGenerator)->GetConfigurations();
|
2012-04-27 16:34:49 +04:00
|
|
|
|
|
|
|
this->WriteSource("CustomBuild", source, ">\n");
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
for(std::vector<std::string>::iterator i = configs->begin();
|
|
|
|
i != configs->end(); ++i)
|
|
|
|
{
|
2014-03-10 23:47:19 +04:00
|
|
|
cmCustomCommandGenerator ccg(command, *i, this->Makefile);
|
|
|
|
std::string comment = lg->ConstructComment(ccg);
|
|
|
|
comment = cmVS10EscapeComment(comment);
|
2009-09-07 18:11:20 +04:00
|
|
|
std::string script =
|
2014-03-10 23:47:19 +04:00
|
|
|
cmVS10EscapeXML(lg->ConstructScript(ccg));
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("Message",i->c_str(), 3);
|
2010-10-02 00:12:00 +04:00
|
|
|
(*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("Command", i->c_str(), 3);
|
|
|
|
(*this->BuildFileStream ) << script << "</Command>\n";
|
|
|
|
this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << cmVS10EscapeXML(source->GetFullPath());
|
2012-08-13 21:42:58 +04:00
|
|
|
for(std::vector<std::string>::const_iterator d =
|
2014-03-10 23:47:19 +04:00
|
|
|
ccg.GetDepends().begin();
|
|
|
|
d != ccg.GetDepends().end();
|
2009-06-26 00:41:57 +04:00
|
|
|
++d)
|
|
|
|
{
|
2010-12-09 00:51:16 +03:00
|
|
|
std::string dep;
|
|
|
|
if(this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(), dep))
|
|
|
|
{
|
|
|
|
this->ConvertToWindowsSlash(dep);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << ";" << cmVS10EscapeXML(dep);
|
2010-12-09 00:51:16 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
(*this->BuildFileStream ) << ";%(AdditionalInputs)</AdditionalInputs>\n";
|
|
|
|
this->WritePlatformConfigTag("Outputs", i->c_str(), 3);
|
|
|
|
const char* sep = "";
|
2012-08-13 21:42:58 +04:00
|
|
|
for(std::vector<std::string>::const_iterator o =
|
2014-03-10 23:47:19 +04:00
|
|
|
ccg.GetOutputs().begin();
|
|
|
|
o != ccg.GetOutputs().end();
|
2009-06-26 00:41:57 +04:00
|
|
|
++o)
|
|
|
|
{
|
|
|
|
std::string out = *o;
|
|
|
|
this->ConvertToWindowsSlash(out);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << sep << cmVS10EscapeXML(out);
|
2009-06-26 00:41:57 +04:00
|
|
|
sep = ";";
|
|
|
|
}
|
2011-08-19 00:51:52 +04:00
|
|
|
(*this->BuildFileStream ) << "</Outputs>\n";
|
2013-01-07 20:31:52 +04:00
|
|
|
if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
|
|
|
|
{
|
|
|
|
// VS >= 11 let us turn off linking of custom command outputs.
|
|
|
|
this->WritePlatformConfigTag("LinkObjects", i->c_str(), 3);
|
|
|
|
(*this->BuildFileStream ) << "false</LinkObjects>\n";
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
this->WriteString("</CustomBuild>\n", 2);
|
|
|
|
}
|
|
|
|
|
2012-04-27 18:42:23 +04:00
|
|
|
std::string
|
|
|
|
cmVisualStudio10TargetGenerator::ConvertPath(std::string const& path,
|
|
|
|
bool forceRelative)
|
|
|
|
{
|
|
|
|
return forceRelative
|
|
|
|
? cmSystemTools::RelativePath(
|
|
|
|
this->Makefile->GetCurrentOutputDirectory(), path.c_str())
|
|
|
|
: this->LocalGenerator->Convert(path.c_str(),
|
|
|
|
cmLocalGenerator::START_OUTPUT,
|
2014-04-15 19:47:54 +04:00
|
|
|
cmLocalGenerator::UNCHANGED,
|
|
|
|
/* optional = */ true);
|
2012-04-27 18:42:23 +04:00
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)
|
|
|
|
{
|
|
|
|
// first convert all of the slashes
|
|
|
|
std::string::size_type pos = 0;
|
|
|
|
while((pos = s.find('/', pos)) != std::string::npos)
|
|
|
|
{
|
|
|
|
s[pos] = '\\';
|
|
|
|
pos++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteGroups()
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2009-07-11 08:05:20 +04:00
|
|
|
// collect up group information
|
2012-08-13 21:42:58 +04:00
|
|
|
std::vector<cmSourceGroup> sourceGroups =
|
2009-07-11 08:05:20 +04:00
|
|
|
this->Makefile->GetSourceGroups();
|
2013-07-14 20:22:57 +04:00
|
|
|
std::vector<cmSourceFile*> classes;
|
2014-02-13 20:25:00 +04:00
|
|
|
if (!this->Target->GetConfigCommonSourceFiles(classes))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2009-07-11 08:05:20 +04:00
|
|
|
std::set<cmSourceGroup*> groupsUsed;
|
2012-08-13 21:42:58 +04:00
|
|
|
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
|
2009-07-11 08:05:20 +04:00
|
|
|
s != classes.end(); s++)
|
|
|
|
{
|
2012-08-13 21:42:58 +04:00
|
|
|
cmSourceFile* sf = *s;
|
2009-07-11 08:05:20 +04:00
|
|
|
std::string const& source = sf->GetFullPath();
|
2014-01-21 19:43:47 +04:00
|
|
|
cmSourceGroup* sourceGroup =
|
2009-07-11 08:05:20 +04:00
|
|
|
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
|
2014-01-21 19:43:47 +04:00
|
|
|
groupsUsed.insert(sourceGroup);
|
2009-07-11 08:05:20 +04:00
|
|
|
}
|
2010-06-11 23:33:38 +04:00
|
|
|
|
|
|
|
this->AddMissingSourceGroups(groupsUsed, sourceGroups);
|
|
|
|
|
2009-07-11 08:05:20 +04:00
|
|
|
// Write out group file
|
|
|
|
std::string path = this->Makefile->GetStartOutputDirectory();
|
|
|
|
path += "/";
|
2009-07-14 00:58:24 +04:00
|
|
|
path += this->Name;
|
2009-07-11 08:05:20 +04:00
|
|
|
path += ".vcxproj.filters";
|
|
|
|
cmGeneratedFileStream fout(path.c_str());
|
2010-05-05 22:30:21 +04:00
|
|
|
fout.SetCopyIfDifferent(true);
|
2009-07-11 08:05:20 +04:00
|
|
|
char magic[] = {0xEF,0xBB, 0xBF};
|
|
|
|
fout.write(magic, 3);
|
|
|
|
cmGeneratedFileStream* save = this->BuildFileStream;
|
|
|
|
this->BuildFileStream = & fout;
|
2013-08-20 22:59:59 +04:00
|
|
|
|
|
|
|
//get the tools version to use
|
|
|
|
const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
|
2013-11-13 20:29:07 +04:00
|
|
|
std::string project_defaults=
|
2014-03-14 18:48:42 +04:00
|
|
|
"<?xml version=\"1.0\" encoding=\"" +
|
|
|
|
this->GlobalGenerator->Encoding() + "\"?>\n";
|
2013-08-20 22:59:59 +04:00
|
|
|
project_defaults.append("<Project ToolsVersion=\"");
|
|
|
|
project_defaults.append(toolsVer +"\" ");
|
|
|
|
project_defaults.append(
|
|
|
|
"xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
|
|
|
|
this->WriteString(project_defaults.c_str(),0);
|
|
|
|
|
2012-04-27 17:21:08 +04:00
|
|
|
for(ToolSourceMap::const_iterator ti = this->Tools.begin();
|
|
|
|
ti != this->Tools.end(); ++ti)
|
|
|
|
{
|
|
|
|
this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
|
|
|
|
}
|
2009-07-11 08:05:20 +04:00
|
|
|
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> resxObjs;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetResxSources(resxObjs, "");
|
2013-04-29 18:48:22 +04:00
|
|
|
if(!resxObjs.empty())
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2014-03-13 02:06:05 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator oi = resxObjs.begin();
|
2013-04-29 18:48:22 +04:00
|
|
|
oi != resxObjs.end(); ++oi)
|
|
|
|
{
|
|
|
|
std::string obj = (*oi)->GetFullPath();
|
|
|
|
this->WriteString("<EmbeddedResource Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\">\n";
|
2013-04-29 18:48:22 +04:00
|
|
|
this->WriteString("<Filter>Resource Files</Filter>\n", 3);
|
|
|
|
this->WriteString("</EmbeddedResource>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
|
2012-03-12 22:40:58 +04:00
|
|
|
// Add object library contents as external objects.
|
|
|
|
std::vector<std::string> objs;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->UseObjectLibraries(objs, "");
|
2012-03-12 22:40:58 +04:00
|
|
|
if(!objs.empty())
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
|
|
|
for(std::vector<std::string>::const_iterator
|
|
|
|
oi = objs.begin(); oi != objs.end(); ++oi)
|
|
|
|
{
|
|
|
|
std::string obj = *oi;
|
|
|
|
this->WriteString("<Object Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\">\n";
|
2012-03-12 22:40:58 +04:00
|
|
|
this->WriteString("<Filter>Object Libraries</Filter>\n", 3);
|
|
|
|
this->WriteString("</Object>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
|
2009-07-11 08:05:20 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
|
|
|
for(std::set<cmSourceGroup*>::iterator g = groupsUsed.begin();
|
|
|
|
g != groupsUsed.end(); ++g)
|
|
|
|
{
|
|
|
|
cmSourceGroup* sg = *g;
|
|
|
|
const char* name = sg->GetFullName();
|
|
|
|
if(strlen(name) != 0)
|
|
|
|
{
|
|
|
|
this->WriteString("<Filter Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << name << "\">\n";
|
|
|
|
std::string guidName = "SG_Filter_";
|
|
|
|
guidName += name;
|
|
|
|
this->GlobalGenerator->CreateGUID(guidName.c_str());
|
|
|
|
this->WriteString("<UniqueIdentifier>", 3);
|
2012-08-13 21:42:58 +04:00
|
|
|
std::string guid
|
2009-07-11 08:05:20 +04:00
|
|
|
= this->GlobalGenerator->GetGUID(guidName.c_str());
|
2012-08-13 21:42:58 +04:00
|
|
|
(*this->BuildFileStream)
|
2009-07-11 08:05:20 +04:00
|
|
|
<< "{"
|
|
|
|
<< guid << "}"
|
|
|
|
<< "</UniqueIdentifier>\n";
|
|
|
|
this->WriteString("</Filter>\n", 2);
|
|
|
|
}
|
|
|
|
}
|
2012-03-12 22:40:58 +04:00
|
|
|
if(!objs.empty())
|
|
|
|
{
|
|
|
|
this->WriteString("<Filter Include=\"Object Libraries\">\n", 2);
|
|
|
|
std::string guidName = "SG_Filter_Object Libraries";
|
|
|
|
this->GlobalGenerator->CreateGUID(guidName.c_str());
|
|
|
|
this->WriteString("<UniqueIdentifier>", 3);
|
|
|
|
std::string guid =
|
|
|
|
this->GlobalGenerator->GetGUID(guidName.c_str());
|
|
|
|
(*this->BuildFileStream) << "{" << guid << "}"
|
|
|
|
<< "</UniqueIdentifier>\n";
|
|
|
|
this->WriteString("</Filter>\n", 2);
|
|
|
|
}
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2013-11-10 14:22:44 +04:00
|
|
|
if(!resxObjs.empty())
|
2013-04-29 18:48:22 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<Filter Include=\"Resource Files\">\n", 2);
|
|
|
|
std::string guidName = "SG_Filter_Resource Files";
|
|
|
|
this->GlobalGenerator->CreateGUID(guidName.c_str());
|
|
|
|
this->WriteString("<UniqueIdentifier>", 3);
|
|
|
|
std::string guid =
|
|
|
|
this->GlobalGenerator->GetGUID(guidName.c_str());
|
|
|
|
(*this->BuildFileStream) << "{" << guid << "}"
|
|
|
|
<< "</UniqueIdentifier>\n";
|
|
|
|
this->WriteString("<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;", 3);
|
|
|
|
(*this->BuildFileStream) << "gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;";
|
|
|
|
(*this->BuildFileStream) << "mfcribbon-ms</Extensions>\n";
|
|
|
|
this->WriteString("</Filter>\n", 2);
|
|
|
|
}
|
|
|
|
|
2009-07-11 08:05:20 +04:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
this->WriteString("</Project>\n", 0);
|
|
|
|
// restore stream pointer
|
|
|
|
this->BuildFileStream = save;
|
2010-05-05 22:30:21 +04:00
|
|
|
|
|
|
|
if (fout.Close())
|
|
|
|
{
|
|
|
|
this->GlobalGenerator->FileReplacedDuringGenerate(path);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2010-06-11 23:33:38 +04:00
|
|
|
// Add to groupsUsed empty source groups that have non-empty children.
|
|
|
|
void
|
|
|
|
cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
|
|
|
std::set<cmSourceGroup*>& groupsUsed,
|
|
|
|
const std::vector<cmSourceGroup>& allGroups
|
|
|
|
)
|
|
|
|
{
|
|
|
|
for(std::vector<cmSourceGroup>::const_iterator current = allGroups.begin();
|
|
|
|
current != allGroups.end(); ++current)
|
|
|
|
{
|
|
|
|
std::vector<cmSourceGroup> const& children = current->GetGroupChildren();
|
|
|
|
if(children.empty())
|
|
|
|
{
|
|
|
|
continue; // the group is really empty
|
|
|
|
}
|
|
|
|
|
|
|
|
this->AddMissingSourceGroups(groupsUsed, children);
|
|
|
|
|
|
|
|
cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(&(*current));
|
|
|
|
if(groupsUsed.find(current_ptr) != groupsUsed.end())
|
|
|
|
{
|
|
|
|
continue; // group has already been added to set
|
|
|
|
}
|
|
|
|
|
|
|
|
// check if it least one of the group's descendants is not empty
|
|
|
|
// (at least one child must already have been added)
|
|
|
|
std::vector<cmSourceGroup>::const_iterator child_it = children.begin();
|
|
|
|
while(child_it != children.end())
|
|
|
|
{
|
|
|
|
cmSourceGroup* child_ptr = const_cast<cmSourceGroup*>(&(*child_it));
|
|
|
|
if(groupsUsed.find(child_ptr) != groupsUsed.end())
|
|
|
|
{
|
|
|
|
break; // found a child that was already added => add current group too
|
|
|
|
}
|
|
|
|
child_it++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(child_it == children.end())
|
|
|
|
{
|
|
|
|
continue; // no descendants have source files => ignore this group
|
|
|
|
}
|
|
|
|
|
|
|
|
groupsUsed.insert(current_ptr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-05 22:30:21 +04:00
|
|
|
void
|
2009-07-11 08:05:20 +04:00
|
|
|
cmVisualStudio10TargetGenerator::
|
|
|
|
WriteGroupSources(const char* name,
|
2012-04-27 17:21:08 +04:00
|
|
|
ToolSources const& sources,
|
2009-07-11 08:05:20 +04:00
|
|
|
std::vector<cmSourceGroup>& sourceGroups)
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2012-04-27 17:21:08 +04:00
|
|
|
for(ToolSources::const_iterator s = sources.begin();
|
2009-07-11 08:05:20 +04:00
|
|
|
s != sources.end(); ++s)
|
|
|
|
{
|
2014-03-13 02:06:05 +04:00
|
|
|
cmSourceFile const* sf = s->SourceFile;
|
2009-07-11 08:05:20 +04:00
|
|
|
std::string const& source = sf->GetFullPath();
|
2014-01-21 19:43:47 +04:00
|
|
|
cmSourceGroup* sourceGroup =
|
2009-07-11 08:05:20 +04:00
|
|
|
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
|
2014-01-21 19:43:47 +04:00
|
|
|
const char* filter = sourceGroup->GetFullName();
|
2012-08-13 21:42:58 +04:00
|
|
|
this->WriteString("<", 2);
|
2012-04-27 18:42:23 +04:00
|
|
|
std::string path = this->ConvertPath(source, s->RelativePath);
|
2009-07-11 08:05:20 +04:00
|
|
|
this->ConvertToWindowsSlash(path);
|
|
|
|
(*this->BuildFileStream) << name << " Include=\""
|
2014-07-23 23:03:28 +04:00
|
|
|
<< cmVS10EscapeXML(path);
|
2009-07-11 08:05:20 +04:00
|
|
|
if(strlen(filter))
|
|
|
|
{
|
|
|
|
(*this->BuildFileStream) << "\">\n";
|
|
|
|
this->WriteString("<Filter>", 3);
|
|
|
|
(*this->BuildFileStream) << filter << "</Filter>\n";
|
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream) << name << ">\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(*this->BuildFileStream) << "\" />\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2014-07-29 21:36:53 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteHeaderSource(cmSourceFile const* sf)
|
|
|
|
{
|
2014-07-29 21:41:17 +04:00
|
|
|
if(this->IsResxHeader(sf->GetFullPath()))
|
|
|
|
{
|
|
|
|
this->WriteSource("ClInclude", sf, ">\n");
|
|
|
|
this->WriteString("<FileType>CppForm</FileType>\n", 3);
|
|
|
|
this->WriteString("</ClInclude>\n", 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->WriteSource("ClInclude", sf);
|
|
|
|
}
|
2014-07-29 21:36:53 +04:00
|
|
|
}
|
|
|
|
|
2014-07-29 21:32:22 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
|
|
|
|
{
|
2014-07-29 22:41:03 +04:00
|
|
|
bool toolHasSettings = false;
|
2014-07-29 21:43:35 +04:00
|
|
|
std::string tool = "None";
|
2014-07-29 22:48:20 +04:00
|
|
|
std::string shaderType;
|
2014-07-29 21:43:35 +04:00
|
|
|
std::string const& ext = sf->GetExtension();
|
|
|
|
if(ext == "appxmanifest")
|
|
|
|
{
|
|
|
|
tool = "AppxManifest";
|
|
|
|
}
|
2014-07-29 22:48:20 +04:00
|
|
|
else if(ext == "hlsl")
|
|
|
|
{
|
|
|
|
tool = "FXCompile";
|
|
|
|
// Figure out the type of shader compiler to use.
|
|
|
|
if(const char* st = sf->GetProperty("VS_SHADER_TYPE"))
|
|
|
|
{
|
|
|
|
shaderType = st;
|
|
|
|
toolHasSettings = true;
|
|
|
|
}
|
|
|
|
}
|
2014-07-29 21:52:42 +04:00
|
|
|
else if(ext == "jpg" ||
|
|
|
|
ext == "png")
|
|
|
|
{
|
|
|
|
tool = "Image";
|
|
|
|
}
|
2014-07-29 21:45:23 +04:00
|
|
|
else if(ext == "xml")
|
|
|
|
{
|
|
|
|
tool = "XML";
|
|
|
|
}
|
2014-07-29 22:41:03 +04:00
|
|
|
|
2014-07-29 22:03:35 +04:00
|
|
|
std::string deployContent;
|
|
|
|
if(this->GlobalGenerator->TargetsWindowsPhone() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsStore())
|
|
|
|
{
|
|
|
|
const char* content = sf->GetProperty("VS_DEPLOYMENT_CONTENT");
|
|
|
|
if(content && *content)
|
|
|
|
{
|
|
|
|
toolHasSettings = true;
|
|
|
|
deployContent = content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-29 22:41:03 +04:00
|
|
|
if(toolHasSettings)
|
|
|
|
{
|
|
|
|
this->WriteSource(tool, sf, ">\n");
|
|
|
|
|
2014-07-29 22:03:35 +04:00
|
|
|
if(!deployContent.empty())
|
|
|
|
{
|
|
|
|
std::vector<std::string> const* configs =
|
|
|
|
this->GlobalGenerator->GetConfigurations();
|
|
|
|
cmGeneratorExpression ge;
|
|
|
|
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
|
|
|
|
ge.Parse(deployContent);
|
|
|
|
for(size_t i = 0; i != configs->size(); ++i)
|
|
|
|
{
|
|
|
|
if(0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i]), "1"))
|
|
|
|
{
|
|
|
|
this->WriteString("<DeploymentContent Condition=\""
|
|
|
|
"'$(Configuration)|$(Platform)'=='", 3);
|
|
|
|
(*this->BuildFileStream) << (*configs)[i] << "|"
|
|
|
|
<< this->Platform << "'\">true";
|
|
|
|
this->WriteString("</DeploymentContent>\n", 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->WriteString("<ExcludedFromBuild Condition=\""
|
|
|
|
"'$(Configuration)|$(Platform)'=='", 3);
|
|
|
|
(*this->BuildFileStream) << (*configs)[i] << "|"
|
|
|
|
<< this->Platform << "'\">true";
|
|
|
|
this->WriteString("</ExcludedFromBuild>\n", 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-29 22:48:20 +04:00
|
|
|
if(!shaderType.empty())
|
|
|
|
{
|
|
|
|
this->WriteString("<ShaderType>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderType)
|
|
|
|
<< "</ShaderType>\n";
|
|
|
|
}
|
2014-07-29 22:03:35 +04:00
|
|
|
|
2014-07-29 22:41:03 +04:00
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream) << tool << ">\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->WriteSource(tool, sf);
|
|
|
|
}
|
2014-07-29 21:32:22 +04:00
|
|
|
}
|
|
|
|
|
2012-03-19 19:25:21 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteSource(
|
2014-07-29 21:26:19 +04:00
|
|
|
std::string const& tool, cmSourceFile const* sf, const char* end)
|
2012-03-19 19:25:21 +04:00
|
|
|
{
|
2012-04-27 19:00:22 +04:00
|
|
|
// Visual Studio tools append relative paths to the current dir, as in:
|
|
|
|
//
|
|
|
|
// c:\path\to\current\dir\..\..\..\relative\path\to\source.c
|
|
|
|
//
|
|
|
|
// and fail if this exceeds the maximum allowed path length. Our path
|
2014-04-15 19:47:54 +04:00
|
|
|
// conversion uses full paths when possible to allow deeper trees.
|
2012-04-27 19:00:22 +04:00
|
|
|
bool forceRelative = false;
|
|
|
|
std::string sourceFile = this->ConvertPath(sf->GetFullPath(), false);
|
|
|
|
if(this->LocalGenerator->GetVersion() == cmLocalVisualStudioGenerator::VS10
|
|
|
|
&& cmSystemTools::FileIsFullPath(sourceFile.c_str()))
|
|
|
|
{
|
|
|
|
// Normal path conversion resulted in a full path. VS 10 (but not 11)
|
|
|
|
// refuses to show the property page in the IDE for a source file with a
|
|
|
|
// full path (not starting in a '.' or '/' AFAICT). CMake <= 2.8.4 used a
|
2012-04-27 22:13:02 +04:00
|
|
|
// relative path but to allow deeper build trees CMake 2.8.[5678] used a
|
|
|
|
// full path except for custom commands. Custom commands do not work
|
|
|
|
// without a relative path, but they do not seem to be involved in tools
|
|
|
|
// with the above behavior. For other sources we now use a relative path
|
|
|
|
// when the combined path will not be too long so property pages appear.
|
|
|
|
std::string sourceRel = this->ConvertPath(sf->GetFullPath(), true);
|
|
|
|
size_t const maxLen = 250;
|
|
|
|
if(sf->GetCustomCommand() ||
|
|
|
|
((strlen(this->Makefile->GetCurrentOutputDirectory()) + 1 +
|
|
|
|
sourceRel.length()) <= maxLen))
|
2012-04-27 19:00:22 +04:00
|
|
|
{
|
|
|
|
forceRelative = true;
|
2012-04-27 22:13:02 +04:00
|
|
|
sourceFile = sourceRel;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->GlobalGenerator->PathTooLong(this->Target, sf, sourceRel);
|
2012-04-27 19:00:22 +04:00
|
|
|
}
|
|
|
|
}
|
2012-03-19 19:25:21 +04:00
|
|
|
this->ConvertToWindowsSlash(sourceFile);
|
|
|
|
this->WriteString("<", 2);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << tool << " Include=\""
|
2014-07-29 21:41:17 +04:00
|
|
|
<< cmVS10EscapeXML(sourceFile) << "\""
|
|
|
|
<< (end? end : " />\n");
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2012-04-27 18:42:23 +04:00
|
|
|
ToolSource toolSource = {sf, forceRelative};
|
2012-04-27 17:21:08 +04:00
|
|
|
this->Tools[tool].push_back(toolSource);
|
2012-03-19 19:25:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteSources(
|
2014-07-29 21:26:19 +04:00
|
|
|
std::string const& tool, std::vector<cmSourceFile const*> const& sources)
|
2012-03-19 19:25:21 +04:00
|
|
|
{
|
2014-03-13 02:06:05 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator
|
2012-03-19 19:25:21 +04:00
|
|
|
si = sources.begin(); si != sources.end(); ++si)
|
2009-06-26 06:53:02 +04:00
|
|
|
{
|
2012-03-19 19:25:21 +04:00
|
|
|
this->WriteSource(tool, *si);
|
2009-06-26 06:53:02 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-03-19 19:25:21 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteAllSources()
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2011-01-07 00:48:46 +03:00
|
|
|
if(this->Target->GetType() > cmTarget::UTILITY)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2009-07-10 17:12:39 +04:00
|
|
|
return;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2012-03-19 19:25:21 +04:00
|
|
|
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> headerSources;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetHeaderSources(headerSources, "");
|
2014-07-29 21:36:53 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator
|
|
|
|
si = headerSources.begin(); si != headerSources.end(); ++si)
|
|
|
|
{
|
|
|
|
this->WriteHeaderSource(*si);
|
|
|
|
}
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> idlSources;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetIDLSources(idlSources, "");
|
2013-11-10 14:22:44 +04:00
|
|
|
this->WriteSources("Midl", idlSources);
|
2012-03-19 19:25:21 +04:00
|
|
|
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> objectSources;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetObjectSources(objectSources, "");
|
2014-03-13 02:06:05 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator
|
2013-11-10 14:22:44 +04:00
|
|
|
si = objectSources.begin();
|
|
|
|
si != objectSources.end(); ++si)
|
2012-03-19 19:25:21 +04:00
|
|
|
{
|
2014-02-04 06:20:56 +04:00
|
|
|
const std::string& lang = (*si)->GetLanguage();
|
2014-07-29 21:26:19 +04:00
|
|
|
std::string tool;
|
2014-02-04 06:20:56 +04:00
|
|
|
if (lang == "C"|| lang == "CXX")
|
2013-08-05 18:34:10 +04:00
|
|
|
{
|
|
|
|
tool = "ClCompile";
|
|
|
|
}
|
2014-02-04 06:20:56 +04:00
|
|
|
else if (lang == "ASM_NASM" &&
|
2013-08-05 18:34:10 +04:00
|
|
|
this->GlobalGenerator->IsMasmEnabled())
|
|
|
|
{
|
|
|
|
tool = "MASM";
|
|
|
|
}
|
2014-02-04 06:20:56 +04:00
|
|
|
else if (lang == "RC")
|
2011-01-21 18:57:34 +03:00
|
|
|
{
|
2013-08-05 18:34:10 +04:00
|
|
|
tool = "ResourceCompile";
|
2011-01-21 18:57:34 +03:00
|
|
|
}
|
2013-08-05 18:34:10 +04:00
|
|
|
|
2014-07-29 21:26:19 +04:00
|
|
|
if (!tool.empty())
|
2011-01-26 02:54:36 +03:00
|
|
|
{
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteSource(tool, *si, " ");
|
|
|
|
if (this->OutputSourceSpecificFlags(*si))
|
|
|
|
{
|
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream ) << tool << ">\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
(*this->BuildFileStream ) << " />\n";
|
|
|
|
}
|
2011-01-26 02:54:36 +03:00
|
|
|
}
|
2011-01-21 18:57:34 +03:00
|
|
|
else
|
|
|
|
{
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteSource("None", *si);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
2012-03-12 22:40:58 +04:00
|
|
|
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> externalObjects;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetExternalObjects(externalObjects, "");
|
2014-03-18 19:40:46 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::iterator
|
|
|
|
si = externalObjects.begin();
|
|
|
|
si != externalObjects.end(); )
|
|
|
|
{
|
|
|
|
if (!(*si)->GetObjectLibrary().empty())
|
|
|
|
{
|
|
|
|
si = externalObjects.erase(si);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++si;
|
|
|
|
}
|
|
|
|
}
|
2013-01-07 20:31:52 +04:00
|
|
|
if(this->LocalGenerator->GetVersion() > cmLocalVisualStudioGenerator::VS10)
|
|
|
|
{
|
|
|
|
// For VS >= 11 we use LinkObjects to avoid linking custom command
|
|
|
|
// outputs. Use Object for all external objects, generated or not.
|
2013-11-10 14:22:44 +04:00
|
|
|
this->WriteSources("Object", externalObjects);
|
2013-01-07 20:31:52 +04:00
|
|
|
}
|
|
|
|
else
|
2012-03-19 19:25:21 +04:00
|
|
|
{
|
2012-03-20 01:14:52 +04:00
|
|
|
// If an object file is generated in this target, then vs10 will use
|
|
|
|
// it in the build, and we have to list it as None instead of Object.
|
2014-03-13 02:06:05 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator
|
2013-11-10 14:22:44 +04:00
|
|
|
si = externalObjects.begin();
|
|
|
|
si != externalObjects.end(); ++si)
|
2013-01-07 20:31:52 +04:00
|
|
|
{
|
2012-10-11 02:57:11 +04:00
|
|
|
std::vector<cmSourceFile*> const* d =
|
|
|
|
this->GeneratorTarget->GetSourceDepends(*si);
|
2013-01-07 20:31:52 +04:00
|
|
|
this->WriteSource((d && !d->empty())? "None":"Object", *si);
|
|
|
|
}
|
2012-03-19 19:25:21 +04:00
|
|
|
}
|
|
|
|
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> extraSources;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetExtraSources(extraSources, "");
|
2014-07-29 21:32:22 +04:00
|
|
|
for(std::vector<cmSourceFile const*>::const_iterator
|
|
|
|
si = extraSources.begin(); si != extraSources.end(); ++si)
|
|
|
|
{
|
|
|
|
this->WriteExtraSource(*si);
|
|
|
|
}
|
2012-03-19 19:25:21 +04:00
|
|
|
|
2012-03-12 22:40:58 +04:00
|
|
|
// Add object library contents as external objects.
|
|
|
|
std::vector<std::string> objs;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->UseObjectLibraries(objs, "");
|
2012-03-12 22:40:58 +04:00
|
|
|
for(std::vector<std::string>::const_iterator
|
|
|
|
oi = objs.begin(); oi != objs.end(); ++oi)
|
|
|
|
{
|
|
|
|
std::string obj = *oi;
|
|
|
|
this->WriteString("<Object Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream ) << cmVS10EscapeXML(obj) << "\" />\n";
|
2012-03-12 22:40:58 +04:00
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
|
2014-03-13 02:50:42 +04:00
|
|
|
cmSourceFile const* source)
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2014-03-13 02:50:42 +04:00
|
|
|
cmSourceFile const& sf = *source;
|
2009-07-10 17:12:39 +04:00
|
|
|
|
|
|
|
std::string objectName;
|
2013-11-10 14:22:44 +04:00
|
|
|
if(this->GeneratorTarget->HasExplicitObjectName(&sf))
|
2009-07-10 17:12:39 +04:00
|
|
|
{
|
2013-11-10 14:22:44 +04:00
|
|
|
objectName = this->GeneratorTarget->GetObjectName(&sf);
|
2009-07-10 17:12:39 +04:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string flags;
|
|
|
|
std::string defines;
|
|
|
|
if(const char* cflags = sf.GetProperty("COMPILE_FLAGS"))
|
|
|
|
{
|
|
|
|
flags += cflags;
|
2012-08-13 21:42:58 +04:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
if(const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS"))
|
|
|
|
{
|
|
|
|
defines += cdefs;
|
|
|
|
}
|
2014-02-04 06:20:56 +04:00
|
|
|
std::string lang =
|
2009-06-26 00:41:57 +04:00
|
|
|
this->GlobalGenerator->GetLanguageFromExtension
|
|
|
|
(sf.GetExtension().c_str());
|
2014-02-04 06:20:56 +04:00
|
|
|
std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
|
|
|
|
const std::string& linkLanguage = this->Target->GetLinkerLanguage();
|
2009-06-26 00:41:57 +04:00
|
|
|
bool needForceLang = false;
|
|
|
|
// source file does not match its extension language
|
2014-02-04 06:20:56 +04:00
|
|
|
if(lang != sourceLang)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
needForceLang = true;
|
|
|
|
lang = sourceLang;
|
2012-08-13 21:42:58 +04:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// if the source file does not match the linker language
|
|
|
|
// then force c or c++
|
2014-06-05 20:56:39 +04:00
|
|
|
const char* compileAs = 0;
|
2014-02-04 06:20:56 +04:00
|
|
|
if(needForceLang || (linkLanguage != lang))
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2014-02-04 06:20:56 +04:00
|
|
|
if(lang == "CXX")
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
// force a C++ file type
|
2014-06-05 20:56:39 +04:00
|
|
|
compileAs = "CompileAsCpp";
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2014-02-04 06:20:56 +04:00
|
|
|
else if(lang == "C")
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
// force to c
|
2014-06-05 20:56:39 +04:00
|
|
|
compileAs = "CompileAsC";
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
bool hasFlags = false;
|
2009-06-26 00:41:57 +04:00
|
|
|
// for the first time we need a new line if there is something
|
|
|
|
// produced here.
|
|
|
|
const char* firstString = ">\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
if(objectName.size())
|
|
|
|
{
|
|
|
|
(*this->BuildFileStream ) << firstString;
|
2012-08-13 21:42:58 +04:00
|
|
|
firstString = "";
|
2009-07-10 17:12:39 +04:00
|
|
|
hasFlags = true;
|
|
|
|
this->WriteString("<ObjectFileName>", 3);
|
|
|
|
(*this->BuildFileStream )
|
2010-09-27 16:37:00 +04:00
|
|
|
<< "$(IntDir)/" << objectName << "</ObjectFileName>\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
std::vector<std::string> *configs =
|
|
|
|
static_cast<cmGlobalVisualStudio7Generator *>
|
|
|
|
(this->GlobalGenerator)->GetConfigurations();
|
|
|
|
for( std::vector<std::string>::iterator config = configs->begin();
|
|
|
|
config != configs->end(); ++config)
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string configUpper = cmSystemTools::UpperCase(*config);
|
|
|
|
std::string configDefines = defines;
|
|
|
|
std::string defPropName = "COMPILE_DEFINITIONS_";
|
|
|
|
defPropName += configUpper;
|
|
|
|
if(const char* ccdefs = sf.GetProperty(defPropName.c_str()))
|
|
|
|
{
|
|
|
|
if(configDefines.size())
|
|
|
|
{
|
2009-07-14 00:58:24 +04:00
|
|
|
configDefines += ";";
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
configDefines += ccdefs;
|
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
// if we have flags or defines for this config then
|
2009-06-26 00:41:57 +04:00
|
|
|
// use them
|
2014-06-05 20:56:39 +04:00
|
|
|
if(!flags.empty() || !configDefines.empty() || compileAs)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
(*this->BuildFileStream ) << firstString;
|
|
|
|
firstString = ""; // only do firstString once
|
|
|
|
hasFlags = true;
|
2012-08-13 21:42:58 +04:00
|
|
|
cmVisualStudioGeneratorOptions
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions(this->LocalGenerator,
|
2011-11-11 02:17:41 +04:00
|
|
|
cmVisualStudioGeneratorOptions::Compiler,
|
2014-06-03 21:34:21 +04:00
|
|
|
this->GetClFlagTable(), 0, this);
|
2014-06-05 20:56:39 +04:00
|
|
|
if(compileAs)
|
|
|
|
{
|
|
|
|
clOptions.AddFlag("CompileAs", compileAs);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.Parse(flags.c_str());
|
2014-08-13 22:09:24 +04:00
|
|
|
if(clOptions.HasFlag("AdditionalIncludeDirectories"))
|
|
|
|
{
|
|
|
|
clOptions.AppendFlag("AdditionalIncludeDirectories",
|
|
|
|
"%(AdditionalIncludeDirectories)");
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.AddDefines(configDefines.c_str());
|
|
|
|
clOptions.SetConfiguration((*config).c_str());
|
|
|
|
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
|
2012-08-13 21:42:58 +04:00
|
|
|
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
|
2009-06-28 16:59:56 +04:00
|
|
|
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream,
|
2011-01-26 02:54:36 +03:00
|
|
|
" ", "\n", lang);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return hasFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
|
|
|
|
{
|
2010-09-13 21:29:10 +04:00
|
|
|
cmTarget::TargetType ttype = this->Target->GetType();
|
|
|
|
if(ttype > cmTarget::GLOBAL_TARGET)
|
2009-07-10 17:12:39 +04:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2010-09-13 21:29:10 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<PropertyGroup>\n", 2);
|
|
|
|
this->WriteString("<_ProjectFileVersion>10.0.20506.1"
|
|
|
|
"</_ProjectFileVersion>\n", 3);
|
|
|
|
std::vector<std::string> *configs =
|
|
|
|
static_cast<cmGlobalVisualStudio7Generator *>
|
|
|
|
(this->GlobalGenerator)->GetConfigurations();
|
|
|
|
for(std::vector<std::string>::iterator config = configs->begin();
|
|
|
|
config != configs->end(); ++config)
|
|
|
|
{
|
2010-09-13 21:29:10 +04:00
|
|
|
if(ttype >= cmTarget::UTILITY)
|
|
|
|
{
|
|
|
|
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
|
|
|
|
*this->BuildFileStream
|
|
|
|
<< "$(Platform)\\$(Configuration)\\$(ProjectName)\\"
|
|
|
|
<< "</IntDir>\n";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
std::string intermediateDir = this->LocalGenerator->
|
|
|
|
GetTargetDirectory(*this->Target);
|
|
|
|
intermediateDir += "/";
|
|
|
|
intermediateDir += *config;
|
|
|
|
intermediateDir += "/";
|
2012-03-12 18:55:07 +04:00
|
|
|
std::string outDir;
|
|
|
|
std::string targetNameFull;
|
|
|
|
if(ttype == cmTarget::OBJECT_LIBRARY)
|
|
|
|
{
|
|
|
|
outDir = intermediateDir;
|
|
|
|
targetNameFull = this->Target->GetName();
|
|
|
|
targetNameFull += ".lib";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
outDir = this->Target->GetDirectory(config->c_str()) + "/";
|
|
|
|
targetNameFull = this->Target->GetFullName(config->c_str());
|
|
|
|
}
|
2010-09-13 21:29:10 +04:00
|
|
|
this->ConvertToWindowsSlash(intermediateDir);
|
|
|
|
this->ConvertToWindowsSlash(outDir);
|
|
|
|
|
|
|
|
this->WritePlatformConfigTag("OutDir", config->c_str(), 3);
|
2014-06-04 23:29:46 +04:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(outDir)
|
2010-09-13 21:29:10 +04:00
|
|
|
<< "</OutDir>\n";
|
|
|
|
|
|
|
|
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
|
2014-06-04 23:29:46 +04:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(intermediateDir)
|
2010-09-13 21:29:10 +04:00
|
|
|
<< "</IntDir>\n";
|
|
|
|
|
2014-06-04 23:29:46 +04:00
|
|
|
std::string name =
|
|
|
|
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
|
2010-09-13 21:29:10 +04:00
|
|
|
this->WritePlatformConfigTag("TargetName", config->c_str(), 3);
|
2014-06-04 23:29:46 +04:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(name) << "</TargetName>\n";
|
2010-09-13 21:29:10 +04:00
|
|
|
|
2014-06-04 23:29:46 +04:00
|
|
|
std::string ext =
|
|
|
|
cmSystemTools::GetFilenameLastExtension(targetNameFull);
|
2014-06-04 23:51:08 +04:00
|
|
|
if(ext.empty())
|
|
|
|
{
|
|
|
|
// An empty TargetExt causes a default extension to be used.
|
|
|
|
// A single "." appears to be treated as an empty extension.
|
|
|
|
ext = ".";
|
|
|
|
}
|
2010-09-13 21:29:10 +04:00
|
|
|
this->WritePlatformConfigTag("TargetExt", config->c_str(), 3);
|
2014-06-04 23:29:46 +04:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(ext) << "</TargetExt>\n";
|
2010-09-13 21:29:10 +04:00
|
|
|
|
|
|
|
this->OutputLinkIncremental(*config);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
this->WriteString("</PropertyGroup>\n", 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
void
|
2009-06-26 00:41:57 +04:00
|
|
|
cmVisualStudio10TargetGenerator::
|
|
|
|
OutputLinkIncremental(std::string const& configName)
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2009-06-26 00:41:57 +04:00
|
|
|
// static libraries and things greater than modules do not need
|
|
|
|
// to set this option
|
|
|
|
if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
|
|
|
|
|| this->Target->GetType() > cmTarget::MODULE_LIBRARY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2012-10-26 18:16:45 +04:00
|
|
|
Options& linkOptions = *(this->LinkOptions[configName]);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
const char* incremental = linkOptions.GetFlag("LinkIncremental");
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("LinkIncremental", configName.c_str(), 3);
|
2012-10-26 18:16:45 +04:00
|
|
|
*this->BuildFileStream << (incremental?incremental:"true")
|
2012-08-13 21:42:58 +04:00
|
|
|
<< "</LinkIncremental>\n";
|
2012-10-26 18:16:45 +04:00
|
|
|
linkOptions.RemoveFlag("LinkIncremental");
|
2011-02-09 20:59:09 +03:00
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
const char* manifest = linkOptions.GetFlag("GenerateManifest");
|
2011-02-09 20:59:09 +03:00
|
|
|
this->WritePlatformConfigTag("GenerateManifest", configName.c_str(), 3);
|
2012-10-26 18:16:45 +04:00
|
|
|
*this->BuildFileStream << (manifest?manifest:"true")
|
2011-02-09 20:59:09 +03:00
|
|
|
<< "</GenerateManifest>\n";
|
2012-10-26 18:16:45 +04:00
|
|
|
linkOptions.RemoveFlag("GenerateManifest");
|
2012-10-26 19:02:42 +04:00
|
|
|
|
|
|
|
// Some link options belong here. Use them now and remove them so that
|
|
|
|
// WriteLinkOptions does not use them.
|
|
|
|
const char* flags[] = {
|
|
|
|
"LinkDelaySign",
|
|
|
|
"LinkKeyFile",
|
|
|
|
0};
|
|
|
|
for(const char** f = flags; *f; ++f)
|
|
|
|
{
|
|
|
|
const char* flag = *f;
|
|
|
|
if(const char* value = linkOptions.GetFlag(flag))
|
|
|
|
{
|
|
|
|
this->WritePlatformConfigTag(flag, configName.c_str(), 3);
|
|
|
|
*this->BuildFileStream << value << "</" << flag << ">\n";
|
|
|
|
linkOptions.RemoveFlag(flag);
|
|
|
|
}
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2009-10-23 19:34:37 +04:00
|
|
|
//----------------------------------------------------------------------------
|
2010-09-30 16:48:38 +04:00
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeClOptions()
|
2009-10-23 19:34:37 +04:00
|
|
|
{
|
|
|
|
std::vector<std::string> const* configs =
|
|
|
|
this->GlobalGenerator->GetConfigurations();
|
|
|
|
for(std::vector<std::string>::const_iterator i = configs->begin();
|
|
|
|
i != configs->end(); ++i)
|
|
|
|
{
|
2010-09-30 16:48:38 +04:00
|
|
|
if(!this->ComputeClOptions(*i))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2009-10-23 19:34:37 +04:00
|
|
|
}
|
2010-09-30 16:48:38 +04:00
|
|
|
return true;
|
2009-10-23 19:34:37 +04:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2009-10-23 19:34:37 +04:00
|
|
|
//----------------------------------------------------------------------------
|
2010-09-30 16:48:38 +04:00
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeClOptions(
|
2009-10-23 19:34:37 +04:00
|
|
|
std::string const& configName)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
// much of this was copied from here:
|
|
|
|
// copied from cmLocalVisualStudio7Generator.cxx 805
|
2009-10-23 19:34:37 +04:00
|
|
|
// TODO: Integrate code below with cmLocalVisualStudio7Generator.
|
|
|
|
|
|
|
|
cmsys::auto_ptr<Options> pOptions(
|
2011-11-11 02:17:41 +04:00
|
|
|
new Options(this->LocalGenerator, Options::Compiler,
|
2014-06-03 21:34:21 +04:00
|
|
|
this->GetClFlagTable()));
|
2009-10-23 19:34:37 +04:00
|
|
|
Options& clOptions = *pOptions;
|
2009-06-26 00:41:57 +04:00
|
|
|
|
|
|
|
std::string flags;
|
2014-06-05 19:50:10 +04:00
|
|
|
const std::string& linkLanguage =
|
|
|
|
this->Target->GetLinkerLanguage(configName.c_str());
|
|
|
|
if(linkLanguage.empty())
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2014-06-05 19:50:10 +04:00
|
|
|
cmSystemTools::Error
|
|
|
|
("CMake can not determine linker language for target: ",
|
|
|
|
this->Name.c_str());
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if(linkLanguage == "C" || linkLanguage == "CXX"
|
|
|
|
|| linkLanguage == "Fortran")
|
|
|
|
{
|
|
|
|
std::string baseFlagVar = "CMAKE_";
|
|
|
|
baseFlagVar += linkLanguage;
|
|
|
|
baseFlagVar += "_FLAGS";
|
|
|
|
flags = this->
|
|
|
|
Target->GetMakefile()->GetRequiredDefinition(baseFlagVar.c_str());
|
|
|
|
std::string flagVar = baseFlagVar + std::string("_") +
|
|
|
|
cmSystemTools::UpperCase(configName);
|
|
|
|
flags += " ";
|
|
|
|
flags += this->
|
|
|
|
Target->GetMakefile()->GetRequiredDefinition(flagVar.c_str());
|
|
|
|
}
|
|
|
|
// set the correct language
|
|
|
|
if(linkLanguage == "C")
|
|
|
|
{
|
2014-06-05 20:56:39 +04:00
|
|
|
clOptions.AddFlag("CompileAs", "CompileAsC");
|
2014-06-05 19:50:10 +04:00
|
|
|
}
|
|
|
|
if(linkLanguage == "CXX")
|
|
|
|
{
|
2014-06-05 20:56:39 +04:00
|
|
|
clOptions.AddFlag("CompileAs", "CompileAsCpp");
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2014-06-05 19:50:10 +04:00
|
|
|
this->LocalGenerator->AddCompileOptions(flags, this->Target,
|
|
|
|
linkLanguage, configName.c_str());
|
2013-05-16 16:59:04 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
// Get preprocessor definitions for this directory.
|
|
|
|
std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags();
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
clOptions.FixExceptionHandlingDefault();
|
|
|
|
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
|
|
|
|
std::string asmLocation = configName + "/";
|
|
|
|
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.Parse(flags.c_str());
|
|
|
|
clOptions.Parse(defineFlags.c_str());
|
2013-06-06 20:13:35 +04:00
|
|
|
std::vector<std::string> targetDefines;
|
|
|
|
this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
|
|
|
|
clOptions.AddDefines(targetDefines);
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
|
|
|
{
|
|
|
|
clOptions.SetVerboseMakefile(
|
|
|
|
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
|
|
|
|
// Add a definition for the configuration name.
|
|
|
|
std::string configDefine = "CMAKE_INTDIR=\"";
|
|
|
|
configDefine += configName;
|
|
|
|
configDefine += "\"";
|
|
|
|
clOptions.AddDefine(configDefine);
|
|
|
|
if(const char* exportMacro = this->Target->GetExportMacro())
|
|
|
|
{
|
|
|
|
clOptions.AddDefine(exportMacro);
|
|
|
|
}
|
2009-10-23 19:34:37 +04:00
|
|
|
|
|
|
|
this->ClOptions[configName] = pOptions.release();
|
2010-09-30 16:48:38 +04:00
|
|
|
return true;
|
2009-10-23 19:34:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteClOptions(
|
|
|
|
std::string const& configName,
|
|
|
|
std::vector<std::string> const& includes)
|
|
|
|
{
|
|
|
|
Options& clOptions = *(this->ClOptions[configName]);
|
|
|
|
this->WriteString("<ClCompile>\n", 2);
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
|
2014-08-13 22:09:24 +04:00
|
|
|
clOptions.AppendFlag("AdditionalIncludeDirectories", includes);
|
|
|
|
clOptions.AppendFlag("AdditionalIncludeDirectories",
|
|
|
|
"%(AdditionalIncludeDirectories)");
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
|
2014-06-05 21:18:09 +04:00
|
|
|
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
|
|
|
|
"\n", "CXX");
|
|
|
|
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
2010-08-19 17:21:54 +04:00
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
|
2010-08-19 17:21:54 +04:00
|
|
|
|
2014-06-10 18:13:00 +04:00
|
|
|
// If not in debug mode, write the DebugInformationFormat field
|
|
|
|
// without value so PDBs don't get generated uselessly.
|
|
|
|
if(!clOptions.IsDebug())
|
|
|
|
{
|
|
|
|
this->WriteString("<DebugInformationFormat>"
|
|
|
|
"</DebugInformationFormat>\n", 3);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specify the compiler program database file if configured.
|
|
|
|
std::string pdb = this->Target->GetCompilePDBPath(configName.c_str());
|
|
|
|
if(!pdb.empty())
|
|
|
|
{
|
|
|
|
this->ConvertToWindowsSlash(pdb);
|
|
|
|
this->WriteString("<ProgramDataBaseFileName>", 3);
|
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(pdb)
|
|
|
|
<< "</ProgramDataBaseFileName>\n";
|
|
|
|
}
|
2014-02-24 23:15:21 +04:00
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ClCompile>\n", 2);
|
|
|
|
}
|
|
|
|
|
2014-07-10 03:01:18 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
|
|
|
|
{
|
|
|
|
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->ComputeRcOptions(*i))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
|
|
|
|
std::string const& configName)
|
|
|
|
{
|
|
|
|
cmsys::auto_ptr<Options> pOptions(
|
|
|
|
new Options(this->LocalGenerator, Options::ResourceCompiler,
|
|
|
|
this->GetRcFlagTable()));
|
|
|
|
Options& rcOptions = *pOptions;
|
|
|
|
|
|
|
|
std::string CONFIG = cmSystemTools::UpperCase(configName);
|
|
|
|
std::string rcConfigFlagsVar = std::string("CMAKE_RC_FLAGS_") + CONFIG;
|
|
|
|
std::string flags =
|
|
|
|
std::string(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS")) +
|
|
|
|
std::string(" ") +
|
|
|
|
std::string(this->Makefile->GetSafeDefinition(rcConfigFlagsVar));
|
|
|
|
|
|
|
|
rcOptions.Parse(flags.c_str());
|
|
|
|
this->RcOptions[configName] = pOptions.release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::
|
2010-12-21 17:17:21 +03:00
|
|
|
WriteRCOptions(std::string const& configName,
|
2009-06-26 00:41:57 +04:00
|
|
|
std::vector<std::string> const & includes)
|
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
if(!this->MSTools)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<ResourceCompile>\n", 2);
|
2014-07-10 03:01:18 +04:00
|
|
|
|
|
|
|
// Preprocessor definitions and includes are shared with clOptions.
|
2010-12-21 17:17:21 +03:00
|
|
|
Options& clOptions = *(this->ClOptions[configName]);
|
|
|
|
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
|
2011-01-26 02:54:36 +03:00
|
|
|
"\n", "RC");
|
2014-07-10 03:01:18 +04:00
|
|
|
|
|
|
|
Options& rcOptions = *(this->RcOptions[configName]);
|
2014-08-13 22:09:24 +04:00
|
|
|
rcOptions.AppendFlag("AdditionalIncludeDirectories", includes);
|
|
|
|
rcOptions.AppendFlag("AdditionalIncludeDirectories",
|
|
|
|
"%(AdditionalIncludeDirectories)");
|
2014-07-10 03:01:18 +04:00
|
|
|
rcOptions.OutputFlagMap(*this->BuildFileStream, " ");
|
|
|
|
rcOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ResourceCompile>\n", 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-28 18:45:54 +04:00
|
|
|
void
|
|
|
|
cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
|
2009-06-28 16:59:56 +04:00
|
|
|
{
|
|
|
|
if(this->Target->GetType() != cmTarget::STATIC_LIBRARY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2013-07-10 21:11:04 +04:00
|
|
|
std::string libflags;
|
|
|
|
this->LocalGenerator->GetStaticLibraryFlags(libflags,
|
|
|
|
cmSystemTools::UpperCase(config), this->Target);
|
|
|
|
if(!libflags.empty())
|
2009-06-28 16:59:56 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<Lib>\n", 2);
|
2009-09-30 00:38:43 +04:00
|
|
|
cmVisualStudioGeneratorOptions
|
2011-11-11 02:17:41 +04:00
|
|
|
libOptions(this->LocalGenerator,
|
2009-09-30 00:38:43 +04:00
|
|
|
cmVisualStudioGeneratorOptions::Linker,
|
2014-06-03 21:34:21 +04:00
|
|
|
this->GetLibFlagTable(), 0, this);
|
2013-07-10 21:11:04 +04:00
|
|
|
libOptions.Parse(libflags.c_str());
|
2009-06-28 16:59:56 +04:00
|
|
|
libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
|
2012-08-13 21:42:58 +04:00
|
|
|
libOptions.OutputFlagMap(*this->BuildFileStream, " ");
|
2009-06-28 16:59:56 +04:00
|
|
|
this->WriteString("</Lib>\n", 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
|
|
|
|
{
|
|
|
|
if(this->Target->GetType() == cmTarget::EXECUTABLE ||
|
|
|
|
this->Target->GetType() == cmTarget::SHARED_LIBRARY ||
|
|
|
|
this->Target->GetType() == cmTarget::MODULE_LIBRARY)
|
|
|
|
{
|
|
|
|
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->ComputeLinkOptions(*i))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2009-06-28 16:59:56 +04:00
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
bool
|
|
|
|
cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2012-10-26 18:16:45 +04:00
|
|
|
cmsys::auto_ptr<Options> pOptions(
|
|
|
|
new Options(this->LocalGenerator, Options::Linker,
|
2014-06-03 21:34:21 +04:00
|
|
|
this->GetLinkFlagTable(), 0, this));
|
2012-10-26 18:16:45 +04:00
|
|
|
Options& linkOptions = *pOptions;
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2014-02-04 06:20:56 +04:00
|
|
|
const std::string& linkLanguage =
|
2009-07-08 21:04:04 +04:00
|
|
|
this->Target->GetLinkerLanguage(config.c_str());
|
2014-02-04 06:20:56 +04:00
|
|
|
if(linkLanguage.empty())
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
cmSystemTools::Error
|
2013-06-21 15:51:58 +04:00
|
|
|
("CMake can not determine linker language for target: ",
|
2009-07-14 00:58:24 +04:00
|
|
|
this->Name.c_str());
|
2012-10-26 18:16:45 +04:00
|
|
|
return false;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string CONFIG = cmSystemTools::UpperCase(config);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
const char* linkType = "SHARED";
|
|
|
|
if(this->Target->GetType() == cmTarget::MODULE_LIBRARY)
|
|
|
|
{
|
|
|
|
linkType = "MODULE";
|
|
|
|
}
|
|
|
|
if(this->Target->GetType() == cmTarget::EXECUTABLE)
|
|
|
|
{
|
|
|
|
linkType = "EXE";
|
|
|
|
}
|
|
|
|
std::string flags;
|
|
|
|
std::string linkFlagVarBase = "CMAKE_";
|
|
|
|
linkFlagVarBase += linkType;
|
|
|
|
linkFlagVarBase += "_LINKER_FLAGS";
|
|
|
|
flags += " ";
|
|
|
|
flags += this->
|
|
|
|
Target->GetMakefile()->GetRequiredDefinition(linkFlagVarBase.c_str());
|
|
|
|
std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
|
|
|
|
flags += " ";
|
|
|
|
flags += this->
|
|
|
|
Target->GetMakefile()->GetRequiredDefinition(linkFlagVar.c_str());
|
|
|
|
const char* targetLinkFlags = this->Target->GetProperty("LINK_FLAGS");
|
|
|
|
if(targetLinkFlags)
|
|
|
|
{
|
|
|
|
flags += " ";
|
|
|
|
flags += targetLinkFlags;
|
|
|
|
}
|
2010-05-28 19:00:31 +04:00
|
|
|
std::string flagsProp = "LINK_FLAGS_";
|
|
|
|
flagsProp += CONFIG;
|
|
|
|
if(const char* flagsConfig = this->Target->GetProperty(flagsProp.c_str()))
|
|
|
|
{
|
|
|
|
flags += " ";
|
|
|
|
flags += flagsConfig;
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string standardLibsVar = "CMAKE_";
|
|
|
|
standardLibsVar += linkLanguage;
|
|
|
|
standardLibsVar += "_STANDARD_LIBRARIES";
|
2012-08-13 21:42:58 +04:00
|
|
|
std::string
|
2009-06-26 00:41:57 +04:00
|
|
|
libs = this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
|
|
|
|
// Remove trailing spaces from libs
|
|
|
|
std::string::size_type pos = libs.size()-1;
|
|
|
|
if(libs.size() != 0)
|
|
|
|
{
|
|
|
|
while(libs[pos] == ' ')
|
|
|
|
{
|
|
|
|
pos--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(pos != libs.size()-1)
|
|
|
|
{
|
|
|
|
libs = libs.substr(0, pos+1);
|
|
|
|
}
|
|
|
|
// Replace spaces in libs with ;
|
|
|
|
cmSystemTools::ReplaceString(libs, " ", ";");
|
2014-07-23 19:13:13 +04:00
|
|
|
std::vector<std::string> libVec;
|
|
|
|
cmSystemTools::ExpandListArgument(libs, libVec);
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
cmComputeLinkInformation* pcli =
|
2012-11-05 19:14:02 +04:00
|
|
|
this->Target->GetLinkInformation(config.c_str());
|
2009-06-26 00:41:57 +04:00
|
|
|
if(!pcli)
|
|
|
|
{
|
|
|
|
cmSystemTools::Error
|
2013-06-21 15:51:58 +04:00
|
|
|
("CMake can not compute cmComputeLinkInformation for target: ",
|
2009-07-14 00:58:24 +04:00
|
|
|
this->Name.c_str());
|
2012-10-26 18:16:45 +04:00
|
|
|
return false;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
// add the libraries for the target to libs string
|
|
|
|
cmComputeLinkInformation& cli = *pcli;
|
2014-07-23 19:13:13 +04:00
|
|
|
this->AddLibraries(cli, libVec);
|
|
|
|
linkOptions.AddFlag("AdditionalDependencies", libVec);
|
2009-06-26 00:41:57 +04:00
|
|
|
|
|
|
|
std::vector<std::string> const& ldirs = cli.GetDirectories();
|
2014-07-23 19:13:13 +04:00
|
|
|
std::vector<std::string> linkDirs;
|
2009-06-26 00:41:57 +04:00
|
|
|
for(std::vector<std::string>::const_iterator d = ldirs.begin();
|
|
|
|
d != ldirs.end(); ++d)
|
|
|
|
{
|
2009-07-10 17:12:39 +04:00
|
|
|
// first just full path
|
2014-07-23 19:13:13 +04:00
|
|
|
linkDirs.push_back(*d);
|
2009-07-10 17:12:39 +04:00
|
|
|
// next path with configuration type Debug, Release, etc
|
2014-07-23 19:13:13 +04:00
|
|
|
linkDirs.push_back(*d + "/$(Configuration)");
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2014-07-23 19:13:13 +04:00
|
|
|
linkDirs.push_back("%(AdditionalLibraryDirectories)");
|
|
|
|
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs);
|
2014-06-05 20:56:39 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string targetName;
|
|
|
|
std::string targetNameSO;
|
|
|
|
std::string targetNameFull;
|
|
|
|
std::string targetNameImport;
|
|
|
|
std::string targetNamePDB;
|
|
|
|
if(this->Target->GetType() == cmTarget::EXECUTABLE)
|
|
|
|
{
|
|
|
|
this->Target->GetExecutableNames(targetName, targetNameFull,
|
2012-08-13 21:42:58 +04:00
|
|
|
targetNameImport, targetNamePDB,
|
2009-06-26 00:41:57 +04:00
|
|
|
config.c_str());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this->Target->GetLibraryNames(targetName, targetNameSO, targetNameFull,
|
2012-08-13 21:42:58 +04:00
|
|
|
targetNameImport, targetNamePDB,
|
2009-06-26 00:41:57 +04:00
|
|
|
config.c_str());
|
|
|
|
}
|
2009-10-23 19:33:27 +04:00
|
|
|
|
2014-06-10 18:13:00 +04:00
|
|
|
if(this->MSTools)
|
2014-06-05 21:18:09 +04:00
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
linkOptions.AddFlag("Version", "");
|
2014-06-05 21:18:09 +04:00
|
|
|
|
2014-06-10 18:13:00 +04:00
|
|
|
if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") )
|
|
|
|
{
|
|
|
|
linkOptions.AddFlag("SubSystem", "Windows");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
linkOptions.AddFlag("SubSystem", "Console");
|
|
|
|
}
|
2014-06-05 21:18:09 +04:00
|
|
|
|
2014-06-10 18:13:00 +04:00
|
|
|
if(const char* stackVal =
|
|
|
|
this->Makefile->GetDefinition("CMAKE_"+linkLanguage+"_STACK_SIZE"))
|
|
|
|
{
|
|
|
|
linkOptions.AddFlag("StackReserveSize", stackVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(linkOptions.IsDebug() || flags.find("/debug") != flags.npos)
|
|
|
|
{
|
|
|
|
linkOptions.AddFlag("GenerateDebugInformation", "true");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
linkOptions.AddFlag("GenerateDebugInformation", "false");
|
|
|
|
}
|
|
|
|
std::string pdb = this->Target->GetPDBDirectory(config.c_str());
|
|
|
|
pdb += "/";
|
|
|
|
pdb += targetNamePDB;
|
|
|
|
std::string imLib = this->Target->GetDirectory(config.c_str(), true);
|
|
|
|
imLib += "/";
|
|
|
|
imLib += targetNameImport;
|
|
|
|
|
|
|
|
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
|
|
|
|
linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
|
2014-06-05 21:18:09 +04:00
|
|
|
}
|
2009-10-23 19:33:27 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
linkOptions.Parse(flags.c_str());
|
2014-06-10 18:13:00 +04:00
|
|
|
|
|
|
|
if(this->MSTools)
|
2009-09-30 00:39:07 +04:00
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
std::string def = this->GeneratorTarget->GetModuleDefinitionFile("");
|
|
|
|
if(!def.empty())
|
|
|
|
{
|
|
|
|
linkOptions.AddFlag("ModuleDefinitionFile", def.c_str());
|
|
|
|
}
|
2014-07-31 22:03:03 +04:00
|
|
|
linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries",
|
|
|
|
"%(IgnoreSpecificDefaultLibraries)");
|
2009-09-30 00:39:07 +04:00
|
|
|
}
|
2011-02-09 20:59:09 +03:00
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
this->LinkOptions[config] = pOptions.release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
void
|
|
|
|
cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& config)
|
|
|
|
{
|
|
|
|
if(this->Target->GetType() == cmTarget::STATIC_LIBRARY
|
|
|
|
|| this->Target->GetType() > cmTarget::MODULE_LIBRARY)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Options& linkOptions = *(this->LinkOptions[config]);
|
|
|
|
this->WriteString("<Link>\n", 2);
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
linkOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
|
|
|
|
linkOptions.OutputFlagMap(*this->BuildFileStream, " ");
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</Link>\n", 2);
|
2009-10-21 00:38:37 +04:00
|
|
|
if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target))
|
|
|
|
{
|
|
|
|
this->WriteString("<ProjectReference>\n", 2);
|
|
|
|
this->WriteString(
|
|
|
|
" <LinkLibraryDependencies>false</LinkLibraryDependencies>\n", 2);
|
|
|
|
this->WriteString("</ProjectReference>\n", 2);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::AddLibraries(
|
|
|
|
cmComputeLinkInformation& cli,
|
2014-07-23 19:13:13 +04:00
|
|
|
std::vector<std::string>& libVec)
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2009-06-26 00:41:57 +04:00
|
|
|
typedef cmComputeLinkInformation::ItemVector ItemVector;
|
|
|
|
ItemVector libs = cli.GetItems();
|
|
|
|
for(ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l)
|
|
|
|
{
|
|
|
|
if(l->IsPath)
|
|
|
|
{
|
|
|
|
std::string path = this->LocalGenerator->
|
|
|
|
Convert(l->Value.c_str(),
|
|
|
|
cmLocalGenerator::START_OUTPUT,
|
|
|
|
cmLocalGenerator::UNCHANGED);
|
2009-11-19 00:14:36 +03:00
|
|
|
this->ConvertToWindowsSlash(path);
|
2014-07-23 19:13:13 +04:00
|
|
|
libVec.push_back(path);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2012-11-02 18:47:40 +04:00
|
|
|
else if (!l->Target
|
|
|
|
|| l->Target->GetType() != cmTarget::INTERFACE_LIBRARY)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2014-07-23 19:13:13 +04:00
|
|
|
libVec.push_back(l->Value);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::
|
2009-06-26 06:53:02 +04:00
|
|
|
WriteMidlOptions(std::string const& /*config*/,
|
2009-06-26 00:41:57 +04:00
|
|
|
std::vector<std::string> const & includes)
|
|
|
|
{
|
2014-06-10 18:13:00 +04:00
|
|
|
if(!this->MSTools)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-04-16 18:02:47 +04:00
|
|
|
// This processes *any* of the .idl files specified in the project's file
|
|
|
|
// list (and passed as the item metadata %(Filename) expressing the rule
|
|
|
|
// input filename) into output files at the per-config *build* dir
|
|
|
|
// ($(IntDir)) each.
|
|
|
|
//
|
|
|
|
// IOW, this MIDL section is intended to provide a fully generic syntax
|
|
|
|
// content suitable for most cases (read: if you get errors, then it's quite
|
|
|
|
// probable that the error is on your side of the .idl setup).
|
|
|
|
//
|
|
|
|
// Also, note that the marked-as-generated _i.c file in the Visual Studio
|
|
|
|
// generator case needs to be referred to as $(IntDir)\foo_i.c at the
|
|
|
|
// project's file list, otherwise the compiler-side processing won't pick it
|
|
|
|
// up (for non-directory form, it ends up looking in project binary dir
|
|
|
|
// only). Perhaps there's something to be done to make this more automatic
|
|
|
|
// on the CMake side?
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<Midl>\n", 2);
|
2014-08-13 22:09:24 +04:00
|
|
|
this->WriteString("<AdditionalIncludeDirectories>", 3);
|
|
|
|
for(std::vector<std::string>::const_iterator i = includes.begin();
|
|
|
|
i != includes.end(); ++i)
|
|
|
|
{
|
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(*i) << ";";
|
|
|
|
}
|
|
|
|
this->WriteString("%(AdditionalIncludeDirectories)"
|
|
|
|
"</AdditionalIncludeDirectories>\n", 0);
|
2011-01-05 02:51:15 +03:00
|
|
|
this->WriteString("<OutputDirectory>$(IntDir)</OutputDirectory>\n", 3);
|
|
|
|
this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3);
|
|
|
|
this->WriteString(
|
|
|
|
"<TypeLibraryName>%(Filename).tlb</TypeLibraryName>\n", 3);
|
|
|
|
this->WriteString(
|
|
|
|
"<InterfaceIdentifierFileName>"
|
|
|
|
"%(Filename)_i.c</InterfaceIdentifierFileName>\n", 3);
|
|
|
|
this->WriteString("<ProxyFileName>%(Filename)_p.c</ProxyFileName>\n",3);
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</Midl>\n", 2);
|
|
|
|
}
|
2011-01-05 02:51:15 +03:00
|
|
|
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
|
2011-01-05 02:51:15 +03:00
|
|
|
{
|
2009-06-26 00:41:57 +04:00
|
|
|
std::vector<std::string> *configs =
|
|
|
|
static_cast<cmGlobalVisualStudio7Generator *>
|
|
|
|
(this->GlobalGenerator)->GetConfigurations();
|
|
|
|
for(std::vector<std::string>::iterator i = configs->begin();
|
|
|
|
i != configs->end(); ++i)
|
|
|
|
{
|
2012-10-15 12:42:42 +04:00
|
|
|
std::vector<std::string> includes;
|
|
|
|
this->LocalGenerator->GetIncludeDirectories(includes,
|
|
|
|
this->GeneratorTarget,
|
|
|
|
"C", i->c_str());
|
2014-08-13 21:24:48 +04:00
|
|
|
for(std::vector<std::string>::iterator ii = includes.begin();
|
|
|
|
ii != includes.end(); ++ii)
|
|
|
|
{
|
|
|
|
this->ConvertToWindowsSlash(*ii);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1);
|
|
|
|
*this->BuildFileStream << "\n";
|
|
|
|
// output cl compile flags <ClCompile></ClCompile>
|
2012-03-12 18:55:07 +04:00
|
|
|
if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
this->WriteClOptions(*i, includes);
|
|
|
|
// output rc compile flags <ResourceCompile></ResourceCompile>
|
|
|
|
this->WriteRCOptions(*i, includes);
|
|
|
|
}
|
|
|
|
// output midl flags <Midl></Midl>
|
|
|
|
this->WriteMidlOptions(*i, includes);
|
2009-07-10 17:12:39 +04:00
|
|
|
// write events
|
|
|
|
this->WriteEvents(*i);
|
2012-08-13 21:42:58 +04:00
|
|
|
// output link flags <Link></Link>
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteLinkOptions(*i);
|
2012-08-13 21:42:58 +04:00
|
|
|
// output lib flags <Lib></Lib>
|
2009-06-28 16:59:56 +04:00
|
|
|
this->WriteLibOptions(*i);
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ItemDefinitionGroup>\n", 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-13 21:42:58 +04:00
|
|
|
void
|
2009-07-10 17:12:39 +04:00
|
|
|
cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
|
|
|
|
{
|
|
|
|
this->WriteEvent("PreLinkEvent",
|
|
|
|
this->Target->GetPreLinkCommands(), configName);
|
|
|
|
this->WriteEvent("PreBuildEvent",
|
|
|
|
this->Target->GetPreBuildCommands(), configName);
|
|
|
|
this->WriteEvent("PostBuildEvent",
|
|
|
|
this->Target->GetPostBuildCommands(), configName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteEvent(
|
|
|
|
const char* name,
|
2013-11-19 14:05:47 +04:00
|
|
|
std::vector<cmCustomCommand> const& commands,
|
2009-07-10 17:12:39 +04:00
|
|
|
std::string const& configName)
|
|
|
|
{
|
|
|
|
if(commands.size() == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this->WriteString("<", 2);
|
|
|
|
(*this->BuildFileStream ) << name << ">\n";
|
|
|
|
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
|
|
|
|
std::string script;
|
|
|
|
const char* pre = "";
|
|
|
|
std::string comment;
|
2013-11-19 14:05:47 +04:00
|
|
|
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
|
2009-07-10 17:12:39 +04:00
|
|
|
i != commands.end(); ++i)
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2014-03-10 23:47:19 +04:00
|
|
|
cmCustomCommandGenerator ccg(*i, configName, this->Makefile);
|
2009-07-10 17:12:39 +04:00
|
|
|
comment += pre;
|
2014-03-10 23:47:19 +04:00
|
|
|
comment += lg->ConstructComment(ccg);
|
2009-07-10 17:12:39 +04:00
|
|
|
script += pre;
|
|
|
|
pre = "\n";
|
2014-03-10 23:47:19 +04:00
|
|
|
script += cmVS10EscapeXML(lg->ConstructScript(ccg));
|
2009-07-10 17:12:39 +04:00
|
|
|
}
|
2010-10-02 00:12:00 +04:00
|
|
|
comment = cmVS10EscapeComment(comment);
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<Message>",3);
|
2010-10-02 00:12:00 +04:00
|
|
|
(*this->BuildFileStream ) << cmVS10EscapeXML(comment) << "</Message>\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<Command>", 3);
|
|
|
|
(*this->BuildFileStream ) << script;
|
|
|
|
(*this->BuildFileStream ) << "</Command>" << "\n";
|
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream ) << name << ">\n";
|
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
|
|
|
|
{
|
2010-10-07 17:54:24 +04:00
|
|
|
cmGlobalGenerator::TargetDependSet const& unordered
|
2009-07-10 17:12:39 +04:00
|
|
|
= this->GlobalGenerator->GetTargetDirectDepends(*this->Target);
|
2010-10-07 17:54:24 +04:00
|
|
|
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
|
|
|
|
OrderedTargetDependSet;
|
|
|
|
OrderedTargetDependSet depends(unordered);
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2010-10-07 17:54:24 +04:00
|
|
|
for( OrderedTargetDependSet::const_iterator i = depends.begin();
|
2009-07-10 17:12:39 +04:00
|
|
|
i != depends.end(); ++i)
|
|
|
|
{
|
2013-12-10 18:16:23 +04:00
|
|
|
cmTarget const* dt = *i;
|
2012-11-02 18:47:40 +04:00
|
|
|
if(dt->GetType() == cmTarget::INTERFACE_LIBRARY)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2011-08-04 01:24:43 +04:00
|
|
|
// skip fortran targets as they can not be processed by MSBuild
|
|
|
|
// the only reference will be in the .sln file
|
|
|
|
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
|
|
|
|
->TargetIsFortranOnly(*dt))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<ProjectReference Include=\"", 2);
|
|
|
|
cmMakefile* mf = dt->GetMakefile();
|
2009-07-14 00:58:24 +04:00
|
|
|
std::string name = dt->GetName();
|
|
|
|
std::string path;
|
2009-07-14 22:16:46 +04:00
|
|
|
const char* p = dt->GetProperty("EXTERNAL_MSPROJECT");
|
|
|
|
if(p)
|
2009-07-14 00:58:24 +04:00
|
|
|
{
|
2009-07-14 22:16:46 +04:00
|
|
|
path = p;
|
2009-07-14 00:58:24 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path = mf->GetStartOutputDirectory();
|
|
|
|
path += "/";
|
|
|
|
path += dt->GetName();
|
|
|
|
path += ".vcxproj";
|
|
|
|
}
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<Project>", 3);
|
2012-08-13 21:42:58 +04:00
|
|
|
(*this->BuildFileStream)
|
2009-07-14 00:58:24 +04:00
|
|
|
<< this->GlobalGenerator->GetGUID(name.c_str())
|
2009-07-10 17:12:39 +04:00
|
|
|
<< "</Project>\n";
|
|
|
|
this->WriteString("</ProjectReference>\n", 2);
|
|
|
|
}
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2013-04-29 18:48:22 +04:00
|
|
|
|
|
|
|
bool cmVisualStudio10TargetGenerator::
|
|
|
|
IsResxHeader(const std::string& headerFile)
|
|
|
|
{
|
2013-11-10 14:22:44 +04:00
|
|
|
std::set<std::string> expectedResxHeaders;
|
2014-02-13 20:25:00 +04:00
|
|
|
this->GeneratorTarget->GetExpectedResxHeaders(expectedResxHeaders, "");
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2013-11-10 14:22:44 +04:00
|
|
|
std::set<std::string>::const_iterator it =
|
|
|
|
expectedResxHeaders.find(headerFile);
|
|
|
|
return it != expectedResxHeaders.end();
|
2013-04-29 18:48:22 +04:00
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
|
|
|
|
{
|
|
|
|
bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone();
|
|
|
|
bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore();
|
|
|
|
std::string const& v = this->GlobalGenerator->GetSystemVersion();
|
|
|
|
if(isWindowsPhone || isWindowsStore)
|
|
|
|
{
|
|
|
|
this->WriteString("<ApplicationType>", 2);
|
|
|
|
(*this->BuildFileStream) << (isWindowsPhone ?
|
|
|
|
"Windows Phone" : "Windows Store")
|
|
|
|
<< "</ApplicationType>\n";
|
|
|
|
this->WriteString("<ApplicationTypeRevision>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(v)
|
|
|
|
<< "</ApplicationTypeRevision>\n";
|
2014-07-31 21:24:08 +04:00
|
|
|
if(v == "8.1")
|
|
|
|
{
|
|
|
|
// Visual Studio 12.0 is necessary for building 8.1 apps
|
|
|
|
this->WriteString("<MinimumVisualStudioVersion>12.0"
|
|
|
|
"</MinimumVisualStudioVersion>\n", 2);
|
|
|
|
}
|
|
|
|
else if (v == "8.0")
|
|
|
|
{
|
|
|
|
// Visual Studio 11.0 is necessary for building 8.0 apps
|
|
|
|
this->WriteString("<MinimumVisualStudioVersion>11.0"
|
|
|
|
"</MinimumVisualStudioVersion>\n", 2);
|
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
}
|
2014-08-05 23:00:09 +04:00
|
|
|
if (this->Platform == "ARM")
|
|
|
|
{
|
|
|
|
this->WriteString("<WindowsSDKDesktopARMSupport>true"
|
|
|
|
"</WindowsSDKDesktopARMSupport>", 2);
|
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
}
|