2016-09-27 22:01:08 +03:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmVisualStudio10TargetGenerator.h"
|
2016-04-29 16:40:20 +03:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmComputeLinkInformation.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmCustomCommandGenerator.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmGeneratedFileStream.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmGeneratorTarget.h"
|
|
|
|
#include "cmGlobalVisualStudio10Generator.h"
|
|
|
|
#include "cmLocalVisualStudio7Generator.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
#include "cmMakefile.h"
|
|
|
|
#include "cmSourceFile.h"
|
|
|
|
#include "cmVS10CLFlagTable.h"
|
2009-06-28 16:59:56 +04:00
|
|
|
#include "cmVS10LibFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS10LinkFlagTable.h"
|
2014-08-13 19:20:20 +04:00
|
|
|
#include "cmVS10MASMFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS10RCFlagTable.h"
|
2012-08-22 18:49:47 +04:00
|
|
|
#include "cmVS11CLFlagTable.h"
|
|
|
|
#include "cmVS11LibFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS11LinkFlagTable.h"
|
2014-08-13 19:20:20 +04:00
|
|
|
#include "cmVS11MASMFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS11RCFlagTable.h"
|
2013-06-29 00:28:53 +04:00
|
|
|
#include "cmVS12CLFlagTable.h"
|
|
|
|
#include "cmVS12LibFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS12LinkFlagTable.h"
|
2014-08-13 19:20:20 +04:00
|
|
|
#include "cmVS12MASMFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS12RCFlagTable.h"
|
2014-06-24 23:29:08 +04:00
|
|
|
#include "cmVS14CLFlagTable.h"
|
|
|
|
#include "cmVS14LibFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS14LinkFlagTable.h"
|
2014-08-13 19:20:20 +04:00
|
|
|
#include "cmVS14MASMFlagTable.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include "cmVS14RCFlagTable.h"
|
|
|
|
#include "cmVisualStudioGeneratorOptions.h"
|
|
|
|
#include "windows.h"
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2016-06-28 17:17:52 +03:00
|
|
|
#include <cm_auto_ptr.hxx>
|
2009-10-23 19:34:37 +04:00
|
|
|
|
2016-08-04 18:40:09 +03:00
|
|
|
static std::string const kWINDOWS_7_1_SDK = "Windows7.1SDK";
|
|
|
|
|
2014-06-03 21:34:21 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
|
2012-08-22 18:49:47 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
|
|
|
cmGlobalVisualStudioGenerator::VSVersion v =
|
|
|
|
this->LocalGenerator->GetVersion();
|
|
|
|
if (v >= cmGlobalVisualStudioGenerator::VS14) {
|
|
|
|
return cmVS14CLFlagTable;
|
|
|
|
} else if (v >= cmGlobalVisualStudioGenerator::VS12) {
|
|
|
|
return cmVS12CLFlagTable;
|
|
|
|
} else if (v == cmGlobalVisualStudioGenerator::VS11) {
|
|
|
|
return cmVS11CLFlagTable;
|
|
|
|
} else {
|
|
|
|
return cmVS10CLFlagTable;
|
2014-06-10 18:13:00 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
return 0;
|
2012-08-22 18:49:47 +04:00
|
|
|
}
|
|
|
|
|
2014-07-10 03:01:18 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetRcFlagTable() const
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
|
|
|
cmGlobalVisualStudioGenerator::VSVersion v =
|
|
|
|
this->LocalGenerator->GetVersion();
|
|
|
|
if (v >= cmGlobalVisualStudioGenerator::VS14) {
|
|
|
|
return cmVS14RCFlagTable;
|
|
|
|
} else if (v >= cmGlobalVisualStudioGenerator::VS12) {
|
|
|
|
return cmVS12RCFlagTable;
|
|
|
|
} else if (v == cmGlobalVisualStudioGenerator::VS11) {
|
|
|
|
return cmVS11RCFlagTable;
|
|
|
|
} else {
|
|
|
|
return cmVS10RCFlagTable;
|
2014-06-10 18:13:00 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
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
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
|
|
|
cmGlobalVisualStudioGenerator::VSVersion v =
|
|
|
|
this->LocalGenerator->GetVersion();
|
|
|
|
if (v >= cmGlobalVisualStudioGenerator::VS14) {
|
|
|
|
return cmVS14LibFlagTable;
|
|
|
|
} else if (v >= cmGlobalVisualStudioGenerator::VS12) {
|
|
|
|
return cmVS12LibFlagTable;
|
|
|
|
} else if (v == cmGlobalVisualStudioGenerator::VS11) {
|
|
|
|
return cmVS11LibFlagTable;
|
|
|
|
} else {
|
|
|
|
return cmVS10LibFlagTable;
|
2014-06-10 18:13:00 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
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
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
|
|
|
cmGlobalVisualStudioGenerator::VSVersion v =
|
|
|
|
this->LocalGenerator->GetVersion();
|
|
|
|
if (v >= cmGlobalVisualStudioGenerator::VS14) {
|
|
|
|
return cmVS14LinkFlagTable;
|
|
|
|
} else if (v >= cmGlobalVisualStudioGenerator::VS12) {
|
|
|
|
return cmVS12LinkFlagTable;
|
|
|
|
} else if (v == cmGlobalVisualStudioGenerator::VS11) {
|
|
|
|
return cmVS11LinkFlagTable;
|
|
|
|
} else {
|
|
|
|
return cmVS10LinkFlagTable;
|
2014-06-10 18:13:00 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
return 0;
|
2012-08-22 18:49:47 +04:00
|
|
|
}
|
|
|
|
|
2014-08-13 19:20:20 +04:00
|
|
|
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetMasmFlagTable() const
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
|
|
|
cmGlobalVisualStudioGenerator::VSVersion v =
|
|
|
|
this->LocalGenerator->GetVersion();
|
|
|
|
if (v >= cmGlobalVisualStudioGenerator::VS14) {
|
|
|
|
return cmVS14MASMFlagTable;
|
|
|
|
} else if (v >= cmGlobalVisualStudioGenerator::VS12) {
|
|
|
|
return cmVS12MASMFlagTable;
|
|
|
|
} else if (v == cmGlobalVisualStudioGenerator::VS11) {
|
|
|
|
return cmVS11MASMFlagTable;
|
|
|
|
} else {
|
|
|
|
return cmVS10MASMFlagTable;
|
2014-08-13 19:20:20 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-13 19:20:20 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::string::iterator c = comment.begin(); c != comment.end(); ++c) {
|
|
|
|
switch (*c) {
|
|
|
|
case '\r':
|
|
|
|
break;
|
|
|
|
case '\n':
|
|
|
|
echoable += '\t';
|
|
|
|
break;
|
2010-10-02 00:12:00 +04:00
|
|
|
case '"': /* no break */
|
|
|
|
case '|': /* no break */
|
|
|
|
case '&': /* no break */
|
|
|
|
case '<': /* no break */
|
|
|
|
case '>': /* no break */
|
2016-05-16 17:34:04 +03:00
|
|
|
case '^':
|
|
|
|
echoable += '^'; /* no break */
|
|
|
|
default:
|
|
|
|
echoable += *c;
|
|
|
|
break;
|
2010-10-02 00:12:00 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-10-02 00:12:00 +04:00
|
|
|
return echoable;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVisualStudio10TargetGenerator::cmVisualStudio10TargetGenerator(
|
|
|
|
cmGeneratorTarget* target, cmGlobalVisualStudio10Generator* gg)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
this->GlobalGenerator = gg;
|
2015-10-22 19:27:57 +03:00
|
|
|
this->GeneratorTarget = target;
|
|
|
|
this->Makefile = target->Target->GetMakefile();
|
2015-05-20 20:55:21 +03:00
|
|
|
this->Makefile->GetConfigurations(this->Configurations);
|
2012-08-13 21:42:58 +04:00
|
|
|
this->LocalGenerator =
|
2016-05-16 17:34:04 +03:00
|
|
|
(cmLocalVisualStudio7Generator*)this->GeneratorTarget->GetLocalGenerator();
|
2015-10-16 21:09:43 +03:00
|
|
|
this->Name = this->GeneratorTarget->GetName();
|
2009-07-14 22:16:46 +04:00
|
|
|
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
|
2009-10-22 16:24:11 +04:00
|
|
|
this->Platform = gg->GetPlatformName();
|
2014-06-10 19:33:19 +04:00
|
|
|
this->NsightTegra = gg->IsNsightTegra();
|
2016-08-26 09:28:48 +03:00
|
|
|
for (int i = 0; i < 4; ++i) {
|
2014-09-26 22:57:30 +04:00
|
|
|
this->NsightTegraVersion[i] = 0;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-08-26 09:28:48 +03:00
|
|
|
sscanf(gg->GetNsightTegraVersion().c_str(), "%u.%u.%u.%u",
|
|
|
|
&this->NsightTegraVersion[0], &this->NsightTegraVersion[1],
|
|
|
|
&this->NsightTegraVersion[2], &this->NsightTegraVersion[3]);
|
2014-06-10 19:33:19 +04:00
|
|
|
this->MSTools = !this->NsightTegra;
|
2014-08-22 17:27:00 +04:00
|
|
|
this->TargetCompileAsWinRT = false;
|
2009-07-14 00:58:24 +04:00
|
|
|
this->BuildFileStream = 0;
|
2014-08-15 01:52:53 +04:00
|
|
|
this->IsMissingFiles = false;
|
|
|
|
this->DefaultArtifactDir =
|
2015-09-25 01:13:20 +03:00
|
|
|
this->LocalGenerator->GetCurrentBinaryDirectory() + std::string("/") +
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (OptionsMap::iterator i = this->ClOptions.begin();
|
|
|
|
i != this->ClOptions.end(); ++i) {
|
2009-10-23 19:34:37 +04:00
|
|
|
delete i->second;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
for (OptionsMap::iterator i = this->LinkOptions.begin();
|
|
|
|
i != this->LinkOptions.end(); ++i) {
|
2012-10-26 18:16:45 +04:00
|
|
|
delete i->second;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!this->BuildFileStream) {
|
2009-07-14 00:58:24 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (this->BuildFileStream->Close()) {
|
|
|
|
this->GlobalGenerator->FileReplacedDuringGenerate(this->PathToVcxproj);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
delete this->BuildFileStream;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* tag, const std::string& config, int indentLevel,
|
|
|
|
const char* attribute, const char* end, std::ostream* stream)
|
2009-06-26 00:41:57 +04:00
|
|
|
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!stream) {
|
2009-06-26 00:41:57 +04:00
|
|
|
stream = this->BuildFileStream;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
stream->fill(' ');
|
2016-05-16 17:34:04 +03:00
|
|
|
stream->width(indentLevel * 2);
|
|
|
|
(*stream) << "";
|
|
|
|
(*stream) << "<" << tag << " Condition=\"'$(Configuration)|$(Platform)'=='";
|
|
|
|
(*stream) << config << "|" << this->Platform << "'\"";
|
|
|
|
if (attribute) {
|
|
|
|
(*stream) << attribute;
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// close the tag
|
2016-05-16 17:34:04 +03:00
|
|
|
(*stream) << ">";
|
|
|
|
if (end) {
|
|
|
|
(*stream) << end;
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteString(const char* line,
|
|
|
|
int indentLevel)
|
|
|
|
{
|
|
|
|
this->BuildFileStream->fill(' ');
|
2016-05-16 17:34:04 +03:00
|
|
|
this->BuildFileStream->width(indentLevel * 2);
|
2009-06-26 00:41:57 +04:00
|
|
|
// write an empty string to get the fill level indent to print
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "";
|
|
|
|
(*this->BuildFileStream) << line;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
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
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::INTERFACE_LIBRARY ||
|
|
|
|
this->GeneratorTarget->GetProperty("EXTERNAL_MSPROJECT")) {
|
2009-07-14 22:16:46 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// Tell the global generator the name of the project file
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME",
|
|
|
|
this->Name.c_str());
|
2015-10-22 19:27:57 +03:00
|
|
|
this->GeneratorTarget->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
|
2016-05-16 17:34:04 +03:00
|
|
|
".vcxproj");
|
|
|
|
if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
|
|
|
|
if (!this->ComputeClOptions()) {
|
2010-09-30 16:48:38 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!this->ComputeRcOptions()) {
|
2014-07-10 03:01:18 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!this->ComputeMasmOptions()) {
|
2014-08-13 19:20:20 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!this->ComputeLinkOptions()) {
|
2012-10-26 18:16:45 +04:00
|
|
|
return;
|
2009-10-23 19:34:37 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
std::string path = this->LocalGenerator->GetCurrentBinaryDirectory();
|
2009-06-26 00:41:57 +04:00
|
|
|
path += "/";
|
2009-07-14 00:58:24 +04:00
|
|
|
path += this->Name;
|
2009-06-26 00:41:57 +04:00
|
|
|
path += ".vcxproj";
|
2016-05-16 17:34:04 +03:00
|
|
|
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
|
2016-05-16 17:34:04 +03:00
|
|
|
char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
|
2009-06-26 00:41:57 +04:00
|
|
|
this->BuildFileStream->write(magic, 3);
|
2013-08-20 22:59:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
// get the tools version to use
|
2013-08-20 22:59:59 +04:00
|
|
|
const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string project_defaults = "<?xml version=\"1.0\" encoding=\"" +
|
2014-03-14 18:48:42 +04:00
|
|
|
this->GlobalGenerator->Encoding() + "\"?>\n";
|
2013-08-20 22:59:59 +04:00
|
|
|
project_defaults.append("<Project DefaultTargets=\"Build\" ToolsVersion=\"");
|
2016-05-16 17:34:04 +03:00
|
|
|
project_defaults.append(toolsVer + "\" ");
|
2013-08-20 22:59:59 +04:00
|
|
|
project_defaults.append(
|
2016-05-16 17:34:04 +03:00
|
|
|
"xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
|
|
|
|
this->WriteString(project_defaults.c_str(), 0);
|
2013-08-20 22:59:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NsightTegra) {
|
2014-06-10 19:33:19 +04:00
|
|
|
this->WriteString("<PropertyGroup Label=\"NsightTegraProject\">\n", 1);
|
2015-06-25 20:15:06 +03:00
|
|
|
const int nsightTegraMajorVersion = this->NsightTegraVersion[0];
|
|
|
|
const int nsightTegraMinorVersion = this->NsightTegraVersion[1];
|
2016-05-16 17:34:04 +03:00
|
|
|
if (nsightTegraMajorVersion >= 2) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<NsightTegraProjectRevisionNumber>", 2);
|
|
|
|
if (nsightTegraMajorVersion > 3 ||
|
2016-05-16 17:34:04 +03:00
|
|
|
(nsightTegraMajorVersion == 3 && nsightTegraMinorVersion >= 1)) {
|
2015-06-25 20:15:06 +03:00
|
|
|
(*this->BuildFileStream) << "11";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-06-25 20:15:06 +03:00
|
|
|
// Nsight Tegra 2.0 uses project revision 9.
|
|
|
|
(*this->BuildFileStream) << "9";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
(*this->BuildFileStream) << "</NsightTegraProjectRevisionNumber>\n";
|
2014-09-26 22:57:30 +04:00
|
|
|
// Tell newer versions to upgrade silently when loading.
|
|
|
|
this->WriteString("<NsightTegraUpgradeOnceWithoutPrompt>"
|
|
|
|
"true"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</NsightTegraUpgradeOnceWithoutPrompt>\n",
|
|
|
|
2);
|
|
|
|
} else {
|
2014-09-26 22:57:30 +04:00
|
|
|
// Require Nsight Tegra 1.6 for JCompile support.
|
|
|
|
this->WriteString("<NsightTegraProjectRevisionNumber>"
|
|
|
|
"7"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</NsightTegraProjectRevisionNumber>\n",
|
|
|
|
2);
|
2014-06-10 19:33:19 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</PropertyGroup>\n", 1);
|
|
|
|
}
|
2014-06-10 19:33:19 +04:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteProjectConfigurations();
|
|
|
|
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
|
|
|
|
this->WriteString("<ProjectGUID>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools &&
|
|
|
|
this->GeneratorTarget->GetType() <= cmState::GLOBAL_TARGET) {
|
2014-07-31 21:22:35 +04:00
|
|
|
this->WriteApplicationTypeSettings();
|
2014-08-15 01:52:53 +04:00
|
|
|
this->VerifyNecessaryFiles();
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
|
2011-11-23 23:11:00 +04:00
|
|
|
const char* vsProjectTypes =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (vsProjectTypes) {
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("<ProjectTypes>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsProjectTypes)
|
|
|
|
<< "</ProjectTypes>\n";
|
|
|
|
}
|
2011-11-23 23:11:00 +04:00
|
|
|
|
2015-10-10 16:51:21 +03:00
|
|
|
const char* vsProjectName =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_SCC_PROJECTNAME");
|
2015-10-10 16:51:21 +03:00
|
|
|
const char* vsLocalPath =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_SCC_LOCALPATH");
|
2015-10-10 16:51:21 +03:00
|
|
|
const char* vsProvider =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_SCC_PROVIDER");
|
2011-06-14 17:45:52 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (vsProjectName && vsLocalPath && vsProvider) {
|
2011-06-14 17:45:52 +04:00
|
|
|
this->WriteString("<SccProjectName>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsProjectName)
|
|
|
|
<< "</SccProjectName>\n";
|
2011-06-14 17:45:52 +04:00
|
|
|
this->WriteString("<SccLocalPath>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsLocalPath)
|
|
|
|
<< "</SccLocalPath>\n";
|
2011-06-14 17:45:52 +04:00
|
|
|
this->WriteString("<SccProvider>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsProvider)
|
|
|
|
<< "</SccProvider>\n";
|
2011-11-01 04:04:08 +04:00
|
|
|
|
2015-10-10 16:51:21 +03:00
|
|
|
const char* vsAuxPath =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_SCC_AUXPATH");
|
|
|
|
if (vsAuxPath) {
|
2011-11-01 04:04:08 +04:00
|
|
|
this->WriteString("<SccAuxPath>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsAuxPath)
|
|
|
|
<< "</SccAuxPath>\n";
|
2011-06-14 17:45:52 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2011-06-14 17:45:52 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<WinMDAssembly>true</WinMDAssembly>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
|
2011-11-23 23:11:00 +04:00
|
|
|
const char* vsGlobalKeyword =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_GLOBAL_KEYWORD");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!vsGlobalKeyword) {
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("<Keyword>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword)
|
|
|
|
<< "</Keyword>\n";
|
|
|
|
}
|
2011-11-23 23:11:00 +04:00
|
|
|
|
2013-05-30 04:16:36 +04:00
|
|
|
const char* vsGlobalRootNamespace =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (vsGlobalRootNamespace) {
|
2013-05-30 04:16:36 +04:00
|
|
|
this->WriteString("<RootNamespace>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalRootNamespace)
|
|
|
|
<< "</RootNamespace>\n";
|
|
|
|
}
|
2013-05-30 04:16:36 +04:00
|
|
|
|
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";
|
2015-10-10 16:51:21 +03:00
|
|
|
const char* projLabel = this->GeneratorTarget->GetProperty("PROJECT_LABEL");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!projLabel) {
|
2010-09-10 00:21:57 +04:00
|
|
|
projLabel = this->Name.c_str();
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-09-10 00:21:57 +04:00
|
|
|
this->WriteString("<ProjectName>", 2);
|
2014-07-23 23:03:28 +04:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(projLabel) << "</ProjectName>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* targetFrameworkVersion = this->GeneratorTarget->GetProperty(
|
|
|
|
"VS_DOTNET_TARGET_FRAMEWORK_VERSION")) {
|
2013-06-14 15:28:00 +04:00
|
|
|
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";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-01-09 01:33:28 +03:00
|
|
|
|
|
|
|
std::vector<std::string> keys = this->GeneratorTarget->GetPropertyKeys();
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator keyIt = keys.begin();
|
|
|
|
keyIt != keys.end(); ++keyIt) {
|
2016-01-09 01:33:28 +03:00
|
|
|
static const char* prefix = "VS_GLOBAL_";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (keyIt->find(prefix) != 0)
|
2016-01-09 01:33:28 +03:00
|
|
|
continue;
|
|
|
|
std::string globalKey = keyIt->substr(strlen(prefix));
|
|
|
|
// Skip invalid or separately-handled properties.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (globalKey == "" || globalKey == "PROJECT_TYPES" ||
|
|
|
|
globalKey == "ROOTNAMESPACE" || globalKey == "KEYWORD") {
|
2016-01-09 01:33:28 +03:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-01-09 01:33:28 +03:00
|
|
|
const char* value = this->GeneratorTarget->GetProperty(keyIt->c_str());
|
|
|
|
if (!value)
|
|
|
|
continue;
|
|
|
|
this->WriteString("<", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << globalKey << ">" << cmVS10EscapeXML(value)
|
2016-01-09 01:33:28 +03:00
|
|
|
<< "</" << globalKey << ">\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-01-09 01:33:28 +03:00
|
|
|
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->IsMasmEnabled()) {
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteString("<Import Project=\"$(VCTargetsPath)\\"
|
2016-05-16 17:34:04 +03:00
|
|
|
"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 "')\""
|
2016-05-16 17:34:04 +03:00
|
|
|
" Label=\"LocalAppDataPlatform\" />\n",
|
|
|
|
2);
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WritePlatformExtensions();
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ImportGroup>\n", 1);
|
|
|
|
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
|
2014-08-11 22:17:12 +04:00
|
|
|
this->WriteWinRTPackageCertificateKeyFile();
|
2009-06-26 00:41:57 +04:00
|
|
|
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();
|
2015-03-31 23:49:39 +03:00
|
|
|
this->WriteXamlFilesGroup();
|
2012-02-03 18:07:12 +04:00
|
|
|
this->WriteWinRTReferences();
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteProjectReferences();
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteSDKReferences();
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString(
|
|
|
|
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
|
2016-05-16 17:34:04 +03:00
|
|
|
" />\n",
|
|
|
|
1);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteTargetSpecificReferences();
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<ImportGroup Label=\"ExtensionTargets\">\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->IsMasmEnabled()) {
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteString("<Import Project=\"$(VCTargetsPath)\\"
|
2016-05-16 17:34:04 +03:00
|
|
|
"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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* vsDotNetReferences =
|
|
|
|
this->GeneratorTarget->GetProperty("VS_DOTNET_REFERENCES")) {
|
2012-02-03 23:32:17 +04:00
|
|
|
cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!references.empty()) {
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03: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"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</CopyLocalSatelliteAssemblies>\n",
|
|
|
|
3);
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("<ReferenceOutputAssembly>true"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</ReferenceOutputAssembly>\n",
|
|
|
|
3);
|
2011-11-23 23:11:00 +04:00
|
|
|
this->WriteString("</Reference>\n", 2);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2011-11-23 23:11:00 +04:00
|
|
|
}
|
|
|
|
|
2013-06-28 11:04:01 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
|
|
|
|
{
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> resxObjs;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetResxSources(resxObjs, "");
|
|
|
|
if (!resxObjs.empty()) {
|
2013-06-28 11:04:01 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator oi =
|
|
|
|
resxObjs.begin();
|
|
|
|
oi != resxObjs.end(); ++oi) {
|
2013-06-28 11:04:01 +04:00
|
|
|
std::string obj = (*oi)->GetFullPath();
|
|
|
|
this->WriteString("<EmbeddedResource Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << obj << "\">\n";
|
2013-06-28 11:04:01 +04:00
|
|
|
|
|
|
|
this->WriteString("<DependentUpon>", 3);
|
|
|
|
std::string hFileName = obj.substr(0, obj.find_last_of(".")) + ".h";
|
2015-03-31 23:49:39 +03:00
|
|
|
(*this->BuildFileStream) << hFileName << "</DependentUpon>\n";
|
2013-06-28 11:04:01 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
2013-06-28 11:04:01 +04:00
|
|
|
this->WritePlatformConfigTag("LogicalName", i->c_str(), 3);
|
2016-07-20 18:10:07 +03:00
|
|
|
if (this->GeneratorTarget->GetProperty("VS_GLOBAL_ROOTNAMESPACE") ||
|
|
|
|
// Handle variant of VS_GLOBAL_<variable> for RootNamespace.
|
|
|
|
this->GeneratorTarget->GetProperty("VS_GLOBAL_RootNamespace")) {
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "$(RootNamespace).";
|
2013-06-28 11:04:01 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "%(Filename)";
|
|
|
|
(*this->BuildFileStream) << ".resources";
|
|
|
|
(*this->BuildFileStream) << "</LogicalName>\n";
|
|
|
|
}
|
2013-06-28 11:04:01 +04:00
|
|
|
|
|
|
|
this->WriteString("</EmbeddedResource>\n", 2);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2013-06-28 11:04:01 +04:00
|
|
|
}
|
|
|
|
|
2015-03-31 23:49:39 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteXamlFilesGroup()
|
|
|
|
{
|
|
|
|
std::vector<cmSourceFile const*> xamlObjs;
|
|
|
|
this->GeneratorTarget->GetXamlSources(xamlObjs, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!xamlObjs.empty()) {
|
2015-03-31 23:49:39 +03:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator oi =
|
|
|
|
xamlObjs.begin();
|
|
|
|
oi != xamlObjs.end(); ++oi) {
|
2015-03-31 23:49:39 +03:00
|
|
|
std::string obj = (*oi)->GetFullPath();
|
|
|
|
std::string xamlType;
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* xamlTypeProperty = (*oi)->GetProperty("VS_XAML_TYPE");
|
|
|
|
if (xamlTypeProperty) {
|
2015-03-31 23:49:39 +03:00
|
|
|
xamlType = xamlTypeProperty;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2015-03-31 23:49:39 +03:00
|
|
|
xamlType = "Page";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-31 23:49:39 +03:00
|
|
|
|
|
|
|
this->WriteSource(xamlType, *oi, ">\n");
|
|
|
|
this->WriteString("<SubType>Designer</SubType>\n", 3);
|
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream) << xamlType << ">\n";
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2015-03-31 23:49:39 +03:00
|
|
|
}
|
|
|
|
|
2014-08-15 01:52:53 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteTargetSpecificReferences()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone() &&
|
|
|
|
this->GlobalGenerator->GetSystemVersion() == "8.0") {
|
|
|
|
this->WriteString("<Import Project=\""
|
|
|
|
"$(MSBuildExtensionsPath)\\Microsoft\\WindowsPhone\\v"
|
|
|
|
"$(TargetPlatformVersion)\\Microsoft.Cpp.WindowsPhone."
|
|
|
|
"$(TargetPlatformVersion).targets\" />\n",
|
|
|
|
1);
|
2014-08-15 01:52:53 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
}
|
|
|
|
|
2012-02-03 18:07:12 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
|
|
|
|
{
|
2012-02-03 23:32:17 +04:00
|
|
|
std::vector<std::string> references;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* vsWinRTReferences =
|
|
|
|
this->GeneratorTarget->GetProperty("VS_WINRT_REFERENCES")) {
|
2012-02-03 23:32:17 +04:00
|
|
|
cmSystemTools::ExpandListArgument(vsWinRTReferences, references);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone() &&
|
|
|
|
this->GlobalGenerator->GetSystemVersion() == "8.0" &&
|
|
|
|
references.empty()) {
|
2014-08-15 01:52:53 +04:00
|
|
|
references.push_back("platform.winmd");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!references.empty()) {
|
2012-02-03 18:07:12 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03: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);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2012-02-03 18:07:12 +04:00
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
|
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup Label=\"ProjectConfigurations\">\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<ProjectConfiguration Include=\"", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << *i << "|" << this->Platform << "\">\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("<Configuration>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*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);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
|
|
|
this->WritePlatformConfigTag("PropertyGroup", i->c_str(), 1,
|
|
|
|
" Label=\"Configuration\"", "\n");
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string configType = "<ConfigurationType>";
|
2016-02-26 00:04:05 +03:00
|
|
|
if (const char* vsConfigurationType =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) {
|
2016-02-26 00:04:05 +03:00
|
|
|
configType += cmVS10EscapeXML(vsConfigurationType);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
switch (this->GeneratorTarget->GetType()) {
|
2016-02-26 00:04:05 +03:00
|
|
|
case cmState::SHARED_LIBRARY:
|
|
|
|
case cmState::MODULE_LIBRARY:
|
2014-06-10 19:33:19 +04:00
|
|
|
configType += "DynamicLibrary";
|
2016-02-26 00:04:05 +03:00
|
|
|
break;
|
|
|
|
case cmState::OBJECT_LIBRARY:
|
|
|
|
case cmState::STATIC_LIBRARY:
|
2014-06-10 19:33:19 +04:00
|
|
|
configType += "StaticLibrary";
|
2016-02-26 00:04:05 +03:00
|
|
|
break;
|
|
|
|
case cmState::EXECUTABLE:
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NsightTegra &&
|
|
|
|
!this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) {
|
2016-02-26 00:04:05 +03:00
|
|
|
// Android executables are .so too.
|
|
|
|
configType += "DynamicLibrary";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2016-02-26 00:04:05 +03:00
|
|
|
configType += "Application";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-02-26 00:04:05 +03:00
|
|
|
break;
|
|
|
|
case cmState::UTILITY:
|
|
|
|
case cmState::GLOBAL_TARGET:
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NsightTegra) {
|
2016-02-26 00:04:05 +03:00
|
|
|
// Tegra-Android platform does not understand "Utility".
|
|
|
|
configType += "StaticLibrary";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2016-02-26 00:04:05 +03:00
|
|
|
configType += "Utility";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-02-26 00:04:05 +03:00
|
|
|
break;
|
|
|
|
case cmState::UNKNOWN_LIBRARY:
|
|
|
|
case cmState::INTERFACE_LIBRARY:
|
|
|
|
break;
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
2014-06-10 18:13:00 +04:00
|
|
|
this->WriteMSToolConfigurationValues(*i);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->NsightTegra) {
|
2014-06-10 19:33:19 +04:00
|
|
|
this->WriteNsightTegraConfigurationValues(*i);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2011-11-04 21:29:41 +04:00
|
|
|
|
2014-06-05 22:57:23 +04:00
|
|
|
this->WriteString("</PropertyGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-05 22:57:23 +04:00
|
|
|
}
|
2011-11-04 21:29:41 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
|
|
|
|
std::string const& config)
|
2014-06-05 22:57:23 +04:00
|
|
|
{
|
|
|
|
cmGlobalVisualStudio10Generator* gg =
|
|
|
|
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
|
|
|
|
const char* mfcFlag =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->Target->GetMakefile()->GetDefinition(
|
|
|
|
"CMAKE_MFC_FLAG");
|
2014-06-05 22:57:23 +04:00
|
|
|
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";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
|
|
|
|
if (mfcFlagValue == "1") {
|
2016-01-20 00:01:08 +03:00
|
|
|
useOfMfcValue = "Static";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (mfcFlagValue == "2") {
|
2016-01-20 00:01:08 +03:00
|
|
|
useOfMfcValue = "Dynamic";
|
2014-06-05 22:57:23 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-05 22:57:23 +04:00
|
|
|
std::string mfcLine = "<UseOfMfc>";
|
|
|
|
mfcLine += useOfMfcValue + "</UseOfMfc>\n";
|
|
|
|
this->WriteString(mfcLine.c_str(), 2);
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if ((this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY &&
|
|
|
|
this->ClOptions[config]->UsingUnicode()) ||
|
|
|
|
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsPhone() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsStore() ||
|
|
|
|
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) {
|
2014-06-05 22:57:23 +04:00
|
|
|
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->GeneratorTarget->GetType() <= cmState::MODULE_LIBRARY &&
|
|
|
|
this->ClOptions[config]->UsingSBCS()) {
|
2014-06-05 22:57:23 +04:00
|
|
|
this->WriteString("<CharacterSet>NotSet</CharacterSet>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-06-05 22:57:23 +04:00
|
|
|
this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (const char* toolset = gg->GetPlatformToolset()) {
|
2014-06-05 22:57:23 +04:00
|
|
|
std::string pts = "<PlatformToolset>";
|
|
|
|
pts += toolset;
|
|
|
|
pts += "</PlatformToolset>\n";
|
|
|
|
this->WriteString(pts.c_str(), 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") ||
|
|
|
|
this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) {
|
2014-06-05 22:57:23 +04:00
|
|
|
this->WriteString("<WindowsAppContainer>true"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</WindowsAppContainer>\n",
|
|
|
|
2);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
|
|
|
|
std::string const&)
|
2014-06-10 19:33:19 +04:00
|
|
|
{
|
|
|
|
cmGlobalVisualStudio10Generator* gg =
|
|
|
|
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
|
|
|
|
const char* toolset = gg->GetPlatformToolset();
|
|
|
|
std::string ntv = "<NdkToolchainVersion>";
|
2016-05-16 17:34:04 +03:00
|
|
|
ntv += toolset ? toolset : "Default";
|
2014-06-10 19:33:19 +04:00
|
|
|
ntv += "</NdkToolchainVersion>\n";
|
|
|
|
this->WriteString(ntv.c_str(), 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* minApi =
|
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_API_MIN")) {
|
2014-12-17 17:11:51 +03:00
|
|
|
this->WriteString("<AndroidMinAPI>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "android-" << cmVS10EscapeXML(minApi)
|
|
|
|
<< "</AndroidMinAPI>\n";
|
|
|
|
}
|
|
|
|
if (const char* api = this->GeneratorTarget->GetProperty("ANDROID_API")) {
|
2014-09-02 21:53:26 +04:00
|
|
|
this->WriteString("<AndroidTargetAPI>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "android-" << cmVS10EscapeXML(api)
|
|
|
|
<< "</AndroidTargetAPI>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* cpuArch =
|
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_ARCH")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<AndroidArch>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(cpuArch) << "</AndroidArch>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* stlType =
|
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_STL_TYPE")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<AndroidStlType>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(stlType)
|
|
|
|
<< "</AndroidStlType>\n";
|
|
|
|
}
|
2014-06-10 19:33:19 +04:00
|
|
|
}
|
|
|
|
|
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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
customCommands.begin();
|
|
|
|
si != customCommands.end(); ++si) {
|
2012-03-07 20:56:21 +04:00
|
|
|
this->WriteCustomCommand(*si);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-09-07 18:12:18 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteCustomCommand(
|
|
|
|
cmSourceFile const* sf)
|
2009-09-07 18:12:18 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->SourcesVisited.insert(sf).second) {
|
|
|
|
if (std::vector<cmSourceFile*> const* depends =
|
|
|
|
this->GeneratorTarget->GetSourceDepends(sf)) {
|
|
|
|
for (std::vector<cmSourceFile*>::const_iterator di = depends->begin();
|
|
|
|
di != depends->end(); ++di) {
|
2009-09-07 18:12:18 +04:00
|
|
|
this->WriteCustomCommand(*di);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (cmCustomCommand const* command = sf->GetCustomCommand()) {
|
2009-09-07 18:12:18 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
|
|
|
this->WriteCustomRule(sf, *command);
|
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteCustomRule(
|
|
|
|
cmSourceFile const* source, cmCustomCommand const& command)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
|
|
|
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.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (source->GetPropertyAsBool("__CMAKE_RULE")) {
|
|
|
|
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());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (fout) {
|
2009-06-26 00:41:57 +04:00
|
|
|
fout << "# generated from CMake\n";
|
|
|
|
fout.flush();
|
|
|
|
fout.close();
|
2015-09-28 16:33:10 +03:00
|
|
|
// Force given file to have a very old timestamp, thus
|
|
|
|
// preventing dependent rebuilds.
|
|
|
|
this->ForceOld(sourcePath);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2011-06-07 16:59:03 +04:00
|
|
|
std::string error = "Could not create file: [";
|
2016-05-16 17:34:04 +03:00
|
|
|
error += sourcePath;
|
2011-06-07 16:59:03 +04:00
|
|
|
error += "] ";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::Error(error.c_str(),
|
|
|
|
cmSystemTools::GetLastSystemError().c_str());
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
|
2012-04-27 16:34:49 +04:00
|
|
|
|
|
|
|
this->WriteSource("CustomBuild", source, ">\n");
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
2015-07-25 18:52:10 +03:00
|
|
|
cmCustomCommandGenerator ccg(command, *i, this->LocalGenerator);
|
2014-03-10 23:47:19 +04:00
|
|
|
std::string comment = lg->ConstructComment(ccg);
|
|
|
|
comment = cmVS10EscapeComment(comment);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string script = cmVS10EscapeXML(lg->ConstructScript(ccg));
|
|
|
|
this->WritePlatformConfigTag("Message", i->c_str(), 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("Command", i->c_str(), 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << script << "</Command>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(source->GetFullPath());
|
|
|
|
for (std::vector<std::string>::const_iterator d = ccg.GetDepends().begin();
|
|
|
|
d != ccg.GetDepends().end(); ++d) {
|
2010-12-09 00:51:16 +03:00
|
|
|
std::string dep;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(),
|
|
|
|
dep)) {
|
2010-12-09 00:51:16 +03:00
|
|
|
this->ConvertToWindowsSlash(dep);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << ";" << cmVS10EscapeXML(dep);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
(*this->BuildFileStream) << ";%(AdditionalInputs)</AdditionalInputs>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("Outputs", i->c_str(), 3);
|
|
|
|
const char* sep = "";
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
|
|
|
|
o != ccg.GetOutputs().end(); ++o) {
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string out = *o;
|
|
|
|
this->ConvertToWindowsSlash(out);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << sep << cmVS10EscapeXML(out);
|
2009-06-26 00:41:57 +04:00
|
|
|
sep = ";";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
(*this->BuildFileStream) << "</Outputs>\n";
|
|
|
|
if (this->LocalGenerator->GetVersion() >
|
|
|
|
cmGlobalVisualStudioGenerator::VS10) {
|
2013-01-07 20:31:52 +04:00
|
|
|
// VS >= 11 let us turn off linking of custom command outputs.
|
|
|
|
this->WritePlatformConfigTag("LinkObjects", i->c_str(), 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "false</LinkObjects>\n";
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</CustomBuild>\n", 2);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string cmVisualStudio10TargetGenerator::ConvertPath(
|
|
|
|
std::string const& path, bool forceRelative)
|
2012-04-27 18:42:23 +04:00
|
|
|
{
|
|
|
|
return forceRelative
|
|
|
|
? cmSystemTools::RelativePath(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->GetCurrentBinaryDirectory(), path.c_str())
|
2015-06-01 21:23:11 +03:00
|
|
|
: path.c_str();
|
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;
|
2016-05-16 17:34:04 +03:00
|
|
|
while ((pos = s.find('/', pos)) != std::string::npos) {
|
2009-06-26 00:41:57 +04:00
|
|
|
s[pos] = '\\';
|
|
|
|
pos++;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteGroups()
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2009-07-11 08:05:20 +04:00
|
|
|
// collect up group information
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
|
2013-07-14 20:22:57 +04:00
|
|
|
std::vector<cmSourceFile*> classes;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->GeneratorTarget->GetConfigCommonSourceFiles(classes)) {
|
2014-02-13 20:25:00 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2009-07-11 08:05:20 +04:00
|
|
|
std::set<cmSourceGroup*> groupsUsed;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile*>::const_iterator s = classes.begin();
|
|
|
|
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);
|
2016-05-16 17:34:04 +03: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
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string path = this->LocalGenerator->GetCurrentBinaryDirectory();
|
2009-07-11 08:05:20 +04:00
|
|
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
char magic[] = { char(0xEF), char(0xBB), char(0xBF) };
|
2009-07-11 08:05:20 +04:00
|
|
|
fout.write(magic, 3);
|
|
|
|
cmGeneratedFileStream* save = this->BuildFileStream;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->BuildFileStream = &fout;
|
2013-08-20 22:59:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
// get the tools version to use
|
2013-08-20 22:59:59 +04:00
|
|
|
const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string project_defaults = "<?xml version=\"1.0\" encoding=\"" +
|
2014-03-14 18:48:42 +04:00
|
|
|
this->GlobalGenerator->Encoding() + "\"?>\n";
|
2013-08-20 22:59:59 +04:00
|
|
|
project_defaults.append("<Project ToolsVersion=\"");
|
2016-05-16 17:34:04 +03:00
|
|
|
project_defaults.append(toolsVer + "\" ");
|
2013-08-20 22:59:59 +04:00
|
|
|
project_defaults.append(
|
2016-05-16 17:34:04 +03:00
|
|
|
"xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n");
|
|
|
|
this->WriteString(project_defaults.c_str(), 0);
|
2013-08-20 22:59:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
for (ToolSourceMap::const_iterator ti = this->Tools.begin();
|
|
|
|
ti != this->Tools.end(); ++ti) {
|
2012-04-27 17:21:08 +04:00
|
|
|
this->WriteGroupSources(ti->first.c_str(), ti->second, sourceGroups);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-07-11 08:05:20 +04:00
|
|
|
|
2014-08-15 01:52:53 +04:00
|
|
|
// Added files are images and the manifest.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->AddedFiles.empty()) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator oi =
|
|
|
|
this->AddedFiles.begin();
|
|
|
|
oi != this->AddedFiles.end(); ++oi) {
|
|
|
|
std::string fileName =
|
|
|
|
cmSystemTools::LowerCase(cmSystemTools::GetFilenameName(*oi));
|
|
|
|
if (fileName == "wmappmanifest.xml") {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<XML Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << *oi << "\">\n";
|
|
|
|
this->WriteString("<Filter>Resource Files</Filter>\n", 3);
|
|
|
|
this->WriteString("</XML>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (cmSystemTools::GetFilenameExtension(fileName) ==
|
|
|
|
".appxmanifest") {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<AppxManifest Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << *oi << "\">\n";
|
|
|
|
this->WriteString("<Filter>Resource Files</Filter>\n", 3);
|
|
|
|
this->WriteString("</AppxManifest>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (cmSystemTools::GetFilenameExtension(fileName) == ".pfx") {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<None Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << *oi << "\">\n";
|
|
|
|
this->WriteString("<Filter>Resource Files</Filter>\n", 3);
|
|
|
|
this->WriteString("</None>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << *oi << "\">\n";
|
|
|
|
this->WriteString("<Filter>Resource Files</Filter>\n", 3);
|
|
|
|
this->WriteString("</Image>\n", 2);
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
|
2014-03-13 02:06:05 +04:00
|
|
|
std::vector<cmSourceFile const*> resxObjs;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetResxSources(resxObjs, "");
|
|
|
|
if (!resxObjs.empty()) {
|
2013-04-29 18:48:22 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator oi =
|
|
|
|
resxObjs.begin();
|
|
|
|
oi != resxObjs.end(); ++oi) {
|
2013-04-29 18:48:22 +04:00
|
|
|
std::string obj = (*oi)->GetFullPath();
|
|
|
|
this->WriteString("<EmbeddedResource Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2016-05-16 17:34:04 +03: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);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2013-04-29 18:48:22 +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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!objs.empty()) {
|
2012-03-12 22:40:58 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator oi = objs.begin();
|
|
|
|
oi != objs.end(); ++oi) {
|
2012-03-12 22:40:58 +04:00
|
|
|
std::string obj = *oi;
|
|
|
|
this->WriteString("<Object Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2016-05-16 17:34:04 +03: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);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
|
|
|
}
|
2012-03-12 22:40:58 +04:00
|
|
|
|
2009-07-11 08:05:20 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::set<cmSourceGroup*>::iterator g = groupsUsed.begin();
|
|
|
|
g != groupsUsed.end(); ++g) {
|
2009-07-11 08:05:20 +04:00
|
|
|
cmSourceGroup* sg = *g;
|
|
|
|
const char* name = sg->GetFullName();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (strlen(name) != 0) {
|
2009-07-11 08:05:20 +04:00
|
|
|
this->WriteString("<Filter Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << name << "\">\n";
|
|
|
|
std::string guidName = "SG_Filter_";
|
|
|
|
guidName += name;
|
|
|
|
this->WriteString("<UniqueIdentifier>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str());
|
|
|
|
(*this->BuildFileStream) << "{" << guid << "}"
|
|
|
|
<< "</UniqueIdentifier>\n";
|
2009-07-11 08:05:20 +04:00
|
|
|
this->WriteString("</Filter>\n", 2);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!objs.empty()) {
|
2012-03-12 22:40:58 +04:00
|
|
|
this->WriteString("<Filter Include=\"Object Libraries\">\n", 2);
|
|
|
|
std::string guidName = "SG_Filter_Object Libraries";
|
|
|
|
this->WriteString("<UniqueIdentifier>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str());
|
2012-03-12 22:40:58 +04:00
|
|
|
(*this->BuildFileStream) << "{" << guid << "}"
|
|
|
|
<< "</UniqueIdentifier>\n";
|
|
|
|
this->WriteString("</Filter>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!resxObjs.empty() || !this->AddedFiles.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->WriteString("<UniqueIdentifier>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string guid = this->GlobalGenerator->GetGUID(guidName.c_str());
|
2013-04-29 18:48:22 +04:00
|
|
|
(*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
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (fout.Close()) {
|
2010-05-05 22:30:21 +04:00
|
|
|
this->GlobalGenerator->FileReplacedDuringGenerate(path);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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.
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::AddMissingSourceGroups(
|
2010-06-11 23:33:38 +04:00
|
|
|
std::set<cmSourceGroup*>& groupsUsed,
|
2016-05-16 17:34:04 +03:00
|
|
|
const std::vector<cmSourceGroup>& allGroups)
|
2010-06-11 23:33:38 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceGroup>::const_iterator current = allGroups.begin();
|
|
|
|
current != allGroups.end(); ++current) {
|
2010-06-11 23:33:38 +04:00
|
|
|
std::vector<cmSourceGroup> const& children = current->GetGroupChildren();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (children.empty()) {
|
2010-06-11 23:33:38 +04:00
|
|
|
continue; // the group is really empty
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-06-11 23:33:38 +04:00
|
|
|
|
|
|
|
this->AddMissingSourceGroups(groupsUsed, children);
|
|
|
|
|
|
|
|
cmSourceGroup* current_ptr = const_cast<cmSourceGroup*>(&(*current));
|
2016-05-16 17:34:04 +03:00
|
|
|
if (groupsUsed.find(current_ptr) != groupsUsed.end()) {
|
2010-06-11 23:33:38 +04:00
|
|
|
continue; // group has already been added to set
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-06-11 23:33:38 +04:00
|
|
|
|
|
|
|
// 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();
|
2016-05-16 17:34:04 +03:00
|
|
|
while (child_it != children.end()) {
|
2010-06-11 23:33:38 +04:00
|
|
|
cmSourceGroup* child_ptr = const_cast<cmSourceGroup*>(&(*child_it));
|
2016-05-16 17:34:04 +03:00
|
|
|
if (groupsUsed.find(child_ptr) != groupsUsed.end()) {
|
2010-06-11 23:33:38 +04:00
|
|
|
break; // found a child that was already added => add current group too
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
child_it++;
|
|
|
|
}
|
2010-06-11 23:33:38 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (child_it == children.end()) {
|
2010-06-11 23:33:38 +04:00
|
|
|
continue; // no descendants have source files => ignore this group
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-06-11 23:33:38 +04:00
|
|
|
|
|
|
|
groupsUsed.insert(current_ptr);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-06-11 23:33:38 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteGroupSources(
|
|
|
|
const char* name, ToolSources const& sources,
|
|
|
|
std::vector<cmSourceGroup>& sourceGroups)
|
2009-07-11 08:05:20 +04:00
|
|
|
{
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (ToolSources::const_iterator s = sources.begin(); 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);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << name << " Include=\"" << cmVS10EscapeXML(path);
|
|
|
|
if (strlen(filter)) {
|
2009-07-11 08:05:20 +04:00
|
|
|
(*this->BuildFileStream) << "\">\n";
|
|
|
|
this->WriteString("<Filter>", 3);
|
|
|
|
(*this->BuildFileStream) << filter << "</Filter>\n";
|
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream) << name << ">\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2009-07-11 08:05:20 +04:00
|
|
|
(*this->BuildFileStream) << "\" />\n";
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-07-11 08:05:20 +04:00
|
|
|
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)
|
|
|
|
{
|
2015-03-31 23:49:39 +03:00
|
|
|
std::string const& fileName = sf->GetFullPath();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->IsResxHeader(fileName)) {
|
2014-07-29 21:41:17 +04:00
|
|
|
this->WriteSource("ClInclude", sf, ">\n");
|
|
|
|
this->WriteString("<FileType>CppForm</FileType>\n", 3);
|
|
|
|
this->WriteString("</ClInclude>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->IsXamlHeader(fileName)) {
|
2015-03-31 23:49:39 +03:00
|
|
|
this->WriteSource("ClInclude", sf, ">\n");
|
|
|
|
this->WriteString("<DependentUpon>", 3);
|
|
|
|
std::string xamlFileName = fileName.substr(0, fileName.find_last_of("."));
|
|
|
|
(*this->BuildFileStream) << xamlFileName << "</DependentUpon>\n";
|
|
|
|
this->WriteString("</ClInclude>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-07-29 21:41:17 +04:00
|
|
|
this->WriteSource("ClInclude", sf);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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-12-02 12:41:10 +03:00
|
|
|
std::string shaderEntryPoint;
|
|
|
|
std::string shaderModel;
|
2015-01-26 22:16:42 +03:00
|
|
|
std::string shaderAdditionalFlags;
|
2014-09-24 22:25:35 +04:00
|
|
|
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (ext == "hlsl") {
|
2014-07-29 22:48:20 +04:00
|
|
|
tool = "FXCompile";
|
|
|
|
// Figure out the type of shader compiler to use.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* st = sf->GetProperty("VS_SHADER_TYPE")) {
|
2014-07-29 22:48:20 +04:00
|
|
|
shaderType = st;
|
|
|
|
toolHasSettings = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-12-02 12:41:10 +03:00
|
|
|
// Figure out which entry point to use if any
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* se = sf->GetProperty("VS_SHADER_ENTRYPOINT")) {
|
2014-12-02 12:41:10 +03:00
|
|
|
shaderEntryPoint = se;
|
|
|
|
toolHasSettings = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-12-03 22:12:32 +03:00
|
|
|
// Figure out which shader model to use if any
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* sm = sf->GetProperty("VS_SHADER_MODEL")) {
|
2014-12-02 12:41:10 +03:00
|
|
|
shaderModel = sm;
|
|
|
|
toolHasSettings = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-01-26 22:16:42 +03:00
|
|
|
// Figure out if there's any additional flags to use
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS")) {
|
2015-01-26 22:16:42 +03:00
|
|
|
shaderAdditionalFlags = saf;
|
|
|
|
toolHasSettings = true;
|
2014-07-29 22:48:20 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (ext == "jpg" || ext == "png") {
|
2014-07-29 21:52:42 +04:00
|
|
|
tool = "Image";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (ext == "resw") {
|
2015-10-22 20:17:27 +03:00
|
|
|
tool = "PRIResource";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (ext == "xml") {
|
2014-07-29 21:45:23 +04:00
|
|
|
tool = "XML";
|
2016-07-15 17:19:03 +03:00
|
|
|
} else if (ext == "natvis") {
|
|
|
|
tool = "Natvis";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-02 21:34:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NsightTegra) {
|
2014-09-24 22:27:18 +04:00
|
|
|
// Nsight Tegra needs specific file types to check up-to-dateness.
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string name = cmSystemTools::LowerCase(sf->GetLocation().GetName());
|
|
|
|
if (name == "androidmanifest.xml" || name == "build.xml" ||
|
|
|
|
name == "proguard.cfg" || name == "proguard-project.txt" ||
|
|
|
|
ext == "properties") {
|
2014-09-24 22:27:18 +04:00
|
|
|
tool = "AndroidBuild";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (ext == "java") {
|
2014-09-24 22:27:18 +04:00
|
|
|
tool = "JCompile";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (ext == "asm" || ext == "s") {
|
2014-09-24 22:27:18 +04:00
|
|
|
tool = "ClCompile";
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-29 22:41:03 +04:00
|
|
|
|
2016-06-18 00:24:21 +03:00
|
|
|
const char* toolOverride = sf->GetProperty("VS_TOOL_OVERRIDE");
|
|
|
|
if (toolOverride && *toolOverride) {
|
|
|
|
tool = toolOverride;
|
|
|
|
}
|
|
|
|
|
2014-07-29 22:03:35 +04:00
|
|
|
std::string deployContent;
|
2014-12-03 00:32:45 +03:00
|
|
|
std::string deployLocation;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsStore()) {
|
2014-07-29 22:03:35 +04:00
|
|
|
const char* content = sf->GetProperty("VS_DEPLOYMENT_CONTENT");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (content && *content) {
|
2014-07-29 22:03:35 +04:00
|
|
|
toolHasSettings = true;
|
|
|
|
deployContent = content;
|
2014-12-03 00:32:45 +03:00
|
|
|
|
|
|
|
const char* location = sf->GetProperty("VS_DEPLOYMENT_LOCATION");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (location && *location) {
|
2014-12-03 00:32:45 +03:00
|
|
|
deployLocation = location;
|
2014-07-29 22:03:35 +04:00
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-29 22:03:35 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (toolHasSettings) {
|
2014-07-29 22:41:03 +04:00
|
|
|
this->WriteSource(tool, sf, ">\n");
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!deployContent.empty()) {
|
2014-07-29 22:03:35 +04:00
|
|
|
cmGeneratorExpression ge;
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(deployContent);
|
2014-12-03 00:32:45 +03:00
|
|
|
// Deployment location cannot be set on a configuration basis
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!deployLocation.empty()) {
|
2014-12-03 00:32:45 +03:00
|
|
|
this->WriteString("<Link>", 3);
|
|
|
|
(*this->BuildFileStream) << deployLocation
|
|
|
|
<< "\\%(FileName)%(Extension)";
|
|
|
|
this->WriteString("</Link>\n", 0);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
for (size_t i = 0; i != this->Configurations.size(); ++i) {
|
|
|
|
if (0 == strcmp(cge->Evaluate(this->LocalGenerator,
|
|
|
|
this->Configurations[i]),
|
|
|
|
"1")) {
|
2014-07-29 22:03:35 +04:00
|
|
|
this->WriteString("<DeploymentContent Condition=\""
|
2016-05-16 17:34:04 +03:00
|
|
|
"'$(Configuration)|$(Platform)'=='",
|
|
|
|
3);
|
2015-05-20 20:55:21 +03:00
|
|
|
(*this->BuildFileStream) << this->Configurations[i] << "|"
|
2014-07-29 22:03:35 +04:00
|
|
|
<< this->Platform << "'\">true";
|
|
|
|
this->WriteString("</DeploymentContent>\n", 0);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-07-29 22:03:35 +04:00
|
|
|
this->WriteString("<ExcludedFromBuild Condition=\""
|
2016-05-16 17:34:04 +03:00
|
|
|
"'$(Configuration)|$(Platform)'=='",
|
|
|
|
3);
|
2015-05-20 20:55:21 +03:00
|
|
|
(*this->BuildFileStream) << this->Configurations[i] << "|"
|
2014-07-29 22:03:35 +04:00
|
|
|
<< this->Platform << "'\">true";
|
|
|
|
this->WriteString("</ExcludedFromBuild>\n", 0);
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!shaderType.empty()) {
|
2014-07-29 22:48:20 +04:00
|
|
|
this->WriteString("<ShaderType>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderType)
|
|
|
|
<< "</ShaderType>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!shaderEntryPoint.empty()) {
|
2014-12-02 12:41:10 +03:00
|
|
|
this->WriteString("<EntryPointName>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderEntryPoint)
|
|
|
|
<< "</EntryPointName>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!shaderModel.empty()) {
|
2014-12-02 12:41:10 +03:00
|
|
|
this->WriteString("<ShaderModel>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderModel)
|
|
|
|
<< "</ShaderModel>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!shaderAdditionalFlags.empty()) {
|
2015-01-26 22:16:42 +03:00
|
|
|
this->WriteString("<AdditionalOptions>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
|
|
|
|
<< "</AdditionalOptions>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-29 22:41:03 +04:00
|
|
|
this->WriteString("</", 2);
|
|
|
|
(*this->BuildFileStream) << tool << ">\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-07-29 22:41:03 +04:00
|
|
|
this->WriteSource(tool, sf);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-29 21:32:22 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteSource(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);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->LocalGenerator->GetVersion() ==
|
|
|
|
cmGlobalVisualStudioGenerator::VS10 &&
|
|
|
|
cmSystemTools::FileIsFullPath(sourceFile.c_str())) {
|
2012-04-27 19:00:22 +04:00
|
|
|
// 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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (sf->GetCustomCommand() ||
|
|
|
|
((strlen(this->LocalGenerator->GetCurrentBinaryDirectory()) + 1 +
|
|
|
|
sourceRel.length()) <= maxLen)) {
|
2012-04-27 19:00:22 +04:00
|
|
|
forceRelative = true;
|
2012-04-27 22:13:02 +04:00
|
|
|
sourceFile = sourceRel;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
this->GlobalGenerator->PathTooLong(this->GeneratorTarget, sf, sourceRel);
|
2012-04-27 19:00:22 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-03-19 19:25:21 +04:00
|
|
|
this->ConvertToWindowsSlash(sourceFile);
|
|
|
|
this->WriteString("<", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << tool << " Include=\""
|
|
|
|
<< cmVS10EscapeXML(sourceFile) << "\""
|
|
|
|
<< (end ? end : " />\n");
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2016-05-16 17:34:04 +03: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
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si = sources.begin();
|
|
|
|
si != sources.end(); ++si) {
|
2012-03-19 19:25:21 +04:00
|
|
|
this->WriteSource(tool, *si);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() > cmState::UTILITY) {
|
2009-07-10 17:12:39 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03: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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
headerSources.begin();
|
|
|
|
si != headerSources.end(); ++si) {
|
2014-07-29 21:36:53 +04:00
|
|
|
this->WriteHeaderSource(*si);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
objectSources.begin();
|
|
|
|
si != objectSources.end(); ++si) {
|
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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (lang == "C" || lang == "CXX") {
|
2013-08-05 18:34:10 +04:00
|
|
|
tool = "ClCompile";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (lang == "ASM_MASM" && this->GlobalGenerator->IsMasmEnabled()) {
|
2013-08-05 18:34:10 +04:00
|
|
|
tool = "MASM";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (lang == "RC") {
|
2013-08-05 18:34:10 +04:00
|
|
|
tool = "ResourceCompile";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-08-05 18:34:10 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!tool.empty()) {
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteSource(tool, *si, " ");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->OutputSourceSpecificFlags(*si)) {
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteString("</", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << tool << ">\n";
|
|
|
|
} else {
|
|
|
|
(*this->BuildFileStream) << " />\n";
|
2011-01-26 02:54:36 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2013-08-05 18:34:10 +04:00
|
|
|
this->WriteSource("None", *si);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-03-12 22:40:58 +04:00
|
|
|
|
2014-08-11 22:08:49 +04:00
|
|
|
std::vector<cmSourceFile const*> manifestSources;
|
|
|
|
this->GeneratorTarget->GetAppManifest(manifestSources, "");
|
|
|
|
this->WriteSources("AppxManifest", manifestSources);
|
|
|
|
|
2014-09-19 01:14:54 +04:00
|
|
|
std::vector<cmSourceFile const*> certificateSources;
|
|
|
|
this->GeneratorTarget->GetCertificates(certificateSources, "");
|
|
|
|
this->WriteSources("None", certificateSources);
|
|
|
|
|
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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::iterator si = externalObjects.begin();
|
|
|
|
si != externalObjects.end();) {
|
|
|
|
if (!(*si)->GetObjectLibrary().empty()) {
|
2014-03-18 19:40:46 +04:00
|
|
|
si = externalObjects.erase(si);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-03-18 19:40:46 +04:00
|
|
|
++si;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (this->LocalGenerator->GetVersion() >
|
|
|
|
cmGlobalVisualStudioGenerator::VS10) {
|
2013-01-07 20:31:52 +04:00
|
|
|
// 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);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
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.
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
externalObjects.begin();
|
|
|
|
si != externalObjects.end(); ++si) {
|
2012-10-11 02:57:11 +04:00
|
|
|
std::vector<cmSourceFile*> const* d =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetSourceDepends(*si);
|
|
|
|
this->WriteSource((d && !d->empty()) ? "None" : "Object", *si);
|
2012-03-19 19:25:21 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
extraSources.begin();
|
|
|
|
si != extraSources.end(); ++si) {
|
2014-07-29 21:32:22 +04:00
|
|
|
this->WriteExtraSource(*si);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator oi = objs.begin();
|
|
|
|
oi != objs.end(); ++oi) {
|
2012-03-12 22:40:58 +04:00
|
|
|
std::string obj = *oi;
|
|
|
|
this->WriteString("<Object Include=\"", 2);
|
|
|
|
this->ConvertToWindowsSlash(obj);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(obj) << "\" />\n";
|
|
|
|
}
|
2012-03-12 22:40:58 +04:00
|
|
|
|
2015-11-02 17:24:25 +03:00
|
|
|
if (cmSourceFile const* defsrc =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetModuleDefinitionFile("")) {
|
2015-11-02 17:24:25 +03:00
|
|
|
this->WriteSource("None", defsrc);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-11-02 17:24:25 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->IsMissingFiles) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteMissingFiles();
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-15 01:52:53 +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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->HasExplicitObjectName(&sf)) {
|
2013-11-10 14:22:44 +04:00
|
|
|
objectName = this->GeneratorTarget->GetObjectName(&sf);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string flags;
|
|
|
|
std::string defines;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
|
2009-06-26 00:41:57 +04:00
|
|
|
flags += cflags;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (const char* cdefs = sf.GetProperty("COMPILE_DEFINITIONS")) {
|
2009-06-26 00:41:57 +04:00
|
|
|
defines += cdefs;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-02-04 06:20:56 +04:00
|
|
|
std::string lang =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GlobalGenerator->GetLanguageFromExtension(sf.GetExtension().c_str());
|
2014-02-04 06:20:56 +04:00
|
|
|
std::string sourceLang = this->LocalGenerator->GetSourceFileLanguage(sf);
|
2015-08-04 20:19:49 +03:00
|
|
|
const std::string& linkLanguage = this->GeneratorTarget->GetLinkerLanguage();
|
2009-06-26 00:41:57 +04:00
|
|
|
bool needForceLang = false;
|
|
|
|
// source file does not match its extension language
|
2016-05-16 17:34:04 +03:00
|
|
|
if (lang != sourceLang) {
|
2009-06-26 00:41:57 +04:00
|
|
|
needForceLang = true;
|
|
|
|
lang = sourceLang;
|
2016-05-16 17:34:04 +03: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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (needForceLang || (linkLanguage != lang)) {
|
|
|
|
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";
|
2016-05-16 17:34:04 +03: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
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-22 17:27:00 +04:00
|
|
|
bool noWinRT = this->TargetCompileAsWinRT && lang == "C";
|
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";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!objectName.empty()) {
|
|
|
|
(*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);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "$(IntDir)/" << objectName
|
|
|
|
<< "</ObjectFileName>\n";
|
|
|
|
}
|
|
|
|
for (std::vector<std::string>::const_iterator config =
|
|
|
|
this->Configurations.begin();
|
|
|
|
config != this->Configurations.end(); ++config) {
|
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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* ccdefs = sf.GetProperty(defPropName.c_str())) {
|
|
|
|
if (!configDefines.empty()) {
|
2009-07-14 00:58:24 +04:00
|
|
|
configDefines += ";";
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03: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
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!flags.empty() || !configDefines.empty() || compileAs || noWinRT) {
|
|
|
|
(*this->BuildFileStream) << firstString;
|
2009-06-26 00:41:57 +04:00
|
|
|
firstString = ""; // only do firstString once
|
|
|
|
hasFlags = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVisualStudioGeneratorOptions clOptions(
|
|
|
|
this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler,
|
|
|
|
this->GetClFlagTable(), 0, this);
|
|
|
|
if (compileAs) {
|
2014-06-05 20:56:39 +04:00
|
|
|
clOptions.AddFlag("CompileAs", compileAs);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (noWinRT) {
|
2014-08-22 17:27:00 +04:00
|
|
|
clOptions.AddFlag("CompileAsWinRT", "false");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.Parse(flags.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (clOptions.HasFlag("AdditionalIncludeDirectories")) {
|
2014-08-13 22:09:24 +04:00
|
|
|
clOptions.AppendFlag("AdditionalIncludeDirectories",
|
|
|
|
"%(AdditionalIncludeDirectories)");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (clOptions.HasFlag("DisableSpecificWarnings")) {
|
2014-12-04 23:32:32 +03:00
|
|
|
clOptions.AppendFlag("DisableSpecificWarnings",
|
|
|
|
"%(DisableSpecificWarnings)");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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, " ");
|
2016-05-16 17:34:04 +03:00
|
|
|
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
|
|
|
|
"\n", lang);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (this->IsXamlSource(source->GetFullPath())) {
|
2015-03-31 23:49:39 +03:00
|
|
|
(*this->BuildFileStream) << firstString;
|
|
|
|
firstString = ""; // only do firstString once
|
|
|
|
hasFlags = true;
|
|
|
|
this->WriteString("<DependentUpon>", 3);
|
|
|
|
const std::string& fileName = source->GetFullPath();
|
|
|
|
std::string xamlFileName = fileName.substr(0, fileName.find_last_of("."));
|
|
|
|
(*this->BuildFileStream) << xamlFileName << "</DependentUpon>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-03-31 23:49:39 +03:00
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
return hasFlags;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
|
|
|
|
{
|
2015-10-15 00:44:21 +03:00
|
|
|
cmState::TargetType ttype = this->GeneratorTarget->GetType();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (ttype > cmState::GLOBAL_TARGET) {
|
2009-07-10 17:12:39 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</_ProjectFileVersion>\n",
|
|
|
|
3);
|
|
|
|
for (std::vector<std::string>::const_iterator config =
|
|
|
|
this->Configurations.begin();
|
|
|
|
config != this->Configurations.end(); ++config) {
|
|
|
|
if (ttype >= cmState::UTILITY) {
|
2010-09-13 21:29:10 +04:00
|
|
|
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
|
|
|
|
*this->BuildFileStream
|
|
|
|
<< "$(Platform)\\$(Configuration)\\$(ProjectName)\\"
|
|
|
|
<< "</IntDir>\n";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
std::string intermediateDir =
|
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2010-09-13 21:29:10 +04:00
|
|
|
intermediateDir += "/";
|
|
|
|
intermediateDir += *config;
|
|
|
|
intermediateDir += "/";
|
2012-03-12 18:55:07 +04:00
|
|
|
std::string outDir;
|
|
|
|
std::string targetNameFull;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (ttype == cmState::OBJECT_LIBRARY) {
|
2012-03-12 18:55:07 +04:00
|
|
|
outDir = intermediateDir;
|
2015-10-16 21:09:43 +03:00
|
|
|
targetNameFull = this->GeneratorTarget->GetName();
|
2012-03-12 18:55:07 +04:00
|
|
|
targetNameFull += ".lib";
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-10-20 22:31:47 +04:00
|
|
|
outDir = this->GeneratorTarget->GetDirectory(config->c_str()) + "/";
|
2015-08-04 20:19:48 +03:00
|
|
|
targetNameFull = this->GeneratorTarget->GetFullName(config->c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-09-13 21:29:10 +04:00
|
|
|
this->ConvertToWindowsSlash(intermediateDir);
|
|
|
|
this->ConvertToWindowsSlash(outDir);
|
|
|
|
|
|
|
|
this->WritePlatformConfigTag("OutDir", config->c_str(), 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(outDir) << "</OutDir>\n";
|
2010-09-13 21:29:10 +04:00
|
|
|
|
|
|
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (ext.empty()) {
|
2014-06-04 23:51:08 +04:00
|
|
|
// An empty TargetExt causes a default extension to be used.
|
|
|
|
// A single "." appears to be treated as an empty extension.
|
|
|
|
ext = ".";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteString("</PropertyGroup>\n", 2);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::OutputLinkIncremental(
|
|
|
|
std::string const& configName)
|
2012-08-13 21:42:58 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->MSTools) {
|
2014-09-26 18:12:31 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// static libraries and things greater than modules do not need
|
|
|
|
// to set this option
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
|
|
|
|
this->GeneratorTarget->GetType() > cmState::MODULE_LIBRARY) {
|
2009-06-26 00:41:57 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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);
|
2016-05-16 17:34:04 +03: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);
|
2016-05-16 17:34:04 +03: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.
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* flags[] = { "LinkDelaySign", "LinkKeyFile", 0 };
|
|
|
|
for (const char** f = flags; *f; ++f) {
|
2012-10-26 19:02:42 +04:00
|
|
|
const char* flag = *f;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* value = linkOptions.GetFlag(flag)) {
|
2012-10-26 19:02:42 +04:00
|
|
|
this->WritePlatformConfigTag(flag, configName.c_str(), 3);
|
|
|
|
*this->BuildFileStream << value << "</" << flag << ">\n";
|
|
|
|
linkOptions.RemoveFlag(flag);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2010-09-30 16:48:38 +04:00
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeClOptions()
|
2009-10-23 19:34:37 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
|
|
|
if (!this->ComputeClOptions(*i)) {
|
2010-09-30 16:48:38 +04:00
|
|
|
return false;
|
2009-10-23 19:34:37 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03: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
|
|
|
|
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.
|
|
|
|
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<Options> pOptions(new Options(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator, Options::Compiler, 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 =
|
2015-08-04 20:19:49 +03:00
|
|
|
this->GeneratorTarget->GetLinkerLanguage(configName.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (linkLanguage.empty()) {
|
|
|
|
cmSystemTools::Error(
|
|
|
|
"CMake can not determine linker language for target: ",
|
|
|
|
this->Name.c_str());
|
2014-06-05 19:50:10 +04:00
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (linkLanguage == "C" || linkLanguage == "CXX" ||
|
|
|
|
linkLanguage == "Fortran") {
|
2014-06-05 19:50:10 +04:00
|
|
|
std::string baseFlagVar = "CMAKE_";
|
|
|
|
baseFlagVar += linkLanguage;
|
|
|
|
baseFlagVar += "_FLAGS";
|
2016-05-16 17:34:04 +03:00
|
|
|
flags =
|
|
|
|
this->GeneratorTarget->Target->GetMakefile()->GetRequiredDefinition(
|
|
|
|
baseFlagVar.c_str());
|
|
|
|
std::string flagVar =
|
|
|
|
baseFlagVar + std::string("_") + cmSystemTools::UpperCase(configName);
|
2014-06-05 19:50:10 +04:00
|
|
|
flags += " ";
|
2016-05-16 17:34:04 +03:00
|
|
|
flags +=
|
|
|
|
this->GeneratorTarget->Target->GetMakefile()->GetRequiredDefinition(
|
|
|
|
flagVar.c_str());
|
|
|
|
}
|
2014-06-05 19:50:10 +04:00
|
|
|
// set the correct language
|
2016-05-16 17:34:04 +03:00
|
|
|
if (linkLanguage == "C") {
|
2014-06-05 20:56:39 +04:00
|
|
|
clOptions.AddFlag("CompileAs", "CompileAsC");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (linkLanguage == "CXX") {
|
2014-06-05 20:56:39 +04:00
|
|
|
clOptions.AddFlag("CompileAs", "CompileAsCpp");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-09 23:19:57 +03:00
|
|
|
this->LocalGenerator->AddCompileOptions(flags, this->GeneratorTarget,
|
2014-06-05 19:50:10 +04:00
|
|
|
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.
|
2015-10-22 19:27:57 +03:00
|
|
|
std::string defineFlags =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags();
|
|
|
|
if (this->MSTools) {
|
2014-06-10 18:13:00 +04:00
|
|
|
clOptions.FixExceptionHandlingDefault();
|
|
|
|
clOptions.AddFlag("PrecompiledHeader", "NotUsing");
|
|
|
|
std::string asmLocation = configName + "/";
|
|
|
|
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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;
|
2015-08-05 01:00:53 +03:00
|
|
|
this->GeneratorTarget->GetCompileDefinitions(targetDefines,
|
2016-05-16 17:34:04 +03:00
|
|
|
configName.c_str(), "CXX");
|
2013-06-06 20:13:35 +04:00
|
|
|
clOptions.AddDefines(targetDefines);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
2014-06-10 18:13:00 +04:00
|
|
|
clOptions.SetVerboseMakefile(
|
|
|
|
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* exportMacro = this->GeneratorTarget->GetExportMacro()) {
|
2009-06-26 00:41:57 +04:00
|
|
|
clOptions.AddDefine(exportMacro);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-10-23 19:34:37 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
2014-08-11 22:21:16 +04:00
|
|
|
// If we have the VS_WINRT_COMPONENT set then force Compile as WinRT.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT")) {
|
2014-08-11 22:21:16 +04:00
|
|
|
clOptions.AddFlag("CompileAsWinRT", "true");
|
|
|
|
// For WinRT components, add the _WINRT_DLL define to produce a lib
|
2015-10-08 01:21:51 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
|
2014-08-11 22:21:16 +04:00
|
|
|
clOptions.AddDefine("_WINRT_DLL");
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->GlobalGenerator->TargetsWindowsStore() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsPhone()) {
|
|
|
|
if (!clOptions.IsWinRt()) {
|
2014-08-11 22:21:16 +04:00
|
|
|
clOptions.AddFlag("CompileAsWinRT", "false");
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (const char* winRT = clOptions.GetFlag("CompileAsWinRT")) {
|
|
|
|
if (cmSystemTools::IsOn(winRT)) {
|
2014-08-22 17:27:00 +04:00
|
|
|
this->TargetCompileAsWinRT = true;
|
|
|
|
}
|
2014-08-11 22:21:16 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-11 22:21:16 +04:00
|
|
|
|
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(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string const& configName, std::vector<std::string> const& includes)
|
2009-10-23 19:34:37 +04:00
|
|
|
{
|
|
|
|
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");
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NsightTegra) {
|
|
|
|
if (const char* processMax =
|
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_PROCESS_MAX")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<ProcessMax>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(processMax)
|
|
|
|
<< "</ProcessMax>\n";
|
2015-06-25 20:15:06 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
2016-09-28 09:46:00 +03:00
|
|
|
cmsys::RegularExpression clangToolset(
|
|
|
|
"(v[0-9]+_clang_.*|LLVM-vs[0-9]+.*)");
|
2016-02-18 03:06:52 +03:00
|
|
|
const char* toolset = this->GlobalGenerator->GetPlatformToolset();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (toolset && clangToolset.find(toolset)) {
|
2016-02-18 03:06:52 +03:00
|
|
|
this->WriteString("<ObjectFileName>"
|
|
|
|
"$(IntDir)%(filename).obj"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</ObjectFileName>\n",
|
|
|
|
3);
|
|
|
|
} else {
|
2016-02-18 03:06:52 +03:00
|
|
|
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!clOptions.IsDebug()) {
|
2014-06-10 18:13:00 +04:00
|
|
|
this->WriteString("<DebugInformationFormat>"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</DebugInformationFormat>\n",
|
|
|
|
3);
|
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
|
|
|
|
// Specify the compiler program database file if configured.
|
2015-08-04 20:19:45 +03:00
|
|
|
std::string pdb =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetCompilePDBPath(configName.c_str());
|
|
|
|
if (!pdb.empty()) {
|
2014-06-10 18:13:00 +04:00
|
|
|
this->ConvertToWindowsSlash(pdb);
|
|
|
|
this->WriteString("<ProgramDataBaseFileName>", 3);
|
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(pdb)
|
|
|
|
<< "</ProgramDataBaseFileName>\n";
|
2014-02-24 23:15:21 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
|
|
|
if (!this->ComputeRcOptions(*i)) {
|
2014-07-10 03:01:18 +04:00
|
|
|
return false;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-10 03:01:18 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
|
|
|
|
std::string const& configName)
|
|
|
|
{
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<Options> pOptions(new Options(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable()));
|
2014-07-10 03:01:18 +04:00
|
|
|
Options& rcOptions = *pOptions;
|
|
|
|
|
|
|
|
std::string CONFIG = cmSystemTools::UpperCase(configName);
|
|
|
|
std::string rcConfigFlagsVar = std::string("CMAKE_RC_FLAGS_") + CONFIG;
|
|
|
|
std::string flags =
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string(this->Makefile->GetSafeDefinition("CMAKE_RC_FLAGS")) +
|
|
|
|
std::string(" ") +
|
|
|
|
std::string(this->Makefile->GetSafeDefinition(rcConfigFlagsVar));
|
2014-07-10 03:01:18 +04:00
|
|
|
|
|
|
|
rcOptions.Parse(flags.c_str());
|
|
|
|
this->RcOptions[configName] = pOptions.release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteRCOptions(
|
|
|
|
std::string const& configName, std::vector<std::string> const& includes)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->MSTools) {
|
2014-06-10 18:13:00 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
|
2014-08-13 19:20:20 +04:00
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->GlobalGenerator->IsMasmEnabled()) {
|
2014-08-13 19:20:20 +04:00
|
|
|
return true;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
|
|
|
if (!this->ComputeMasmOptions(*i)) {
|
2014-08-13 19:20:20 +04:00
|
|
|
return false;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-13 19:20:20 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
|
|
|
|
std::string const& configName)
|
|
|
|
{
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<Options> pOptions(new Options(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable()));
|
2014-08-13 19:20:20 +04:00
|
|
|
Options& masmOptions = *pOptions;
|
|
|
|
|
|
|
|
std::string CONFIG = cmSystemTools::UpperCase(configName);
|
|
|
|
std::string configFlagsVar = std::string("CMAKE_ASM_MASM_FLAGS_") + CONFIG;
|
|
|
|
std::string flags =
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string(this->Makefile->GetSafeDefinition("CMAKE_ASM_MASM_FLAGS")) +
|
|
|
|
std::string(" ") +
|
|
|
|
std::string(this->Makefile->GetSafeDefinition(configFlagsVar));
|
2014-08-13 19:20:20 +04:00
|
|
|
|
|
|
|
masmOptions.Parse(flags.c_str());
|
|
|
|
this->MasmOptions[configName] = pOptions.release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteMasmOptions(
|
|
|
|
std::string const& configName, std::vector<std::string> const& includes)
|
2014-08-13 19:20:20 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->MSTools || !this->GlobalGenerator->IsMasmEnabled()) {
|
2014-08-13 19:20:20 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-13 19:20:20 +04:00
|
|
|
this->WriteString("<MASM>\n", 2);
|
|
|
|
|
|
|
|
// Preprocessor definitions and includes are shared with clOptions.
|
|
|
|
Options& clOptions = *(this->ClOptions[configName]);
|
|
|
|
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
|
|
|
|
"\n", "ASM_MASM");
|
|
|
|
|
|
|
|
Options& masmOptions = *(this->MasmOptions[configName]);
|
|
|
|
masmOptions.AppendFlag("IncludePaths", includes);
|
|
|
|
masmOptions.AppendFlag("IncludePaths", "%(IncludePaths)");
|
|
|
|
masmOptions.OutputFlagMap(*this->BuildFileStream, " ");
|
|
|
|
masmOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
|
|
|
|
|
|
|
|
this->WriteString("</MASM>\n", 2);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteLibOptions(
|
|
|
|
std::string const& config)
|
2009-06-28 16:59:56 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() != cmState::STATIC_LIBRARY &&
|
|
|
|
this->GeneratorTarget->GetType() != cmState::OBJECT_LIBRARY) {
|
2009-06-28 16:59:56 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2013-07-10 21:11:04 +04:00
|
|
|
std::string libflags;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->GetStaticLibraryFlags(
|
|
|
|
libflags, cmSystemTools::UpperCase(config), this->GeneratorTarget);
|
|
|
|
if (!libflags.empty()) {
|
2009-06-28 16:59:56 +04:00
|
|
|
this->WriteString("<Lib>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVisualStudioGeneratorOptions libOptions(
|
|
|
|
this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker,
|
|
|
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-11 22:40:09 +04:00
|
|
|
|
|
|
|
// We cannot generate metadata for static libraries. WindowsPhone
|
|
|
|
// and WindowsStore tools look at GenerateWindowsMetadata in the
|
|
|
|
// Link tool options even for static libraries.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsStore()) {
|
2014-08-11 22:40:09 +04:00
|
|
|
this->WriteString("<Link>\n", 2);
|
|
|
|
this->WriteString("<GenerateWindowsMetadata>false"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</GenerateWindowsMetadata>\n",
|
|
|
|
3);
|
2014-08-11 22:40:09 +04:00
|
|
|
this->WriteString("</Link>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-28 16:59:56 +04:00
|
|
|
}
|
|
|
|
|
2015-09-16 17:24:16 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteManifestOptions(
|
|
|
|
std::string const& config)
|
|
|
|
{
|
2015-10-08 01:21:51 +03:00
|
|
|
if (this->GeneratorTarget->GetType() != cmState::EXECUTABLE &&
|
|
|
|
this->GeneratorTarget->GetType() != cmState::SHARED_LIBRARY &&
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetType() != cmState::MODULE_LIBRARY) {
|
2015-09-16 17:24:16 +03:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-09-16 17:24:16 +03:00
|
|
|
|
|
|
|
std::vector<cmSourceFile const*> manifest_srcs;
|
|
|
|
this->GeneratorTarget->GetManifests(manifest_srcs, config);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!manifest_srcs.empty()) {
|
2015-09-16 17:24:16 +03:00
|
|
|
this->WriteString("<Manifest>\n", 2);
|
|
|
|
this->WriteString("<AdditionalManifestFiles>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator mi =
|
|
|
|
manifest_srcs.begin();
|
|
|
|
mi != manifest_srcs.end(); ++mi) {
|
2015-09-16 17:24:16 +03:00
|
|
|
std::string m = this->ConvertPath((*mi)->GetFullPath(), false);
|
|
|
|
this->ConvertToWindowsSlash(m);
|
|
|
|
(*this->BuildFileStream) << m << ";";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-09-16 17:24:16 +03:00
|
|
|
(*this->BuildFileStream) << "</AdditionalManifestFiles>\n";
|
|
|
|
this->WriteString("</Manifest>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-09-16 17:24:16 +03:00
|
|
|
}
|
2014-09-02 22:33:17 +04:00
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
|
2015-06-25 20:15:06 +03:00
|
|
|
std::string const& configName)
|
2014-09-02 22:33:17 +04:00
|
|
|
{
|
|
|
|
// Look through the sources for AndroidManifest.xml and use
|
|
|
|
// its location as the root source directory.
|
2015-10-07 20:25:29 +03:00
|
|
|
std::string rootDir = this->LocalGenerator->GetCurrentSourceDirectory();
|
2014-09-02 22:33:17 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::vector<cmSourceFile const*> extraSources;
|
|
|
|
this->GeneratorTarget->GetExtraSources(extraSources, "");
|
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
extraSources.begin();
|
|
|
|
si != extraSources.end(); ++si) {
|
|
|
|
if ("androidmanifest.xml" ==
|
|
|
|
cmSystemTools::LowerCase((*si)->GetLocation().GetName())) {
|
|
|
|
rootDir = (*si)->GetLocation().GetDirectory();
|
|
|
|
break;
|
2014-09-02 22:33:17 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tell MSBuild to launch Ant.
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string antBuildPath = rootDir;
|
|
|
|
this->WriteString("<AntBuild>\n", 2);
|
|
|
|
this->WriteString("<AntBuildPath>", 3);
|
|
|
|
this->ConvertToWindowsSlash(antBuildPath);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(antBuildPath)
|
|
|
|
<< "</AntBuildPath>\n";
|
2014-09-02 22:33:17 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_SKIP_ANT_STEP")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<SkipAntStep>true</SkipAntStep>\n", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("ANDROID_PROGUARD")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<EnableProGuard>true</EnableProGuard>\n", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* proGuardConfigLocation =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_PROGUARD_CONFIG_PATH")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<ProGuardConfigLocation>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(proGuardConfigLocation)
|
|
|
|
<< "</ProGuardConfigLocation>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* securePropertiesLocation =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_SECURE_PROPS_PATH")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<SecurePropertiesLocation>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(securePropertiesLocation)
|
|
|
|
<< "</SecurePropertiesLocation>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* nativeLibDirectoriesExpression =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
cmGeneratorExpression ge;
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
|
2016-05-16 17:34:04 +03:00
|
|
|
ge.Parse(nativeLibDirectoriesExpression);
|
|
|
|
std::string nativeLibDirs =
|
|
|
|
cge->Evaluate(this->LocalGenerator, configName);
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<NativeLibDirectories>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDirs)
|
|
|
|
<< "</NativeLibDirectories>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* nativeLibDependenciesExpression =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty(
|
|
|
|
"ANDROID_NATIVE_LIB_DEPENDENCIES")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
cmGeneratorExpression ge;
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
|
2016-05-16 17:34:04 +03:00
|
|
|
ge.Parse(nativeLibDependenciesExpression);
|
|
|
|
std::string nativeLibDeps =
|
|
|
|
cge->Evaluate(this->LocalGenerator, configName);
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<NativeLibDependencies>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(nativeLibDeps)
|
|
|
|
<< "</NativeLibDependencies>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* javaSourceDir =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_JAVA_SOURCE_DIR")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<JavaSourceDir>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(javaSourceDir)
|
|
|
|
<< "</JavaSourceDir>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* jarDirectoriesExpression =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
cmGeneratorExpression ge;
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
|
2015-06-25 20:15:06 +03:00
|
|
|
ge.Parse(jarDirectoriesExpression);
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string jarDirectories =
|
|
|
|
cge->Evaluate(this->LocalGenerator, configName);
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<JarDirectories>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(jarDirectories)
|
|
|
|
<< "</JarDirectories>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* jarDeps =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_JAR_DEPENDENCIES")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<JarDependencies>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(jarDeps)
|
|
|
|
<< "</JarDependencies>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
|
|
|
if (const char* assetsDirectories =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_ASSETS_DIRECTORIES")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<AssetsDirectories>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(assetsDirectories)
|
|
|
|
<< "</AssetsDirectories>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
2014-09-02 22:33:17 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string manifest_xml = rootDir + "/AndroidManifest.xml";
|
|
|
|
this->ConvertToWindowsSlash(manifest_xml);
|
|
|
|
this->WriteString("<AndroidManifestLocation>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(manifest_xml)
|
|
|
|
<< "</AndroidManifestLocation>\n";
|
2014-09-02 22:33:17 +04:00
|
|
|
}
|
|
|
|
|
2015-06-25 20:15:06 +03:00
|
|
|
if (const char* antAdditionalOptions =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("ANDROID_ANT_ADDITIONAL_OPTIONS")) {
|
2015-06-25 20:15:06 +03:00
|
|
|
this->WriteString("<AdditionalOptions>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(antAdditionalOptions)
|
|
|
|
<< " %(AdditionalOptions)</AdditionalOptions>\n";
|
|
|
|
}
|
2015-06-25 20:15:06 +03:00
|
|
|
|
2014-09-02 22:33:17 +04:00
|
|
|
this->WriteString("</AntBuild>\n", 2);
|
|
|
|
}
|
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE ||
|
|
|
|
this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
|
|
|
|
this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
|
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
|
|
|
if (!this->ComputeLinkOptions(*i)) {
|
2012-10-26 18:16:45 +04:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-10-26 18:16:45 +04:00
|
|
|
return true;
|
|
|
|
}
|
2009-06-28 16:59:56 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
|
|
|
|
std::string const& config)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2016-06-28 17:17:52 +03:00
|
|
|
CM_AUTO_PTR<Options> pOptions(new Options(
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator, Options::Linker, 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 =
|
2015-08-04 20:19:49 +03:00
|
|
|
this->GeneratorTarget->GetLinkerLanguage(config.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (linkLanguage.empty()) {
|
|
|
|
cmSystemTools::Error(
|
|
|
|
"CMake can not determine linker language for target: ",
|
|
|
|
this->Name.c_str());
|
2012-10-26 18:16:45 +04:00
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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";
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::MODULE_LIBRARY) {
|
2009-06-26 00:41:57 +04:00
|
|
|
linkType = "MODULE";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
2009-06-26 00:41:57 +04:00
|
|
|
linkType = "EXE";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string flags;
|
|
|
|
std::string linkFlagVarBase = "CMAKE_";
|
|
|
|
linkFlagVarBase += linkType;
|
|
|
|
linkFlagVarBase += "_LINKER_FLAGS";
|
|
|
|
flags += " ";
|
2016-05-16 17:34:04 +03:00
|
|
|
flags += this->GeneratorTarget->Target->GetMakefile()->GetRequiredDefinition(
|
|
|
|
linkFlagVarBase.c_str());
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string linkFlagVar = linkFlagVarBase + "_" + CONFIG;
|
|
|
|
flags += " ";
|
2016-05-16 17:34:04 +03:00
|
|
|
flags += this->GeneratorTarget->Target->GetMakefile()->GetRequiredDefinition(
|
|
|
|
linkFlagVar.c_str());
|
2015-10-10 16:51:21 +03:00
|
|
|
const char* targetLinkFlags =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetProperty("LINK_FLAGS");
|
|
|
|
if (targetLinkFlags) {
|
2009-06-26 00:41:57 +04:00
|
|
|
flags += " ";
|
|
|
|
flags += targetLinkFlags;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-05-28 19:00:31 +04:00
|
|
|
std::string flagsProp = "LINK_FLAGS_";
|
|
|
|
flagsProp += CONFIG;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* flagsConfig =
|
|
|
|
this->GeneratorTarget->GetProperty(flagsProp.c_str())) {
|
2010-05-28 19:00:31 +04:00
|
|
|
flags += " ";
|
|
|
|
flags += flagsConfig;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
std::string standardLibsVar = "CMAKE_";
|
|
|
|
standardLibsVar += linkLanguage;
|
|
|
|
standardLibsVar += "_STANDARD_LIBRARIES";
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string libs =
|
|
|
|
this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
|
2009-06-26 00:41:57 +04:00
|
|
|
// Remove trailing spaces from libs
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string::size_type pos = libs.size() - 1;
|
|
|
|
if (!libs.empty()) {
|
|
|
|
while (libs[pos] == ' ') {
|
2009-06-26 00:41:57 +04:00
|
|
|
pos--;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (pos != libs.size() - 1) {
|
|
|
|
libs = libs.substr(0, pos + 1);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// Replace spaces in libs with ;
|
Use std::replace for replacing chars in strings.
Find uses of `cmSystemTools::ReplaceString` where both `replace` and
`with` are string literals with a size of one.
Automate with:
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
2016-05-24 23:58:11 +03:00
|
|
|
std::replace(libs.begin(), libs.end(), ' ', ';');
|
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 =
|
2015-08-04 20:19:42 +03:00
|
|
|
this->GeneratorTarget->GetLinkInformation(config.c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!pcli) {
|
|
|
|
cmSystemTools::Error(
|
|
|
|
"CMake can not compute cmComputeLinkInformation for target: ",
|
|
|
|
this->Name.c_str());
|
2012-10-26 18:16:45 +04:00
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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;
|
2016-05-16 17:34:04 +03: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)");
|
2016-05-16 17:34:04 +03: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;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
2015-08-04 20:19:44 +03:00
|
|
|
this->GeneratorTarget->GetExecutableNames(targetName, targetNameFull,
|
2016-05-16 17:34:04 +03:00
|
|
|
targetNameImport, targetNamePDB,
|
|
|
|
config.c_str());
|
|
|
|
} else {
|
2015-08-04 20:19:45 +03:00
|
|
|
this->GeneratorTarget->GetLibraryNames(targetName, targetNameSO,
|
2016-05-16 17:34:04 +03:00
|
|
|
targetNameFull, targetNameImport,
|
|
|
|
targetNamePDB, config.c_str());
|
|
|
|
}
|
2009-10-23 19:33:27 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
2014-06-10 18:13:00 +04:00
|
|
|
linkOptions.AddFlag("Version", "");
|
2014-06-05 21:18:09 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("WIN32_EXECUTABLE")) {
|
|
|
|
if (this->GlobalGenerator->TargetsWindowsCE()) {
|
2014-09-15 17:46:43 +04:00
|
|
|
linkOptions.AddFlag("SubSystem", "WindowsCE");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
|
|
|
if (this->ClOptions[config]->UsingUnicode()) {
|
2014-12-02 15:33:42 +03:00
|
|
|
linkOptions.AddFlag("EntryPointSymbol", "wWinMainCRTStartup");
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-12-02 15:33:42 +03:00
|
|
|
linkOptions.AddFlag("EntryPointSymbol", "WinMainCRTStartup");
|
2014-09-22 18:19:36 +04:00
|
|
|
}
|
2014-09-15 17:46:43 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-09-15 17:46:43 +04:00
|
|
|
linkOptions.AddFlag("SubSystem", "Windows");
|
2014-06-10 18:13:00 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
if (this->GlobalGenerator->TargetsWindowsCE()) {
|
2014-09-15 17:46:43 +04:00
|
|
|
linkOptions.AddFlag("SubSystem", "WindowsCE");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
|
|
|
if (this->ClOptions[config]->UsingUnicode()) {
|
2014-12-02 15:33:42 +03:00
|
|
|
linkOptions.AddFlag("EntryPointSymbol", "mainWCRTStartup");
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-12-02 15:33:42 +03:00
|
|
|
linkOptions.AddFlag("EntryPointSymbol", "mainACRTStartup");
|
2014-09-22 18:19:36 +04:00
|
|
|
}
|
2014-09-15 17:46:43 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2014-09-15 17:46:43 +04:00
|
|
|
linkOptions.AddFlag("SubSystem", "Console");
|
2016-05-16 17:34:04 +03:00
|
|
|
};
|
|
|
|
}
|
2014-06-05 21:18:09 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* stackVal = this->Makefile->GetDefinition(
|
|
|
|
"CMAKE_" + linkLanguage + "_STACK_SIZE")) {
|
2014-06-10 18:13:00 +04:00
|
|
|
linkOptions.AddFlag("StackReserveSize", stackVal);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
|
2016-01-08 22:38:58 +03:00
|
|
|
if (this->LocalGenerator->GetVersion() >=
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalVisualStudioGenerator::VS14) {
|
2016-01-08 22:38:58 +03:00
|
|
|
linkOptions.AddFlag("GenerateDebugInformation", "No");
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
2016-01-08 22:38:58 +03:00
|
|
|
linkOptions.AddFlag("GenerateDebugInformation", "false");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-01-08 22:38:58 +03:00
|
|
|
|
2015-08-05 19:39:17 +03:00
|
|
|
std::string pdb = this->GeneratorTarget->GetPDBDirectory(config.c_str());
|
2014-06-10 18:13:00 +04:00
|
|
|
pdb += "/";
|
|
|
|
pdb += targetNamePDB;
|
2014-10-20 22:31:47 +04:00
|
|
|
std::string imLib =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetDirectory(config.c_str(), true);
|
2014-06-10 18:13:00 +04:00
|
|
|
imLib += "/";
|
|
|
|
imLib += targetNameImport;
|
|
|
|
|
|
|
|
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
|
|
|
|
linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
|
2014-08-11 22:40:09 +04:00
|
|
|
|
|
|
|
// A Windows Runtime component uses internal .NET metadata,
|
|
|
|
// so does not have an import library.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("VS_WINRT_COMPONENT") &&
|
|
|
|
this->GeneratorTarget->GetType() != cmState::EXECUTABLE) {
|
2014-08-11 22:40:09 +04:00
|
|
|
linkOptions.AddFlag("GenerateWindowsMetadata", "true");
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->GlobalGenerator->TargetsWindowsPhone() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsStore()) {
|
2014-08-11 22:40:09 +04:00
|
|
|
// WindowsPhone and WindowsStore components are in an app container
|
|
|
|
// and produce WindowsMetadata. If we are not producing a WINRT
|
|
|
|
// component, then do not generate the metadata here.
|
|
|
|
linkOptions.AddFlag("GenerateWindowsMetadata", "false");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-11 22:44:35 +04:00
|
|
|
|
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone() &&
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GlobalGenerator->GetSystemVersion() == "8.0") {
|
2014-08-11 22:44:35 +04:00
|
|
|
// WindowsPhone 8.0 does not have ole32.
|
|
|
|
linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries", "ole32.lib");
|
2014-06-05 21:18:09 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->NsightTegra) {
|
2014-06-10 19:33:19 +04:00
|
|
|
linkOptions.AddFlag("SoName", targetNameSO.c_str());
|
2016-05-16 17:34:04 +03: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
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->MSTools) {
|
2015-11-02 17:24:25 +03:00
|
|
|
if (cmSourceFile const* defsrc =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetModuleDefinitionFile("")) {
|
2015-11-02 17:24:25 +03:00
|
|
|
linkOptions.AddFlag("ModuleDefinitionFile",
|
|
|
|
defsrc->GetFullPath().c_str());
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-31 22:03:03 +04:00
|
|
|
linkOptions.AppendFlag("IgnoreSpecificDefaultLibraries",
|
|
|
|
"%(IgnoreSpecificDefaultLibraries)");
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2011-02-09 20:59:09 +03:00
|
|
|
|
2016-07-10 20:24:43 +03:00
|
|
|
if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
|
|
|
|
this->GeneratorTarget->IsExecutableWithExports()) &&
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
|
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool(
|
|
|
|
"WINDOWS_EXPORT_ALL_SYMBOLS")) {
|
2015-06-19 23:12:43 +03:00
|
|
|
linkOptions.AddFlag("ModuleDefinitionFile", "$(IntDir)exportall.def");
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-06-19 23:12:43 +03:00
|
|
|
|
2016-02-24 20:15:48 +03:00
|
|
|
// Hack to fix flag version selection in a common use case.
|
|
|
|
// FIXME: Select flag table based on toolset instead of VS version.
|
|
|
|
if (this->LocalGenerator->GetVersion() >=
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalVisualStudioGenerator::VS14) {
|
2016-02-24 20:15:48 +03:00
|
|
|
cmGlobalVisualStudio10Generator* gg =
|
|
|
|
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
|
|
|
|
const char* toolset = gg->GetPlatformToolset();
|
2016-08-05 22:20:20 +03:00
|
|
|
if (toolset &&
|
2016-09-01 21:43:59 +03:00
|
|
|
(toolset == kWINDOWS_7_1_SDK || /* clang-format please break here */
|
|
|
|
cmHasLiteralPrefix(toolset, "v80") ||
|
|
|
|
cmHasLiteralPrefix(toolset, "v90") ||
|
2016-08-05 22:20:20 +03:00
|
|
|
cmHasLiteralPrefix(toolset, "v100") ||
|
|
|
|
cmHasLiteralPrefix(toolset, "v110") ||
|
|
|
|
cmHasLiteralPrefix(toolset, "v120"))) {
|
2016-05-16 17:34:04 +03:00
|
|
|
if (const char* debug =
|
|
|
|
linkOptions.GetFlag("GenerateDebugInformation")) {
|
2016-02-24 20:15:48 +03:00
|
|
|
// Convert value from enumeration back to boolean for older toolsets.
|
2016-05-16 17:34:04 +03:00
|
|
|
if (strcmp(debug, "No") == 0) {
|
2016-02-24 20:15:48 +03:00
|
|
|
linkOptions.AddFlag("GenerateDebugInformation", "false");
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (strcmp(debug, "Debug") == 0) {
|
2016-02-24 20:15:48 +03:00
|
|
|
linkOptions.AddFlag("GenerateDebugInformation", "true");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2016-02-24 20:15:48 +03:00
|
|
|
|
2012-10-26 18:16:45 +04:00
|
|
|
this->LinkOptions[config] = pOptions.release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteLinkOptions(
|
|
|
|
std::string const& config)
|
2012-10-26 18:16:45 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY ||
|
|
|
|
this->GeneratorTarget->GetType() > cmState::MODULE_LIBRARY) {
|
2012-10-26 18:16:45 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-10-26 18:16:45 +04:00
|
|
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->GlobalGenerator->NeedLinkLibraryDependencies(
|
|
|
|
this->GeneratorTarget)) {
|
2009-10-21 00:38:37 +04:00
|
|
|
this->WriteString("<ProjectReference>\n", 2);
|
|
|
|
this->WriteString(
|
2015-10-02 21:34:55 +03:00
|
|
|
"<LinkLibraryDependencies>false</LinkLibraryDependencies>\n", 3);
|
2009-10-21 00:38:37 +04:00
|
|
|
this->WriteString("</ProjectReference>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::AddLibraries(
|
2016-05-16 17:34:04 +03:00
|
|
|
cmComputeLinkInformation& cli, 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();
|
2016-09-07 00:52:42 +03:00
|
|
|
std::string currentBinDir =
|
|
|
|
this->LocalGenerator->GetCurrentBinaryDirectory();
|
2016-05-16 17:34:04 +03:00
|
|
|
for (ItemVector::const_iterator l = libs.begin(); l != libs.end(); ++l) {
|
|
|
|
if (l->IsPath) {
|
2016-08-27 14:44:56 +03:00
|
|
|
std::string path = this->LocalGenerator->ConvertToRelativePath(
|
2016-09-07 00:52:42 +03:00
|
|
|
currentBinDir, l->Value.c_str());
|
2009-11-19 00:14:36 +03:00
|
|
|
this->ConvertToWindowsSlash(path);
|
2014-07-23 19:13:13 +04:00
|
|
|
libVec.push_back(path);
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (!l->Target ||
|
|
|
|
l->Target->GetType() != cmState::INTERFACE_LIBRARY) {
|
2014-07-23 19:13:13 +04:00
|
|
|
libVec.push_back(l->Value);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteMidlOptions(
|
|
|
|
std::string const& /*config*/, std::vector<std::string> const& includes)
|
2009-06-26 00:41:57 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!this->MSTools) {
|
2014-06-10 18:13:00 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-06-10 18:13:00 +04:00
|
|
|
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i = includes.begin();
|
|
|
|
i != includes.end(); ++i) {
|
2014-08-13 22:09:24 +04:00
|
|
|
*this->BuildFileStream << cmVS10EscapeXML(*i) << ";";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-13 22:09:24 +04:00
|
|
|
this->WriteString("%(AdditionalIncludeDirectories)"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</AdditionalIncludeDirectories>\n",
|
|
|
|
0);
|
2015-02-24 18:34:15 +03:00
|
|
|
this->WriteString("<OutputDirectory>$(ProjectDir)/$(IntDir)"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</OutputDirectory>\n",
|
|
|
|
3);
|
2011-01-05 02:51:15 +03:00
|
|
|
this->WriteString("<HeaderFileName>%(Filename).h</HeaderFileName>\n", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
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
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<std::string>::const_iterator i =
|
|
|
|
this->Configurations.begin();
|
|
|
|
i != this->Configurations.end(); ++i) {
|
2012-10-15 12:42:42 +04:00
|
|
|
std::vector<std::string> includes;
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->GetIncludeDirectories(
|
|
|
|
includes, this->GeneratorTarget, "C", i->c_str());
|
|
|
|
for (std::vector<std::string>::iterator ii = includes.begin();
|
|
|
|
ii != includes.end(); ++ii) {
|
2014-08-13 21:24:48 +04:00
|
|
|
this->ConvertToWindowsSlash(*ii);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WritePlatformConfigTag("ItemDefinitionGroup", i->c_str(), 1);
|
|
|
|
*this->BuildFileStream << "\n";
|
|
|
|
// output cl compile flags <ClCompile></ClCompile>
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() <= cmState::OBJECT_LIBRARY) {
|
2009-06-26 00:41:57 +04:00
|
|
|
this->WriteClOptions(*i, includes);
|
|
|
|
// output rc compile flags <ResourceCompile></ResourceCompile>
|
|
|
|
this->WriteRCOptions(*i, includes);
|
2014-08-13 19:20:20 +04:00
|
|
|
this->WriteMasmOptions(*i, includes);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
// 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);
|
2015-09-16 17:24:16 +03:00
|
|
|
// output manifest flags <Manifest></Manifest>
|
|
|
|
this->WriteManifestOptions(*i);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->NsightTegra &&
|
|
|
|
this->GeneratorTarget->GetType() == cmState::EXECUTABLE &&
|
|
|
|
this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) {
|
2014-09-02 22:33:17 +04:00
|
|
|
this->WriteAntBuildOptions(*i);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemDefinitionGroup>\n", 1);
|
|
|
|
}
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteEvents(
|
|
|
|
std::string const& configName)
|
2009-07-10 17:12:39 +04:00
|
|
|
{
|
2015-06-19 23:12:43 +03:00
|
|
|
bool addedPrelink = false;
|
2016-07-10 20:24:43 +03:00
|
|
|
if ((this->GeneratorTarget->GetType() == cmState::SHARED_LIBRARY ||
|
|
|
|
this->GeneratorTarget->IsExecutableWithExports()) &&
|
2016-05-16 17:34:04 +03:00
|
|
|
this->Makefile->IsOn("CMAKE_SUPPORT_WINDOWS_EXPORT_ALL_SYMBOLS")) {
|
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool(
|
|
|
|
"WINDOWS_EXPORT_ALL_SYMBOLS")) {
|
2015-06-19 23:12:43 +03:00
|
|
|
addedPrelink = true;
|
|
|
|
std::vector<cmCustomCommand> commands =
|
2015-10-23 01:42:58 +03:00
|
|
|
this->GeneratorTarget->GetPreLinkCommands();
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GlobalGenerator->AddSymbolExportCommand(this->GeneratorTarget,
|
|
|
|
commands, configName);
|
2015-06-19 23:12:43 +03:00
|
|
|
this->WriteEvent("PreLinkEvent", commands, configName);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!addedPrelink) {
|
2015-06-19 23:12:43 +03:00
|
|
|
this->WriteEvent("PreLinkEvent",
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetPreLinkCommands(), configName);
|
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteEvent("PreBuildEvent",
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetPreBuildCommands(), configName);
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteEvent("PostBuildEvent",
|
2016-05-16 17:34:04 +03:00
|
|
|
this->GeneratorTarget->GetPostBuildCommands(), configName);
|
2009-07-10 17:12:39 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteEvent(
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* name, std::vector<cmCustomCommand> const& commands,
|
2009-07-10 17:12:39 +04:00
|
|
|
std::string const& configName)
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if (commands.empty()) {
|
2009-07-10 17:12:39 +04:00
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << name << ">\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
|
|
|
|
std::string script;
|
|
|
|
const char* pre = "";
|
|
|
|
std::string comment;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmCustomCommand>::const_iterator i = commands.begin();
|
|
|
|
i != commands.end(); ++i) {
|
2015-07-25 18:52:10 +03:00
|
|
|
cmCustomCommandGenerator ccg(*i, configName, this->LocalGenerator);
|
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));
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2010-10-02 00:12:00 +04:00
|
|
|
comment = cmVS10EscapeComment(comment);
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("<Message>", 3);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<Command>", 3);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << script;
|
|
|
|
(*this->BuildFileStream) << "</Command>"
|
|
|
|
<< "\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("</", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << name << ">\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
}
|
|
|
|
|
2009-06-26 00:41:57 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteProjectReferences()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
cmGlobalGenerator::TargetDependSet const& unordered =
|
|
|
|
this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget);
|
2010-10-07 17:54:24 +04:00
|
|
|
typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet
|
|
|
|
OrderedTargetDependSet;
|
2015-09-22 17:20:44 +03:00
|
|
|
OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET);
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
2016-05-16 17:34:04 +03:00
|
|
|
for (OrderedTargetDependSet::const_iterator i = depends.begin();
|
|
|
|
i != depends.end(); ++i) {
|
2015-10-22 19:27:57 +03:00
|
|
|
cmGeneratorTarget const* dt = *i;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (dt->GetType() == cmState::INTERFACE_LIBRARY) {
|
2012-11-02 18:47:40 +04:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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
|
2016-05-16 17:34:04 +03:00
|
|
|
if (static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
|
|
|
|
->TargetIsFortranOnly(dt)) {
|
2011-08-04 01:24:43 +04:00
|
|
|
continue;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("<ProjectReference Include=\"", 2);
|
2015-10-22 19:27:57 +03:00
|
|
|
cmLocalGenerator* lg = dt->GetLocalGenerator();
|
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");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (p) {
|
2009-07-14 22:16:46 +04:00
|
|
|
path = p;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else {
|
|
|
|
path = lg->GetCurrentBinaryDirectory();
|
2009-07-14 00:58:24 +04:00
|
|
|
path += "/";
|
|
|
|
path += dt->GetName();
|
|
|
|
path += ".vcxproj";
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
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);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str())
|
|
|
|
<< "</Project>\n";
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("</ProjectReference>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2009-07-10 17:12:39 +04:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
2009-06-26 00:41:57 +04:00
|
|
|
}
|
2013-04-29 18:48:22 +04:00
|
|
|
|
2015-10-02 21:34:55 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WritePlatformExtensions()
|
|
|
|
{
|
|
|
|
// This only applies to Windows 10 apps
|
|
|
|
if (this->GlobalGenerator->TargetsWindowsStore() &&
|
2016-05-16 17:34:04 +03:00
|
|
|
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) {
|
2015-10-02 21:34:55 +03:00
|
|
|
const char* desktopExtensionsVersion =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (desktopExtensionsVersion) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteSinglePlatformExtension("WindowsDesktop",
|
|
|
|
desktopExtensionsVersion);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-02 21:34:55 +03:00
|
|
|
const char* mobileExtensionsVersion =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (mobileExtensionsVersion) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteSinglePlatformExtension("WindowsMobile",
|
|
|
|
mobileExtensionsVersion);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-02 21:34:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string const& extension, std::string const& version)
|
2015-10-02 21:34:55 +03:00
|
|
|
{
|
|
|
|
this->WriteString("<Import Project=", 2);
|
|
|
|
(*this->BuildFileStream)
|
|
|
|
<< "\"$([Microsoft.Build.Utilities.ToolLocationHelper]"
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "::GetPlatformExtensionSDKLocation(`" << extension
|
|
|
|
<< ", Version=" << version
|
2015-10-02 21:34:55 +03:00
|
|
|
<< "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, "
|
|
|
|
<< "$(ExtensionSDKDirectoryRoot), null))"
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "\\DesignTime\\CommonConfiguration\\Neutral\\" << extension
|
|
|
|
<< ".props\" "
|
2015-10-02 21:34:55 +03:00
|
|
|
<< "Condition=\"exists('$("
|
|
|
|
<< "[Microsoft.Build.Utilities.ToolLocationHelper]"
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "::GetPlatformExtensionSDKLocation(`" << extension
|
|
|
|
<< ", Version=" << version
|
2015-10-02 21:34:55 +03:00
|
|
|
<< "`, $(TargetPlatformIdentifier), $(TargetPlatformVersion), null, "
|
|
|
|
<< "$(ExtensionSDKDirectoryRoot), null))"
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "\\DesignTime\\CommonConfiguration\\Neutral\\" << extension
|
|
|
|
<< ".props')\" />\n";
|
2015-10-02 21:34:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteSDKReferences()
|
|
|
|
{
|
2016-06-18 00:18:39 +03:00
|
|
|
std::vector<std::string> sdkReferences;
|
|
|
|
bool hasWrittenItemGroup = false;
|
|
|
|
if (const char* vsSDKReferences =
|
|
|
|
this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) {
|
|
|
|
cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences);
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
|
|
|
hasWrittenItemGroup = true;
|
|
|
|
for (std::vector<std::string>::iterator ri = sdkReferences.begin();
|
|
|
|
ri != sdkReferences.end(); ++ri) {
|
|
|
|
this->WriteString("<SDKReference Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\"/>\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-02 21:34:55 +03:00
|
|
|
// This only applies to Windows 10 apps
|
|
|
|
if (this->GlobalGenerator->TargetsWindowsStore() &&
|
2016-05-16 17:34:04 +03:00
|
|
|
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) {
|
2015-10-02 21:34:55 +03:00
|
|
|
const char* desktopExtensionsVersion =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_DESKTOP_EXTENSIONS_VERSION");
|
2015-10-02 21:34:55 +03:00
|
|
|
const char* mobileExtensionsVersion =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_MOBILE_EXTENSIONS_VERSION");
|
2015-10-02 21:34:55 +03:00
|
|
|
const char* iotExtensionsVersion =
|
2015-10-10 16:51:21 +03:00
|
|
|
this->GeneratorTarget->GetProperty("VS_IOT_EXTENSIONS_VERSION");
|
2015-10-02 21:34:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (desktopExtensionsVersion || mobileExtensionsVersion ||
|
|
|
|
iotExtensionsVersion) {
|
2016-06-18 00:18:39 +03:00
|
|
|
if (!hasWrittenItemGroup) {
|
|
|
|
this->WriteString("<ItemGroup>\n", 1);
|
|
|
|
hasWrittenItemGroup = true;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
if (desktopExtensionsVersion) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteSingleSDKReference("WindowsDesktop",
|
|
|
|
desktopExtensionsVersion);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (mobileExtensionsVersion) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteSingleSDKReference("WindowsMobile",
|
|
|
|
mobileExtensionsVersion);
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
if (iotExtensionsVersion) {
|
|
|
|
this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion);
|
|
|
|
}
|
2016-06-18 00:18:39 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (hasWrittenItemGroup) {
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</ItemGroup>\n", 1);
|
2015-10-02 21:34:55 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-02 21:34:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteSingleSDKReference(
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string const& extension, std::string const& version)
|
2015-10-02 21:34:55 +03:00
|
|
|
{
|
|
|
|
this->WriteString("<SDKReference Include=\"", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << extension << ", Version=" << version
|
|
|
|
<< "\" />\n";
|
2015-10-02 21:34:55 +03:00
|
|
|
}
|
|
|
|
|
2014-08-11 22:17:12 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
if ((this->GlobalGenerator->TargetsWindowsStore() ||
|
|
|
|
this->GlobalGenerator->TargetsWindowsPhone()) &&
|
|
|
|
(cmState::EXECUTABLE == this->GeneratorTarget->GetType())) {
|
2014-08-11 22:17:12 +04:00
|
|
|
std::string pfxFile;
|
|
|
|
std::vector<cmSourceFile const*> certificates;
|
|
|
|
this->GeneratorTarget->GetCertificates(certificates, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
certificates.begin();
|
|
|
|
si != certificates.end(); ++si) {
|
2014-08-11 22:17:12 +04:00
|
|
|
pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
|
|
|
|
this->ConvertToWindowsSlash(pfxFile);
|
|
|
|
break;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-11 22:17:12 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->IsMissingFiles &&
|
|
|
|
!(this->GlobalGenerator->TargetsWindowsPhone() &&
|
|
|
|
this->GlobalGenerator->GetSystemVersion() == "8.0")) {
|
2014-08-15 01:52:53 +04:00
|
|
|
// Move the manifest to a project directory to avoid clashes
|
|
|
|
std::string artifactDir =
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(artifactDir);
|
|
|
|
this->WriteString("<PropertyGroup>\n", 1);
|
|
|
|
this->WriteString("<AppxPackageArtifactsDir>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(artifactDir)
|
|
|
|
<< "\\</AppxPackageArtifactsDir>\n";
|
2016-08-25 16:17:17 +03:00
|
|
|
this->WriteString("<ProjectPriFullPath>", 2);
|
2016-10-05 00:02:28 +03:00
|
|
|
std::string resourcePriFile =
|
|
|
|
this->DefaultArtifactDir + "/resources.pri";
|
|
|
|
this->ConvertToWindowsSlash(resourcePriFile);
|
|
|
|
(*this->BuildFileStream) << resourcePriFile << "</ProjectPriFullPath>\n";
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
// If we are missing files and we don't have a certificate and
|
|
|
|
// aren't targeting WP8.0, add a default certificate
|
2016-05-16 17:34:04 +03:00
|
|
|
if (pfxFile.empty()) {
|
|
|
|
std::string templateFolder =
|
|
|
|
cmSystemTools::GetCMakeRoot() + "/Templates/Windows";
|
2014-08-15 01:52:53 +04:00
|
|
|
pfxFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx";
|
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/Windows_TemporaryKey.pfx",
|
|
|
|
pfxFile, false);
|
|
|
|
this->ConvertToWindowsSlash(pfxFile);
|
|
|
|
this->AddedFiles.push_back(pfxFile);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
this->WriteString("<", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile
|
|
|
|
<< "</PackageCertificateKeyFile>\n";
|
2015-08-22 00:15:38 +03:00
|
|
|
std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!thumb.empty()) {
|
2015-08-22 00:15:38 +03:00
|
|
|
this->WriteString("<PackageCertificateThumbprint>", 2);
|
|
|
|
(*this->BuildFileStream) << thumb
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "</PackageCertificateThumbprint>\n";
|
2014-08-15 01:52:53 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</PropertyGroup>\n", 1);
|
|
|
|
} else if (!pfxFile.empty()) {
|
2014-08-11 22:17:12 +04:00
|
|
|
this->WriteString("<PropertyGroup>\n", 1);
|
|
|
|
this->WriteString("<", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile
|
|
|
|
<< "</PackageCertificateKeyFile>\n";
|
2015-08-22 00:15:38 +03:00
|
|
|
std::string thumb = cmSystemTools::ComputeCertificateThumbprint(pfxFile);
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!thumb.empty()) {
|
2015-08-22 00:15:38 +03:00
|
|
|
this->WriteString("<PackageCertificateThumbprint>", 2);
|
|
|
|
(*this->BuildFileStream) << thumb
|
2016-05-16 17:34:04 +03:00
|
|
|
<< "</PackageCertificateThumbprint>\n";
|
2014-08-11 22:17:12 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
this->WriteString("</PropertyGroup>\n", 1);
|
2014-08-11 22:17:12 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-11 22:17:12 +04:00
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmVisualStudio10TargetGenerator::IsResxHeader(
|
|
|
|
const std::string& headerFile)
|
2013-04-29 18:48:22 +04:00
|
|
|
{
|
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 =
|
2016-05-16 17:34:04 +03:00
|
|
|
expectedResxHeaders.find(headerFile);
|
2013-11-10 14:22:44 +04:00
|
|
|
return it != expectedResxHeaders.end();
|
2013-04-29 18:48:22 +04:00
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmVisualStudio10TargetGenerator::IsXamlHeader(
|
|
|
|
const std::string& headerFile)
|
2015-03-31 23:49:39 +03:00
|
|
|
{
|
|
|
|
std::set<std::string> expectedXamlHeaders;
|
|
|
|
this->GeneratorTarget->GetExpectedXamlHeaders(expectedXamlHeaders, "");
|
|
|
|
|
|
|
|
std::set<std::string>::const_iterator it =
|
|
|
|
expectedXamlHeaders.find(headerFile);
|
|
|
|
return it != expectedXamlHeaders.end();
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
bool cmVisualStudio10TargetGenerator::IsXamlSource(
|
|
|
|
const std::string& sourceFile)
|
2015-03-31 23:49:39 +03:00
|
|
|
{
|
|
|
|
std::set<std::string> expectedXamlSources;
|
|
|
|
this->GeneratorTarget->GetExpectedXamlSources(expectedXamlSources, "");
|
|
|
|
|
|
|
|
std::set<std::string>::const_iterator it =
|
|
|
|
expectedXamlSources.find(sourceFile);
|
|
|
|
return it != expectedXamlSources.end();
|
|
|
|
}
|
|
|
|
|
2014-07-31 21:22:35 +04:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings()
|
|
|
|
{
|
2015-09-30 23:22:43 +03:00
|
|
|
cmGlobalVisualStudio10Generator* gg =
|
|
|
|
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
|
2014-08-15 01:52:53 +04:00
|
|
|
bool isAppContainer = false;
|
2014-07-31 21:22:35 +04:00
|
|
|
bool const isWindowsPhone = this->GlobalGenerator->TargetsWindowsPhone();
|
|
|
|
bool const isWindowsStore = this->GlobalGenerator->TargetsWindowsStore();
|
|
|
|
std::string const& v = this->GlobalGenerator->GetSystemVersion();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (isWindowsPhone || isWindowsStore) {
|
2014-07-31 21:22:35 +04:00
|
|
|
this->WriteString("<ApplicationType>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream)
|
|
|
|
<< (isWindowsPhone ? "Windows Phone" : "Windows Store")
|
|
|
|
<< "</ApplicationType>\n";
|
2015-01-29 21:38:52 +03:00
|
|
|
this->WriteString("<DefaultLanguage>en-US"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</DefaultLanguage>\n",
|
|
|
|
2);
|
|
|
|
if (cmHasLiteralPrefix(v, "10.0")) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteString("<ApplicationTypeRevision>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML("10.0")
|
|
|
|
<< "</ApplicationTypeRevision>\n";
|
|
|
|
// Visual Studio 14.0 is necessary for building 10.0 apps
|
|
|
|
this->WriteString("<MinimumVisualStudioVersion>14.0"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</MinimumVisualStudioVersion>\n",
|
|
|
|
2);
|
2015-10-02 21:34:55 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() < cmState::UTILITY) {
|
2015-10-02 21:34:55 +03:00
|
|
|
isAppContainer = true;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (v == "8.1") {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteString("<ApplicationTypeRevision>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(v)
|
|
|
|
<< "</ApplicationTypeRevision>\n";
|
2014-07-31 21:24:08 +04:00
|
|
|
// Visual Studio 12.0 is necessary for building 8.1 apps
|
|
|
|
this->WriteString("<MinimumVisualStudioVersion>12.0"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</MinimumVisualStudioVersion>\n",
|
|
|
|
2);
|
2014-08-15 01:52:53 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() < cmState::UTILITY) {
|
2014-08-15 01:52:53 +04:00
|
|
|
isAppContainer = true;
|
2014-07-31 21:24:08 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (v == "8.0") {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteString("<ApplicationTypeRevision>", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(v)
|
|
|
|
<< "</ApplicationTypeRevision>\n";
|
2014-07-31 21:24:08 +04:00
|
|
|
// Visual Studio 11.0 is necessary for building 8.0 apps
|
|
|
|
this->WriteString("<MinimumVisualStudioVersion>11.0"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</MinimumVisualStudioVersion>\n",
|
|
|
|
2);
|
2014-08-15 01:52:53 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
if (isWindowsStore &&
|
|
|
|
this->GeneratorTarget->GetType() < cmState::UTILITY) {
|
2014-08-15 01:52:53 +04:00
|
|
|
isAppContainer = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (isWindowsPhone &&
|
|
|
|
this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<XapOutputs>true</XapOutputs>\n", 2);
|
|
|
|
this->WriteString("<XapFilename>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream)
|
|
|
|
<< cmVS10EscapeXML(this->Name.c_str())
|
|
|
|
<< "_$(Configuration)_$(Platform).xap</XapFilename>\n";
|
2014-07-31 21:24:08 +04:00
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (isAppContainer) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteString("<AppContainerApplication>true"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</AppContainerApplication>\n",
|
|
|
|
2);
|
|
|
|
} else if (this->Platform == "ARM") {
|
2014-08-05 23:00:09 +04:00
|
|
|
this->WriteString("<WindowsSDKDesktopARMSupport>true"
|
2016-05-16 17:34:04 +03:00
|
|
|
"</WindowsSDKDesktopARMSupport>\n",
|
|
|
|
2);
|
|
|
|
}
|
2015-09-30 23:22:43 +03:00
|
|
|
std::string const& targetPlatformVersion =
|
|
|
|
gg->GetWindowsTargetPlatformVersion();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!targetPlatformVersion.empty()) {
|
2015-09-30 23:22:43 +03:00
|
|
|
this->WriteString("<WindowsTargetPlatformVersion>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion)
|
|
|
|
<< "</WindowsTargetPlatformVersion>\n";
|
|
|
|
}
|
|
|
|
const char* targetPlatformMinVersion = this->GeneratorTarget->GetProperty(
|
|
|
|
"VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION");
|
|
|
|
if (targetPlatformMinVersion) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteString("<WindowsTargetPlatformMinVersion>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformMinVersion)
|
|
|
|
<< "</WindowsTargetPlatformMinVersion>\n";
|
|
|
|
} else if (isWindowsStore && cmHasLiteralPrefix(v, "10.0")) {
|
2015-10-02 21:34:55 +03:00
|
|
|
// If the min version is not set, then use the TargetPlatformVersion
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!targetPlatformVersion.empty()) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteString("<WindowsTargetPlatformMinVersion>", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(targetPlatformVersion)
|
|
|
|
<< "</WindowsTargetPlatformMinVersion>\n";
|
2015-10-02 21:34:55 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-10-02 21:34:55 +03:00
|
|
|
|
|
|
|
// Added IoT Startup Task support
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetPropertyAsBool("VS_IOT_STARTUP_TASK")) {
|
2015-10-02 21:34:55 +03:00
|
|
|
this->WriteString("<ContainsStartupTask>true</ContainsStartupTask>\n", 2);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-07-31 21:22:35 +04:00
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::VerifyNecessaryFiles()
|
|
|
|
{
|
|
|
|
// For Windows and Windows Phone executables, we will assume that if a
|
|
|
|
// manifest is not present that we need to add all the necessary files
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GeneratorTarget->GetType() == cmState::EXECUTABLE) {
|
2014-08-15 01:52:53 +04:00
|
|
|
std::vector<cmSourceFile const*> manifestSources;
|
|
|
|
this->GeneratorTarget->GetAppManifest(manifestSources, "");
|
2016-05-16 17:34:04 +03:00
|
|
|
{
|
2014-08-15 01:52:53 +04:00
|
|
|
std::string const& v = this->GlobalGenerator->GetSystemVersion();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone()) {
|
|
|
|
if (v == "8.0") {
|
2014-08-15 01:52:53 +04:00
|
|
|
// Look through the sources for WMAppManifest.xml
|
|
|
|
std::vector<cmSourceFile const*> extraSources;
|
|
|
|
this->GeneratorTarget->GetExtraSources(extraSources, "");
|
|
|
|
bool foundManifest = false;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (std::vector<cmSourceFile const*>::const_iterator si =
|
|
|
|
extraSources.begin();
|
|
|
|
si != extraSources.end(); ++si) {
|
2014-08-15 01:52:53 +04:00
|
|
|
// Need to do a lowercase comparison on the filename
|
2016-05-16 17:34:04 +03:00
|
|
|
if ("wmappmanifest.xml" ==
|
|
|
|
cmSystemTools::LowerCase((*si)->GetLocation().GetName())) {
|
2014-08-15 01:52:53 +04:00
|
|
|
foundManifest = true;
|
|
|
|
break;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
|
|
|
if (!foundManifest) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->IsMissingFiles = true;
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (v == "8.1") {
|
|
|
|
if (manifestSources.empty()) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->IsMissingFiles = true;
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->GlobalGenerator->TargetsWindowsStore()) {
|
|
|
|
if (manifestSources.empty()) {
|
|
|
|
if (v == "8.0") {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->IsMissingFiles = true;
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (v == "8.1" || cmHasLiteralPrefix(v, "10.0")) {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->IsMissingFiles = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteMissingFiles()
|
|
|
|
{
|
|
|
|
std::string const& v = this->GlobalGenerator->GetSystemVersion();
|
2016-05-16 17:34:04 +03:00
|
|
|
if (this->GlobalGenerator->TargetsWindowsPhone()) {
|
|
|
|
if (v == "8.0") {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteMissingFilesWP80();
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (v == "8.1") {
|
2014-08-15 01:52:53 +04:00
|
|
|
this->WriteMissingFilesWP81();
|
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
} else if (this->GlobalGenerator->TargetsWindowsStore()) {
|
|
|
|
if (v == "8.0") {
|
|
|
|
this->WriteMissingFilesWS80();
|
|
|
|
} else if (v == "8.1") {
|
|
|
|
this->WriteMissingFilesWS81();
|
|
|
|
} else if (cmHasLiteralPrefix(v, "10.0")) {
|
|
|
|
this->WriteMissingFilesWS10_0();
|
|
|
|
}
|
|
|
|
}
|
2014-08-15 01:52:53 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteMissingFilesWP80()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string templateFolder =
|
|
|
|
cmSystemTools::GetCMakeRoot() + "/Templates/Windows";
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
// For WP80, the manifest needs to be in the same folder as the project
|
|
|
|
// this can cause an overwrite problem if projects aren't organized in
|
|
|
|
// folders
|
2015-09-25 01:13:20 +03:00
|
|
|
std::string manifestFile =
|
2016-05-16 17:34:04 +03:00
|
|
|
this->LocalGenerator->GetCurrentBinaryDirectory() +
|
|
|
|
std::string("/WMAppManifest.xml");
|
2014-08-15 01:52:53 +04:00
|
|
|
std::string artifactDir =
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(artifactDir);
|
|
|
|
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
|
2015-10-16 21:09:43 +03:00
|
|
|
std::string targetNameXML =
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVS10EscapeXML(this->GeneratorTarget->GetName());
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
cmGeneratedFileStream fout(manifestFile.c_str());
|
|
|
|
fout.SetCopyIfDifferent(true);
|
|
|
|
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format off */
|
2014-08-15 01:52:53 +04:00
|
|
|
fout <<
|
|
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
|
|
|
"<Deployment"
|
|
|
|
" xmlns=\"http://schemas.microsoft.com/windowsphone/2012/deployment\""
|
|
|
|
" AppPlatformVersion=\"8.0\">\n"
|
|
|
|
"\t<DefaultLanguage xmlns=\"\" code=\"en-US\"/>\n"
|
|
|
|
"\t<App xmlns=\"\" ProductID=\"{" << this->GUID << "}\""
|
|
|
|
" Title=\"CMake Test Program\" RuntimeType=\"Modern Native\""
|
|
|
|
" Version=\"1.0.0.0\" Genre=\"apps.normal\" Author=\"CMake\""
|
|
|
|
" Description=\"Default CMake App\" Publisher=\"CMake\""
|
|
|
|
" PublisherID=\"{" << this->GUID << "}\">\n"
|
|
|
|
"\t\t<IconPath IsRelative=\"true\" IsResource=\"false\">"
|
|
|
|
<< artifactDirXML << "\\ApplicationIcon.png</IconPath>\n"
|
|
|
|
"\t\t<Capabilities/>\n"
|
|
|
|
"\t\t<Tasks>\n"
|
|
|
|
"\t\t\t<DefaultTask Name=\"_default\""
|
|
|
|
" ImagePath=\"" << targetNameXML << ".exe\" ImageParams=\"\" />\n"
|
|
|
|
"\t\t</Tasks>\n"
|
|
|
|
"\t\t<Tokens>\n"
|
|
|
|
"\t\t\t<PrimaryToken TokenID=\"" << targetNameXML << "Token\""
|
|
|
|
" TaskName=\"_default\">\n"
|
|
|
|
"\t\t\t\t<TemplateFlip>\n"
|
|
|
|
"\t\t\t\t\t<SmallImageURI IsRelative=\"true\" IsResource=\"false\">"
|
|
|
|
<< artifactDirXML << "\\SmallLogo.png</SmallImageURI>\n"
|
|
|
|
"\t\t\t\t\t<Count>0</Count>\n"
|
|
|
|
"\t\t\t\t\t<BackgroundImageURI IsRelative=\"true\" IsResource=\"false\">"
|
|
|
|
<< artifactDirXML << "\\Logo.png</BackgroundImageURI>\n"
|
|
|
|
"\t\t\t\t</TemplateFlip>\n"
|
|
|
|
"\t\t\t</PrimaryToken>\n"
|
|
|
|
"\t\t</Tokens>\n"
|
|
|
|
"\t\t<ScreenResolutions>\n"
|
|
|
|
"\t\t\t<ScreenResolution Name=\"ID_RESOLUTION_WVGA\" />\n"
|
|
|
|
"\t\t</ScreenResolutions>\n"
|
|
|
|
"\t</App>\n"
|
|
|
|
"</Deployment>\n";
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format on */
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
std::string sourceFile = this->ConvertPath(manifestFile, false);
|
|
|
|
this->ConvertToWindowsSlash(sourceFile);
|
|
|
|
this->WriteString("<Xml Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n";
|
|
|
|
this->WriteString("<SubType>Designer</SubType>\n", 3);
|
|
|
|
this->WriteString("</Xml>\n", 2);
|
|
|
|
this->AddedFiles.push_back(sourceFile);
|
|
|
|
|
|
|
|
std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo,
|
|
|
|
false);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(smallLogo);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(smallLogo);
|
|
|
|
|
|
|
|
std::string logo = this->DefaultArtifactDir + "/Logo.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(logo);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(logo) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(logo);
|
|
|
|
|
|
|
|
std::string applicationIcon =
|
|
|
|
this->DefaultArtifactDir + "/ApplicationIcon.png";
|
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/ApplicationIcon.png",
|
|
|
|
applicationIcon, false);
|
|
|
|
this->ConvertToWindowsSlash(applicationIcon);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(applicationIcon) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(applicationIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteMissingFilesWP81()
|
|
|
|
{
|
|
|
|
std::string manifestFile =
|
|
|
|
this->DefaultArtifactDir + "/package.appxManifest";
|
|
|
|
std::string artifactDir =
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(artifactDir);
|
|
|
|
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
|
2015-10-16 21:09:43 +03:00
|
|
|
std::string targetNameXML =
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVS10EscapeXML(this->GeneratorTarget->GetName());
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
cmGeneratedFileStream fout(manifestFile.c_str());
|
|
|
|
fout.SetCopyIfDifferent(true);
|
|
|
|
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format off */
|
2014-08-15 01:52:53 +04:00
|
|
|
fout <<
|
|
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
|
|
|
"<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\""
|
|
|
|
" xmlns:m2=\"http://schemas.microsoft.com/appx/2013/manifest\""
|
|
|
|
" xmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\">\n"
|
|
|
|
"\t<Identity Name=\"" << this->GUID << "\" Publisher=\"CN=CMake\""
|
|
|
|
" Version=\"1.0.0.0\" />\n"
|
|
|
|
"\t<mp:PhoneIdentity PhoneProductId=\"" << this->GUID << "\""
|
|
|
|
" PhonePublisherId=\"00000000-0000-0000-0000-000000000000\"/>\n"
|
|
|
|
"\t<Properties>\n"
|
|
|
|
"\t\t<DisplayName>" << targetNameXML << "</DisplayName>\n"
|
|
|
|
"\t\t<PublisherDisplayName>CMake</PublisherDisplayName>\n"
|
|
|
|
"\t\t<Logo>" << artifactDirXML << "\\StoreLogo.png</Logo>\n"
|
|
|
|
"\t</Properties>\n"
|
|
|
|
"\t<Prerequisites>\n"
|
|
|
|
"\t\t<OSMinVersion>6.3.1</OSMinVersion>\n"
|
|
|
|
"\t\t<OSMaxVersionTested>6.3.1</OSMaxVersionTested>\n"
|
|
|
|
"\t</Prerequisites>\n"
|
|
|
|
"\t<Resources>\n"
|
|
|
|
"\t\t<Resource Language=\"x-generate\" />\n"
|
|
|
|
"\t</Resources>\n"
|
|
|
|
"\t<Applications>\n"
|
|
|
|
"\t\t<Application Id=\"App\""
|
|
|
|
" Executable=\"" << targetNameXML << ".exe\""
|
|
|
|
" EntryPoint=\"" << targetNameXML << ".App\">\n"
|
|
|
|
"\t\t\t<m2:VisualElements\n"
|
|
|
|
"\t\t\t\tDisplayName=\"" << targetNameXML << "\"\n"
|
|
|
|
"\t\t\t\tDescription=\"" << targetNameXML << "\"\n"
|
|
|
|
"\t\t\t\tBackgroundColor=\"#336699\"\n"
|
|
|
|
"\t\t\t\tForegroundText=\"light\"\n"
|
|
|
|
"\t\t\t\tSquare150x150Logo=\"" << artifactDirXML << "\\Logo.png\"\n"
|
|
|
|
"\t\t\t\tSquare30x30Logo=\"" << artifactDirXML << "\\SmallLogo.png\">\n"
|
|
|
|
"\t\t\t\t<m2:DefaultTile ShortName=\"" << targetNameXML << "\">\n"
|
|
|
|
"\t\t\t\t\t<m2:ShowNameOnTiles>\n"
|
|
|
|
"\t\t\t\t\t\t<m2:ShowOn Tile=\"square150x150Logo\" />\n"
|
|
|
|
"\t\t\t\t\t</m2:ShowNameOnTiles>\n"
|
|
|
|
"\t\t\t\t</m2:DefaultTile>\n"
|
|
|
|
"\t\t\t\t<m2:SplashScreen"
|
|
|
|
" Image=\"" << artifactDirXML << "\\SplashScreen.png\" />\n"
|
|
|
|
"\t\t\t</m2:VisualElements>\n"
|
|
|
|
"\t\t</Application>\n"
|
|
|
|
"\t</Applications>\n"
|
|
|
|
"</Package>\n";
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format on */
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
this->WriteCommonMissingFiles(manifestFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteMissingFilesWS80()
|
|
|
|
{
|
|
|
|
std::string manifestFile =
|
|
|
|
this->DefaultArtifactDir + "/package.appxManifest";
|
|
|
|
std::string artifactDir =
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(artifactDir);
|
|
|
|
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
|
2015-10-16 21:09:43 +03:00
|
|
|
std::string targetNameXML =
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVS10EscapeXML(this->GeneratorTarget->GetName());
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
cmGeneratedFileStream fout(manifestFile.c_str());
|
|
|
|
fout.SetCopyIfDifferent(true);
|
|
|
|
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format off */
|
2014-08-15 01:52:53 +04:00
|
|
|
fout <<
|
|
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
|
|
|
"<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\">\n"
|
|
|
|
"\t<Identity Name=\"" << this->GUID << "\" Publisher=\"CN=CMake\""
|
|
|
|
" Version=\"1.0.0.0\" />\n"
|
|
|
|
"\t<Properties>\n"
|
|
|
|
"\t\t<DisplayName>" << targetNameXML << "</DisplayName>\n"
|
|
|
|
"\t\t<PublisherDisplayName>CMake</PublisherDisplayName>\n"
|
|
|
|
"\t\t<Logo>" << artifactDirXML << "\\StoreLogo.png</Logo>\n"
|
|
|
|
"\t</Properties>\n"
|
|
|
|
"\t<Prerequisites>\n"
|
|
|
|
"\t\t<OSMinVersion>6.2.1</OSMinVersion>\n"
|
|
|
|
"\t\t<OSMaxVersionTested>6.2.1</OSMaxVersionTested>\n"
|
|
|
|
"\t</Prerequisites>\n"
|
|
|
|
"\t<Resources>\n"
|
|
|
|
"\t\t<Resource Language=\"x-generate\" />\n"
|
|
|
|
"\t</Resources>\n"
|
|
|
|
"\t<Applications>\n"
|
|
|
|
"\t\t<Application Id=\"App\""
|
|
|
|
" Executable=\"" << targetNameXML << ".exe\""
|
|
|
|
" EntryPoint=\"" << targetNameXML << ".App\">\n"
|
|
|
|
"\t\t\t<VisualElements"
|
|
|
|
" DisplayName=\"" << targetNameXML << "\""
|
|
|
|
" Description=\"" << targetNameXML << "\""
|
|
|
|
" BackgroundColor=\"#336699\" ForegroundText=\"light\""
|
|
|
|
" Logo=\"" << artifactDirXML << "\\Logo.png\""
|
|
|
|
" SmallLogo=\"" << artifactDirXML << "\\SmallLogo.png\">\n"
|
|
|
|
"\t\t\t\t<DefaultTile ShowName=\"allLogos\""
|
|
|
|
" ShortName=\"" << targetNameXML << "\" />\n"
|
|
|
|
"\t\t\t\t<SplashScreen"
|
|
|
|
" Image=\"" << artifactDirXML << "\\SplashScreen.png\" />\n"
|
|
|
|
"\t\t\t</VisualElements>\n"
|
|
|
|
"\t\t</Application>\n"
|
|
|
|
"\t</Applications>\n"
|
|
|
|
"</Package>\n";
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format on */
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
this->WriteCommonMissingFiles(manifestFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cmVisualStudio10TargetGenerator::WriteMissingFilesWS81()
|
|
|
|
{
|
|
|
|
std::string manifestFile =
|
|
|
|
this->DefaultArtifactDir + "/package.appxManifest";
|
|
|
|
std::string artifactDir =
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(artifactDir);
|
|
|
|
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
|
2015-10-16 21:09:43 +03:00
|
|
|
std::string targetNameXML =
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVS10EscapeXML(this->GeneratorTarget->GetName());
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
cmGeneratedFileStream fout(manifestFile.c_str());
|
|
|
|
fout.SetCopyIfDifferent(true);
|
|
|
|
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format off */
|
2014-08-15 01:52:53 +04:00
|
|
|
fout <<
|
|
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
|
|
|
"<Package xmlns=\"http://schemas.microsoft.com/appx/2010/manifest\""
|
|
|
|
" xmlns:m2=\"http://schemas.microsoft.com/appx/2013/manifest\">\n"
|
|
|
|
"\t<Identity Name=\"" << this->GUID << "\" Publisher=\"CN=CMake\""
|
|
|
|
" Version=\"1.0.0.0\" />\n"
|
|
|
|
"\t<Properties>\n"
|
|
|
|
"\t\t<DisplayName>" << targetNameXML << "</DisplayName>\n"
|
|
|
|
"\t\t<PublisherDisplayName>CMake</PublisherDisplayName>\n"
|
|
|
|
"\t\t<Logo>" << artifactDirXML << "\\StoreLogo.png</Logo>\n"
|
|
|
|
"\t</Properties>\n"
|
|
|
|
"\t<Prerequisites>\n"
|
|
|
|
"\t\t<OSMinVersion>6.3</OSMinVersion>\n"
|
|
|
|
"\t\t<OSMaxVersionTested>6.3</OSMaxVersionTested>\n"
|
|
|
|
"\t</Prerequisites>\n"
|
|
|
|
"\t<Resources>\n"
|
|
|
|
"\t\t<Resource Language=\"x-generate\" />\n"
|
|
|
|
"\t</Resources>\n"
|
|
|
|
"\t<Applications>\n"
|
|
|
|
"\t\t<Application Id=\"App\""
|
|
|
|
" Executable=\"" << targetNameXML << ".exe\""
|
|
|
|
" EntryPoint=\"" << targetNameXML << ".App\">\n"
|
|
|
|
"\t\t\t<m2:VisualElements\n"
|
|
|
|
"\t\t\t\tDisplayName=\"" << targetNameXML << "\"\n"
|
|
|
|
"\t\t\t\tDescription=\"" << targetNameXML << "\"\n"
|
|
|
|
"\t\t\t\tBackgroundColor=\"#336699\"\n"
|
|
|
|
"\t\t\t\tForegroundText=\"light\"\n"
|
|
|
|
"\t\t\t\tSquare150x150Logo=\"" << artifactDirXML << "\\Logo.png\"\n"
|
|
|
|
"\t\t\t\tSquare30x30Logo=\"" << artifactDirXML << "\\SmallLogo.png\">\n"
|
|
|
|
"\t\t\t\t<m2:DefaultTile ShortName=\"" << targetNameXML << "\">\n"
|
|
|
|
"\t\t\t\t\t<m2:ShowNameOnTiles>\n"
|
|
|
|
"\t\t\t\t\t\t<m2:ShowOn Tile=\"square150x150Logo\" />\n"
|
|
|
|
"\t\t\t\t\t</m2:ShowNameOnTiles>\n"
|
|
|
|
"\t\t\t\t</m2:DefaultTile>\n"
|
|
|
|
"\t\t\t\t<m2:SplashScreen"
|
|
|
|
" Image=\"" << artifactDirXML << "\\SplashScreen.png\" />\n"
|
|
|
|
"\t\t\t</m2:VisualElements>\n"
|
|
|
|
"\t\t</Application>\n"
|
|
|
|
"\t</Applications>\n"
|
|
|
|
"</Package>\n";
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format on */
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
this->WriteCommonMissingFiles(manifestFile);
|
|
|
|
}
|
|
|
|
|
2015-10-02 21:34:55 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteMissingFilesWS10_0()
|
|
|
|
{
|
|
|
|
std::string manifestFile =
|
|
|
|
this->DefaultArtifactDir + "/package.appxManifest";
|
|
|
|
std::string artifactDir =
|
2015-10-09 23:27:46 +03:00
|
|
|
this->LocalGenerator->GetTargetDirectory(this->GeneratorTarget);
|
2015-10-02 21:34:55 +03:00
|
|
|
this->ConvertToWindowsSlash(artifactDir);
|
|
|
|
std::string artifactDirXML = cmVS10EscapeXML(artifactDir);
|
2015-10-16 21:09:43 +03:00
|
|
|
std::string targetNameXML =
|
2016-05-16 17:34:04 +03:00
|
|
|
cmVS10EscapeXML(this->GeneratorTarget->GetName());
|
2015-10-02 21:34:55 +03:00
|
|
|
|
|
|
|
cmGeneratedFileStream fout(manifestFile.c_str());
|
|
|
|
fout.SetCopyIfDifferent(true);
|
|
|
|
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format off */
|
2015-10-02 21:34:55 +03:00
|
|
|
fout <<
|
|
|
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
|
|
|
|
"<Package\n\t"
|
|
|
|
"xmlns=\"http://schemas.microsoft.com/appx/manifest/foundation/windows10\""
|
|
|
|
"\txmlns:mp=\"http://schemas.microsoft.com/appx/2014/phone/manifest\"\n"
|
|
|
|
"\txmlns:uap=\"http://schemas.microsoft.com/appx/manifest/uap/windows10\""
|
|
|
|
"\n\tIgnorableNamespaces=\"uap mp\">\n\n"
|
|
|
|
"\t<Identity Name=\"" << this->GUID << "\" Publisher=\"CN=CMake\""
|
|
|
|
" Version=\"1.0.0.0\" />\n"
|
|
|
|
"\t<mp:PhoneIdentity PhoneProductId=\"" << this->GUID <<
|
|
|
|
"\" PhonePublisherId=\"00000000-0000-0000-0000-000000000000\"/>\n"
|
|
|
|
"\t<Properties>\n"
|
|
|
|
"\t\t<DisplayName>" << targetNameXML << "</DisplayName>\n"
|
|
|
|
"\t\t<PublisherDisplayName>CMake</PublisherDisplayName>\n"
|
|
|
|
"\t\t<Logo>" << artifactDirXML << "\\StoreLogo.png</Logo>\n"
|
|
|
|
"\t</Properties>\n"
|
|
|
|
"\t<Dependencies>\n"
|
|
|
|
"\t\t<TargetDeviceFamily Name=\"Windows.Universal\" "
|
|
|
|
"MinVersion=\"10.0.0.0\" MaxVersionTested=\"10.0.0.0\" />\n"
|
|
|
|
"\t</Dependencies>\n"
|
|
|
|
|
|
|
|
"\t<Resources>\n"
|
|
|
|
"\t\t<Resource Language=\"x-generate\" />\n"
|
|
|
|
"\t</Resources>\n"
|
|
|
|
"\t<Applications>\n"
|
|
|
|
"\t\t<Application Id=\"App\""
|
|
|
|
" Executable=\"" << targetNameXML << ".exe\""
|
|
|
|
" EntryPoint=\"" << targetNameXML << ".App\">\n"
|
|
|
|
"\t\t\t<uap:VisualElements\n"
|
|
|
|
"\t\t\t\tDisplayName=\"" << targetNameXML << "\"\n"
|
|
|
|
"\t\t\t\tDescription=\"" << targetNameXML << "\"\n"
|
|
|
|
"\t\t\t\tBackgroundColor=\"#336699\"\n"
|
|
|
|
"\t\t\t\tSquare150x150Logo=\"" << artifactDirXML << "\\Logo.png\"\n"
|
|
|
|
"\t\t\t\tSquare44x44Logo=\"" << artifactDirXML <<
|
|
|
|
"\\SmallLogo44x44.png\">\n"
|
|
|
|
"\t\t\t\t<uap:SplashScreen"
|
|
|
|
" Image=\"" << artifactDirXML << "\\SplashScreen.png\" />\n"
|
|
|
|
"\t\t\t</uap:VisualElements>\n"
|
|
|
|
"\t\t</Application>\n"
|
|
|
|
"\t</Applications>\n"
|
|
|
|
"</Package>\n";
|
2016-05-06 21:19:04 +03:00
|
|
|
/* clang-format on */
|
2015-10-02 21:34:55 +03:00
|
|
|
|
|
|
|
this->WriteCommonMissingFiles(manifestFile);
|
|
|
|
}
|
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
void cmVisualStudio10TargetGenerator::WriteCommonMissingFiles(
|
|
|
|
const std::string& manifestFile)
|
2014-08-15 01:52:53 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::string templateFolder =
|
|
|
|
cmSystemTools::GetCMakeRoot() + "/Templates/Windows";
|
2014-08-15 01:52:53 +04:00
|
|
|
|
|
|
|
std::string sourceFile = this->ConvertPath(manifestFile, false);
|
|
|
|
this->ConvertToWindowsSlash(sourceFile);
|
|
|
|
this->WriteString("<AppxManifest Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(sourceFile) << "\">\n";
|
|
|
|
this->WriteString("<SubType>Designer</SubType>\n", 3);
|
|
|
|
this->WriteString("</AppxManifest>\n", 2);
|
|
|
|
this->AddedFiles.push_back(sourceFile);
|
|
|
|
|
|
|
|
std::string smallLogo = this->DefaultArtifactDir + "/SmallLogo.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/SmallLogo.png", smallLogo,
|
|
|
|
false);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(smallLogo);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(smallLogo) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(smallLogo);
|
|
|
|
|
2015-10-02 21:34:55 +03:00
|
|
|
std::string smallLogo44 = this->DefaultArtifactDir + "/SmallLogo44x44.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/SmallLogo44x44.png", smallLogo44,
|
|
|
|
false);
|
2015-10-02 21:34:55 +03:00
|
|
|
this->ConvertToWindowsSlash(smallLogo44);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(smallLogo44) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(smallLogo44);
|
|
|
|
|
2014-08-15 01:52:53 +04:00
|
|
|
std::string logo = this->DefaultArtifactDir + "/Logo.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/Logo.png", logo, false);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(logo);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(logo) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(logo);
|
|
|
|
|
|
|
|
std::string storeLogo = this->DefaultArtifactDir + "/StoreLogo.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/StoreLogo.png", storeLogo,
|
|
|
|
false);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(storeLogo);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(storeLogo) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(storeLogo);
|
|
|
|
|
|
|
|
std::string splashScreen = this->DefaultArtifactDir + "/SplashScreen.png";
|
2016-05-16 17:34:04 +03:00
|
|
|
cmSystemTools::CopyAFile(templateFolder + "/SplashScreen.png", splashScreen,
|
|
|
|
false);
|
2014-08-15 01:52:53 +04:00
|
|
|
this->ConvertToWindowsSlash(splashScreen);
|
|
|
|
this->WriteString("<Image Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(splashScreen) << "\" />\n";
|
|
|
|
this->AddedFiles.push_back(splashScreen);
|
|
|
|
|
|
|
|
// This file has already been added to the build so don't copy it
|
|
|
|
std::string keyFile = this->DefaultArtifactDir + "/Windows_TemporaryKey.pfx";
|
|
|
|
this->ConvertToWindowsSlash(keyFile);
|
|
|
|
this->WriteString("<None Include=\"", 2);
|
|
|
|
(*this->BuildFileStream) << cmVS10EscapeXML(keyFile) << "\" />\n";
|
|
|
|
}
|
2015-09-28 16:33:10 +03:00
|
|
|
|
|
|
|
bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
HANDLE h =
|
|
|
|
CreateFileW(cmSystemTools::ConvertToWindowsExtendedPath(source).c_str(),
|
|
|
|
FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, 0, OPEN_EXISTING,
|
|
|
|
FILE_FLAG_BACKUP_SEMANTICS, 0);
|
|
|
|
if (!h) {
|
2015-09-28 16:33:10 +03:00
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-09-28 16:33:10 +03:00
|
|
|
|
2015-09-30 15:53:09 +03:00
|
|
|
FILETIME const ftime_20010101 = { 3365781504u, 29389701u };
|
2016-05-16 17:34:04 +03:00
|
|
|
if (!SetFileTime(h, &ftime_20010101, &ftime_20010101, &ftime_20010101)) {
|
2015-09-28 16:33:10 +03:00
|
|
|
CloseHandle(h);
|
|
|
|
return false;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2015-09-28 16:33:10 +03:00
|
|
|
|
|
|
|
CloseHandle(h);
|
|
|
|
return true;
|
|
|
|
}
|