Attached Files | AppContainerApplication.patch [^] (737 bytes) 2012-12-14 00:56 [Show Content] [Hide Content]diff -r cb679c133897 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Fri Dec 14 13:11:51 2012 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Fri Dec 14 13:54:22 2012 +0800
@@ -262,6 +262,11 @@
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
AppxManifest.patch [^] (577 bytes) 2012-12-14 01:58 [Show Content] [Hide Content]diff -r c38c46648a67 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Fri Dec 14 14:31:32 2012 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Fri Dec 14 14:57:36 2012 +0800
@@ -819,6 +819,10 @@
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool <<
" Include=\"" << sourceFile << "\"" << (end? end : " />\n");
ToolSource toolSource = {sf, forceRelative};
TryCompile.patch [^] (735 bytes) 2012-12-17 23:58 [Show Content] [Hide Content]diff -r c8453177dd92 -r 203e0d0e8175 Source/cmCoreTryCompile.cxx
--- a/Source/cmCoreTryCompile.cxx Fri Dec 14 14:57:38 2012 +0800
+++ b/Source/cmCoreTryCompile.cxx Tue Dec 18 12:55:49 2012 +0800
@@ -298,6 +298,9 @@
/* Create the actual executable. */
fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
+ fprintf(fout, "IF(CMAKE_GENERATOR MATCHES \"Visual Studio 11 ARM\")\n");
+ fprintf(fout, "SET_TARGET_PROPERTIES(%s PROPERTIES VS_WINRT_EXTENSIONS TRUE)\n", targetName);
+ fprintf(fout, "ENDIF()\n");
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
// if the source is not in CMakeTmp
VS11ArmPatches.patch [^] (10,485 bytes) 2013-04-15 09:35 [Show Content] [Hide Content]diff --git a/cmake-2.8.10.2/Modules/CMakeTestCXXCompiler.cmake b/cmake-2.8.10.2/Modules/CMakeTestCXXCompiler.cmake
index a5cdf56..ab15319 100644
--- a/cmake-2.8.10.2/Modules/CMakeTestCXXCompiler.cmake
+++ b/cmake-2.8.10.2/Modules/CMakeTestCXXCompiler.cmake
@@ -32,11 +32,17 @@ unset(CMAKE_CXX_COMPILER_WORKS CACHE)
# any makefiles or projects.
if(NOT CMAKE_CXX_COMPILER_WORKS)
PrintTestCompilerStatus("CXX" "")
- file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
- "#ifndef __cplusplus\n"
- "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
- "#endif\n"
- "int main(){return 0;}\n")
+ IF(CMAKE_GENERATOR MATCHES "Visual Studio 11 ARM")
+ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
+ "using namespace Platform;\n"
+ "int main(Array<String^>^ args) { return 0;}\n")
+ else()
+ file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
+ "#ifndef __cplusplus\n"
+ "# error \"The CMAKE_CXX_COMPILER is set to a C compiler\"\n"
+ "#endif\n"
+ "int main(){return 0;}\n")
+ endif()
try_compile(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx
OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT)
diff --git a/cmake-2.8.10.2/Source/cmCoreTryCompile.cxx b/cmake-2.8.10.2/Source/cmCoreTryCompile.cxx
index 1ae7035..0d8c577 100644
--- a/cmake-2.8.10.2/Source/cmCoreTryCompile.cxx
+++ b/cmake-2.8.10.2/Source/cmCoreTryCompile.cxx
@@ -296,8 +296,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
- fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
- fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName);
+ if (this->Makefile->GetLocalGenerator()->isVS11ARMCurrentGlobalGenerator())
+ {
+ if(CreatePackageAppxmanifestForTest() == CREATE_MANIFEST_ERROR)
+ return CREATE_MANIFEST_ERROR;
+
+ std::string packagePath = this->BinaryDirectory + "/Package.appxmanifest";
+
+ fprintf(fout, "ADD_EXECUTABLE(%s \"%s\" \"%s\")\n", targetName, source.c_str(), packagePath.c_str());
+ }
+ else{
+ fprintf(fout, "ADD_EXECUTABLE(%s \"%s\")\n", targetName, source.c_str());
+ }
+ fprintf(fout, "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n", targetName);
+
fclose(fout);
projectName = "CMAKE_TRY_COMPILE";
// if the source is not in CMakeTmp
@@ -481,3 +493,59 @@ void cmCoreTryCompile::FindOutputFile(const char* targetName)
this->FindErrorMessage = emsg.str();
return;
}
+
+
+int cmCoreTryCompile::CreatePackageAppxmanifestForTest()
+{
+ std::string packageAppxManifestPath = this->BinaryDirectory;
+ packageAppxManifestPath += "/Package.appxmanifest";
+
+ FILE *fileout = fopen(packageAppxManifestPath.c_str(), "w");
+ if (!fileout)
+ {
+ cmOStringStream e;
+ e << "Failed to open\n"
+ << " " << "Package.appxmanifest" << "\n"
+ << cmSystemTools::GetLastSystemError();
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return CREATE_MANIFEST_ERROR;
+ }
+ fprintf(fileout,
+ "<?xml version='1.0' encoding='utf-8'?>\n"
+ "<Package xmlns='http://schemas.microsoft.com/appx/2010/manifest'>\n"
+ "<Identity Name='TestApp'\n"
+ " Publisher='CN=Cmake.org'\n"
+ " Version='1.0.0.0' />\n"
+ "<Properties>\n"
+ " <DisplayName>$targetnametoken$</DisplayName>\n"
+ " <PublisherDisplayName>Cmake.org</PublisherDisplayName>\n"
+ " <Logo>Images\\Logo.png</Logo>\n"
+ " <Description>C++/CX Test application</Description>\n"
+ "</Properties>\n"
+ "<Prerequisites>\n"
+ " <OSMinVersion>6.2</OSMinVersion>\n"
+ " <OSMaxVersionTested>6.2</OSMaxVersionTested>\n"
+ "</Prerequisites>\n"
+ "<Resources>\n"
+ " <Resource Language='en-us' />\n"
+ "</Resources>\n"
+ "<Applications>\n"
+ " <Application Id='TestID'\n"
+ " Executable='$targetnametoken$.exe'\n"
+ " EntryPoint='$targetnametoken$.App'>\n"
+ " <VisualElements\n"
+ " DisplayName='$targetnametoken$'\n"
+ " Logo='Images\\Logo.png'\n"
+ " SmallLogo='Images\\SmallLogo.png'\n"
+ " Description='C++/CX Test application'\n"
+ " ForegroundText='light'\n"
+ " BackgroundColor='#222222'>\n"
+ " <SplashScreen Image='Images\\SplashScreen.png' />\n"
+ " </VisualElements>\n"
+ " </Application>\n"
+ "</Applications>\n"
+ "</Package>");
+ fclose(fileout);
+
+ return CREATE_MANIFEST_OK;
+}
\ No newline at end of file
diff --git a/cmake-2.8.10.2/Source/cmCoreTryCompile.h b/cmake-2.8.10.2/Source/cmCoreTryCompile.h
index 5c67f13..5d52548 100644
--- a/cmake-2.8.10.2/Source/cmCoreTryCompile.h
+++ b/cmake-2.8.10.2/Source/cmCoreTryCompile.h
@@ -14,6 +14,9 @@
#include "cmCommand.h"
+#define CREATE_MANIFEST_OK 0x00
+#define CREATE_MANIFEST_ERROR 0x01
+
/** \class cmCoreTryCompile
* \brief Base class for cmTryCompileCommand and cmTryRunCommand
*
@@ -46,6 +49,11 @@ public:
*/
void FindOutputFile(const char* targetName);
+ /**
+ *Create Package.appxmanifest for Visual Studio 11 ARM generator.
+ If no errors returns CREATE_MANIFEST_OK, else CREATE_MANIFEST_ERROR.
+ */
+ int CreatePackageAppxmanifestForTest();
cmTypeMacro(cmCoreTryCompile, cmCommand);
diff --git a/cmake-2.8.10.2/Source/cmLocalGenerator.cxx b/cmake-2.8.10.2/Source/cmLocalGenerator.cxx
index 4952a8c..638bf0c 100644
--- a/cmake-2.8.10.2/Source/cmLocalGenerator.cxx
+++ b/cmake-2.8.10.2/Source/cmLocalGenerator.cxx
@@ -3203,6 +3203,12 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop)
}
+//----------------------------------------------------------------------------
+bool cmLocalGenerator::isVS11ARMCurrentGlobalGenerator()
+{
+ return (std::string(this->GlobalGenerator->GetName()) == "Visual Studio 11 ARM");
+}
+
//----------------------------------------------------------------------------
void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
const char* targetName,
const char* fname)
diff --git a/cmake-2.8.10.2/Source/cmLocalGenerator.h b/cmake-2.8.10.2/Source/cmLocalGenerator.h
index bd58218..930a62f 100644
--- a/cmake-2.8.10.2/Source/cmLocalGenerator.h
+++ b/cmake-2.8.10.2/Source/cmLocalGenerator.h
@@ -81,6 +81,9 @@ public:
const cmMakefile *GetMakefile() const {
return this->Makefile; };
+ ///! Returns bool value responsible for VS11ARM was set as current global generator.
+ bool isVS11ARMCurrentGlobalGenerator();
+
///! Get the GlobalGenerator this is associated with
cmGlobalGenerator *GetGlobalGenerator() {
return this->GlobalGenerator; };
diff --git a/cmake-2.8.10.2/Source/cmProjectCommand.cxx b/cmake-2.8.10.2/Source/cmProjectCommand.cxx
index 11f9a76..fc1b726 100644
--- a/cmake-2.8.10.2/Source/cmProjectCommand.cxx
+++ b/cmake-2.8.10.2/Source/cmProjectCommand.cxx
@@ -71,11 +71,23 @@ bool cmProjectCommand
}
}
else
- {
- // if no language is specified do c and c++
- languages.push_back("C");
- languages.push_back("CXX");
- }
+ {
+ std::string flags = this->Makefile->GetDefineFlags();
+ std::transform(flags.begin(), flags.end(), flags.begin(), ::tolower);
+
+ int zwIndex = flags.find("-zw");
+
+ if (zwIndex != -1 || this->GetMakefile()->GetLocalGenerator()->isVS11ARMCurrentGlobalGenerator())
+ {
+ languages.push_back("CXX");
+ }
+ else
+ {
+ // if no language is specified do c and c++
+ languages.push_back("C");
+ languages.push_back("CXX");
+ }
+ }
this->Makefile->EnableLanguage(languages, false);
std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
const char* include = this->Makefile->GetDefinition(extraInclude.c_str());
diff --git a/cmake-2.8.10.2/Source/cmVisualStudio10TargetGenerator.cxx b/cmake-2.8.10.2/Source/cmVisualStudio10TargetGenerator.cxx
index 1e37ca5..aff1a0a 100644
--- a/cmake-2.8.10.2/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/cmake-2.8.10.2/Source/cmVisualStudio10TargetGenerator.cxx
@@ -262,6 +262,13 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ this->LocalGenerator->isVS11ARMCurrentGlobalGenerator())
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
@@ -814,6 +821,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool <<
" Include=\"" << sourceFile << "\"" << (end? end : " />\n");
ToolSource toolSource = {sf, forceRelative};
@@ -1285,6 +1296,14 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
<< this->Target->GetPDBName(configName.c_str())
<< "</ProgramDataBaseFileName>\n";
}
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")
+ || this->LocalGenerator->isVS11ARMCurrentGlobalGenerator())
+ {
+ this->WriteString("<AdditionalUsingDirectories>"
+ "$(ProgramFiles)\\Windows Kits\\8.0\\References\\CommonConfiguration\\Neutral;"
+ "$(VCInstallDir)\\vcpackages;%(AdditionalUsingDirectories)"
+ "</AdditionalUsingDirectories>\n", 3);
+ }
this->WriteString("</ClCompile>\n", 2);
}
@@ -1428,8 +1447,9 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
std::string standardLibsVar = "CMAKE_";
standardLibsVar += linkLanguage;
standardLibsVar += "_STANDARD_LIBRARIES";
- std::string
- libs = this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
+ std::string libs = "";
+ if(!this->LocalGenerator->isVS11ARMCurrentGlobalGenerator())
+ libs = this->Makefile->GetSafeDefinition(standardLibsVar.c_str());
// Remove trailing spaces from libs
std::string::size_type pos = libs.size()-1;
if(libs.size() != 0)
WinRTon2.8.12.patch [^] (3,499 bytes) 2013-11-09 10:02 [Show Content] [Hide Content]diff -r b329241f1d77 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Fri Nov 08 22:22:20 2013 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Sat Nov 09 22:59:32 2013 +0800
@@ -296,6 +296,11 @@
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -956,6 +961,10 @@
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -967,7 +976,67 @@
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool addition_prop = false;
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ std::string configUpper = cmSystemTools::UpperCase((*configs)[i]);
+ std::string defPropName = "COMPILE_DEFINITIONS_";
+ defPropName += configUpper;
+ const char* ccdefs = sf->GetProperty(defPropName.c_str());
+ if (ccdefs)
+ {
+ if (strcmp(ccdefs, "-DCONTENT") == 0)
+ {
+ deployment[i] = true;
+ addition_prop = true;
+ }
+ else if (strcmp(ccdefs, "-DEXCLUDED") == 0)
+ {
+ excluded[i] = true;
+ addition_prop = true;
+ }
+ }
+ }
+ }
+
+ if (addition_prop)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream) << (end ? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
WinRTon2.8.12.v2.patch [^] (3,953 bytes) 2013-11-11 20:38 [Show Content] [Hide Content]diff -r b329241f1d77 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Fri Nov 08 22:22:20 2013 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Tue Nov 12 09:36:04 2013 +0800
@@ -296,6 +296,20 @@
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -956,6 +970,10 @@
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -967,7 +985,67 @@
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool addition_prop = false;
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ std::string configUpper = cmSystemTools::UpperCase((*configs)[i]);
+ std::string defPropName = "COMPILE_DEFINITIONS_";
+ defPropName += configUpper;
+ const char* ccdefs = sf->GetProperty(defPropName.c_str());
+ if (ccdefs)
+ {
+ if (strcmp(ccdefs, "-DCONTENT") == 0)
+ {
+ deployment[i] = true;
+ addition_prop = true;
+ }
+ else if (strcmp(ccdefs, "-DEXCLUDED") == 0)
+ {
+ excluded[i] = true;
+ addition_prop = true;
+ }
+ }
+ }
+ }
+
+ if (addition_prop)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream) << (end ? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
WinRTon2.8.12.1.v3.patch [^] (6,685 bytes) 2013-11-23 10:45 [Show Content] [Hide Content]diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio71Generator.cxx
--- a/Source/cmGlobalVisualStudio71Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio71Generator.cxx Sat Nov 23 23:36:55 2013 +0800
@@ -278,7 +278,7 @@
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio71Generator.h
--- a/Source/cmGlobalVisualStudio71Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio71Generator.h Sat Nov 23 23:36:55 2013 +0800
@@ -63,7 +63,7 @@
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteExternalProject(std::ostream& fout,
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio7Generator.cxx
--- a/Source/cmGlobalVisualStudio7Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio7Generator.cxx Sat Nov 23 23:36:55 2013 +0800
@@ -271,7 +271,7 @@
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
this->WriteProjectConfigurations(
- fout, target->GetName(), target->GetType(),
+ fout, target->GetName(), *target, target->GetType(),
allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
}
else
@@ -283,7 +283,7 @@
target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName)
{
- this->WriteProjectConfigurations(fout, vcprojName, target->GetType(),
+ this->WriteProjectConfigurations(fout, vcprojName, *target, target->GetType(),
configsPartOfDefaultBuild);
}
}
@@ -611,7 +611,7 @@
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio7Generator.h
--- a/Source/cmGlobalVisualStudio7Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio7Generator.h Sat Nov 23 23:36:55 2013 +0800
@@ -114,7 +114,7 @@
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteSLNGlobalSections(std::ostream& fout,
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio8Generator.cxx
--- a/Source/cmGlobalVisualStudio8Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio8Generator.cxx Sat Nov 23 23:36:55 2013 +0800
@@ -356,7 +356,7 @@
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
@@ -379,7 +379,7 @@
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || target.GetPropertyAsBool("VS_WINRT_EXTENSIONS")) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio8Generator.h
--- a/Source/cmGlobalVisualStudio8Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio8Generator.h Sat Nov 23 23:36:55 2013 +0800
@@ -77,7 +77,7 @@
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
diff -r c8ee4f7bec83 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Sat Nov 23 23:36:55 2013 +0800
@@ -296,6 +296,20 @@
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -956,6 +970,10 @@
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
WinRTon2.8.12.1.v4.patch [^] (9,056 bytes) 2013-11-25 10:15 [Show Content] [Hide Content]diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio71Generator.cxx
--- a/Source/cmGlobalVisualStudio71Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio71Generator.cxx Mon Nov 25 23:06:35 2013 +0800
@@ -278,7 +278,7 @@
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio71Generator.h
--- a/Source/cmGlobalVisualStudio71Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio71Generator.h Mon Nov 25 23:06:35 2013 +0800
@@ -63,7 +63,7 @@
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteExternalProject(std::ostream& fout,
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio7Generator.cxx
--- a/Source/cmGlobalVisualStudio7Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio7Generator.cxx Mon Nov 25 23:06:35 2013 +0800
@@ -271,7 +271,7 @@
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
this->WriteProjectConfigurations(
- fout, target->GetName(), target->GetType(),
+ fout, target->GetName(), *target, target->GetType(),
allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
}
else
@@ -283,7 +283,7 @@
target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName)
{
- this->WriteProjectConfigurations(fout, vcprojName, target->GetType(),
+ this->WriteProjectConfigurations(fout, vcprojName, *target, target->GetType(),
configsPartOfDefaultBuild);
}
}
@@ -611,7 +611,7 @@
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio7Generator.h
--- a/Source/cmGlobalVisualStudio7Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio7Generator.h Mon Nov 25 23:06:35 2013 +0800
@@ -114,7 +114,7 @@
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteSLNGlobalSections(std::ostream& fout,
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio8Generator.cxx
--- a/Source/cmGlobalVisualStudio8Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio8Generator.cxx Mon Nov 25 23:06:35 2013 +0800
@@ -356,7 +356,7 @@
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
@@ -379,7 +379,7 @@
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || target.GetPropertyAsBool("VS_WINRT_EXTENSIONS")) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio8Generator.h
--- a/Source/cmGlobalVisualStudio8Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio8Generator.h Mon Nov 25 23:06:35 2013 +0800
@@ -77,7 +77,7 @@
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
diff -r c8ee4f7bec83 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Mon Nov 25 23:06:35 2013 +0800
@@ -296,6 +296,20 @@
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -956,6 +970,10 @@
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -967,7 +985,63 @@
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool addition_prop = false;
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(sf->GetProperty("VS_WINRT_CONTENT"));
+ if (0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ addition_prop = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ addition_prop = true;
+ }
+ }
+ }
+
+ if (addition_prop)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream) << (end ? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
WinRTon2.8.12.1.v5.patch [^] (11,116 bytes) 2013-11-26 10:19 [Show Content] [Hide Content]diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio71Generator.cxx
--- a/Source/cmGlobalVisualStudio71Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio71Generator.cxx Tue Nov 26 23:17:32 2013 +0800
@@ -278,7 +278,7 @@
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio71Generator.h
--- a/Source/cmGlobalVisualStudio71Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio71Generator.h Tue Nov 26 23:17:32 2013 +0800
@@ -63,7 +63,7 @@
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteExternalProject(std::ostream& fout,
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio7Generator.cxx
--- a/Source/cmGlobalVisualStudio7Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio7Generator.cxx Tue Nov 26 23:17:32 2013 +0800
@@ -271,7 +271,7 @@
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
this->WriteProjectConfigurations(
- fout, target->GetName(), target->GetType(),
+ fout, target->GetName(), *target, target->GetType(),
allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
}
else
@@ -283,7 +283,7 @@
target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName)
{
- this->WriteProjectConfigurations(fout, vcprojName, target->GetType(),
+ this->WriteProjectConfigurations(fout, vcprojName, *target, target->GetType(),
configsPartOfDefaultBuild);
}
}
@@ -611,7 +611,7 @@
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio7Generator.h
--- a/Source/cmGlobalVisualStudio7Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio7Generator.h Tue Nov 26 23:17:32 2013 +0800
@@ -114,7 +114,7 @@
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteSLNGlobalSections(std::ostream& fout,
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio8Generator.cxx
--- a/Source/cmGlobalVisualStudio8Generator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio8Generator.cxx Tue Nov 26 23:17:32 2013 +0800
@@ -356,7 +356,7 @@
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
@@ -379,7 +379,7 @@
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || target.GetPropertyAsBool("VS_WINRT_EXTENSIONS")) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
diff -r c8ee4f7bec83 Source/cmGlobalVisualStudio8Generator.h
--- a/Source/cmGlobalVisualStudio8Generator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmGlobalVisualStudio8Generator.h Tue Nov 26 23:17:32 2013 +0800
@@ -77,7 +77,7 @@
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
diff -r c8ee4f7bec83 Source/cmVisualStudio10TargetGenerator.cxx
--- a/Source/cmVisualStudio10TargetGenerator.cxx Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.cxx Tue Nov 26 23:17:32 2013 +0800
@@ -296,6 +296,20 @@
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -323,6 +337,7 @@
" Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
+ this->WriteWinRTPackageCertificateKeyFile();
this->WritePathAndIncrementalLinkOptions();
this->WriteItemDefinitionGroups();
this->WriteCustomCommands();
@@ -436,6 +451,34 @@
}
}
+void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
+{
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")
+ && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ {
+ std::string pfxFile;
+ for(std::vector<cmSourceFile*>::const_iterator
+ si = this->GeneratorTarget->ExtraSources.begin();
+ si != this->GeneratorTarget->ExtraSources.end(); ++si)
+ {
+ if ("pfx" == (*si)->GetExtension())
+ {
+ pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(pfxFile);
+ break;
+ }
+ }
+
+ if (!pfxFile.empty())
+ {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<", 2);
+ (*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile << "</PackageCertificateKeyFile>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
@@ -956,6 +999,10 @@
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -967,7 +1014,67 @@
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool addition_prop = false;
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ const char* content = sf->GetProperty("VS_WINRT_CONTENT");
+ if (content)
+ {
+ addition_prop = true;
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(content);
+ if (0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ }
+ }
+ }
+ }
+
+ if (addition_prop)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream) << (end ? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
diff -r c8ee4f7bec83 Source/cmVisualStudio10TargetGenerator.h
--- a/Source/cmVisualStudio10TargetGenerator.h Tue Nov 12 21:07:57 2013 +0800
+++ b/Source/cmVisualStudio10TargetGenerator.h Tue Nov 26 23:17:32 2013 +0800
@@ -61,6 +61,7 @@
void WriteDotNetReferences();
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
+ void WriteWinRTPackageCertificateKeyFile();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
0001-CMake-Add-support-for-WinRT-platforms-and-metro-apps.patch [^] (24,228 bytes) 2014-01-31 01:49 [Show Content] [Hide Content]From 4c3b092bdd4eec7422bd7b684d3b0b44cdc192b6 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Fri, 31 Jan 2014 14:05:17 +0800
Subject: [PATCH] CMake: Add support for WinRT platforms and "metro" apps.
1. Add AppContainerApplication, ApplicationType, MinimumVisualStudioVersion and ApplicationTypeRevision tags to vcxproj when VS_WINRT_EXTENSIONS is on.
2. Recognize AppxManifest file type.
3. A dedicated boolean source file property "VS_WINRT_CONTENT" is added. Generator expressions is also supported here.
4. Add "Deploy.0" in .sln for deploy WinRT apps by default, as WinCE apps do.
5. Add PackageCertificateKeyFile tag to vcxproj for package certification.
6. Determine MSVC ARM compiler.
7. Modify ARM's utility project to Win32 configuration.
---
Modules/CMakeDetermineCompilerId.cmake | 4 +
Modules/CMakeDetermineSystem.cmake | 6 ++
Modules/CompilerId/VS-10.vcxproj.in | 2 +
Modules/Platform/Windows-MSVC.cmake | 6 +-
Source/cmGlobalVisualStudio71Generator.cxx | 2 +-
Source/cmGlobalVisualStudio71Generator.h | 2 +-
Source/cmGlobalVisualStudio7Generator.cxx | 6 +-
Source/cmGlobalVisualStudio7Generator.h | 2 +-
Source/cmGlobalVisualStudio8Generator.cxx | 16 ++-
Source/cmGlobalVisualStudio8Generator.h | 2 +-
Source/cmLocalGenerator.cxx | 7 ++
Source/cmLocalGenerator.h | 3 +
Source/cmProjectCommand.cxx | 18 +++-
Source/cmVisualStudio10TargetGenerator.cxx | 155 +++++++++++++++++++++++++++--
Source/cmVisualStudio10TargetGenerator.h | 1 +
15 files changed, 209 insertions(+), 23 deletions(-)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 067892d..43e89d8 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -170,6 +170,10 @@ Id flags: ${testflags}
set(id_subsystem 1)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ if(CMAKE_GENERATOR MATCHES "ARM")
+ set(id_win_store "<ApplicationType>Windows Store</ApplicationType>")
+ set(id_win_app_container "<WindowsAppContainer>true</WindowsAppContainer>")
+ endif()
get_filename_component(id_src "${src}" NAME)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f1bad99..7b0007b 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -121,6 +121,12 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_GENERATOR MATCHES "ARM")
+ set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ set(CMAKE_SYSTEM_PROCESSOR "ARM")
+ set(CMAKE_CROSSCOMPILING TRUE)
+ set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..4975cbc 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,12 +10,14 @@
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
+ @id_win_store@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
+ @id_win_app_container@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index e29aaf4..36ad516 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -166,7 +166,11 @@ else()
if(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
- set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ if(CMAKE_GENERATOR MATCHES "ARM")
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ endif()
else()
set(_RTC1 "/GZ")
set(_FLAGS_CXX " /GR /GX")
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 22e4f08..a36d3ee 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -277,7 +277,7 @@ void cmGlobalVisualStudio71Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, const cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 04e3a55..141c6b0 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -65,7 +65,7 @@ protected:
const char* name, const char* path,
cmTarget const& t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteExternalProject(std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index bb63289..71fdb57 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -381,7 +381,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
this->WriteProjectConfigurations(
- fout, target->GetName(), target->GetType(),
+ fout, target->GetName(), *target, target->GetType(),
allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
}
else
@@ -393,7 +393,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName)
{
- this->WriteProjectConfigurations(fout, vcprojName, target->GetType(),
+ this->WriteProjectConfigurations(fout, vcprojName, *target, target->GetType(),
configsPartOfDefaultBuild);
}
}
@@ -729,7 +729,7 @@ cmGlobalVisualStudio7Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, const cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index f69bd84..1afdf50 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -129,7 +129,7 @@ protected:
const char* name, const char* path,
cmTarget const&t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteSLNGlobalSections(std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 12c240b..30cda83 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -372,17 +372,23 @@ cmGlobalVisualStudio8Generator
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
+ std::string platformName = this->GetPlatformName();
+ if((cmTarget::UTILITY == type) &&
+ ("ARM" == platformName))
+ {
+ platformName = "Win32";
+ }
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (platformMapping ? platformMapping : platformName)
<< "\n";
std::set<std::string>::const_iterator
ci = configsPartOfDefaultBuild.find(*i);
@@ -390,16 +396,16 @@ cmGlobalVisualStudio8Generator
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (platformMapping ? platformMapping : platformName)
<< "\n";
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || target.GetPropertyAsBool("VS_WINRT_EXTENSIONS")) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (platformMapping ? platformMapping : platformName)
<< "\n";
}
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 5b952c4..e2c3603 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -79,7 +79,7 @@ protected:
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c13b8ee..301de48 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3451,6 +3451,13 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop)
}
//----------------------------------------------------------------------------
+bool cmLocalGenerator::IsMSVCARMCurrentGlobalGenerator()
+{
+ return (0 == strcmp(this->GlobalGenerator->GetName(), "Visual Studio 11 ARM"))
+ || (0 == strcmp(this->GlobalGenerator->GetName(), "Visual Studio 12 ARM"));
+}
+
+//----------------------------------------------------------------------------
void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
const char* targetName,
const char* fname)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index ad662d5..dd3c678 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -81,6 +81,9 @@ public:
const cmMakefile *GetMakefile() const {
return this->Makefile; };
+ ///! Returns bool value responsible for VS11+ ARM was set as current global generator.
+ bool IsMSVCARMCurrentGlobalGenerator();
+
///! Get the GlobalGenerator this is associated with
cmGlobalGenerator *GetGlobalGenerator() {
return this->GlobalGenerator; };
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 11f9a76..dc40056 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -72,9 +72,21 @@ bool cmProjectCommand
}
else
{
- // if no language is specified do c and c++
- languages.push_back("C");
- languages.push_back("CXX");
+ std::string flags = this->Makefile->GetDefineFlags();
+ std::transform(flags.begin(), flags.end(), flags.begin(), ::tolower);
+
+ int zwIndex = flags.find("-zw");
+
+ if ((zwIndex != -1) || this->GetMakefile()->GetLocalGenerator()->IsMSVCARMCurrentGlobalGenerator())
+ {
+ languages.push_back("CXX");
+ }
+ else
+ {
+ // if no language is specified do c and c++
+ languages.push_back("C");
+ languages.push_back("CXX");
+ }
}
this->Makefile->EnableLanguage(languages, false);
std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ed7e243..c4dc95c 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -147,6 +147,13 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
std::ostream* stream)
{
+ std::string platformName = this->Platform;
+ if((0 == strcmp(tag, "PropertyGroup")) &&
+ (cmTarget::UTILITY == this->Target->GetType()) &&
+ this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator())
+ {
+ platformName = "Win32";
+ }
if(!stream)
{
stream = this->BuildFileStream;
@@ -156,7 +163,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
(*stream ) << "";
(*stream ) << "<" << tag
<< " Condition=\"'$(Configuration)|$(Platform)'=='";
- (*stream ) << config << "|" << this->Platform << "'\"";
+ (*stream ) << config << "|" << platformName << "'\"";
if(attribute)
{
(*stream ) << attribute;
@@ -289,8 +296,14 @@ void cmVisualStudio10TargetGenerator::Generate()
"</RootNamespace>\n";
}
+ std::string platformName = this->Platform;
+ if((cmTarget::UTILITY == this->Target->GetType()) &&
+ this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator())
+ {
+ platformName = "Win32";
+ }
this->WriteString("<Platform>", 2);
- (*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ (*this->BuildFileStream) << platformName << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
if(!projLabel)
{
@@ -298,6 +311,25 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ (this->Target->GetType() != cmTarget::UTILITY)))
+ {
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -325,6 +357,7 @@ void cmVisualStudio10TargetGenerator::Generate()
" Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
+ this->WriteWinRTPackageCertificateKeyFile();
this->WritePathAndIncrementalLinkOptions();
this->WriteItemDefinitionGroups();
this->WriteCustomCommands();
@@ -438,10 +471,45 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
}
}
+void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
+{
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")
+ && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ {
+ std::string pfxFile;
+ std::vector<cmSourceFile*> extraSources;
+ this->GeneratorTarget->GetExtraSources(extraSources);
+ for(std::vector<cmSourceFile*>::const_iterator si = extraSources.begin();
+ si != extraSources.end(); ++si)
+ {
+ if ("pfx" == (*si)->GetExtension())
+ {
+ pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(pfxFile);
+ break;
+ }
+ }
+
+ if (!pfxFile.empty())
+ {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<", 2);
+ (*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile << "</PackageCertificateKeyFile>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
{
+ std::string platformName = this->Platform;
+ if((cmTarget::UTILITY == this->Target->GetType()) &&
+ this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator())
+ {
+ platformName = "Win32";
+ }
this->WriteString("<ItemGroup Label=\"ProjectConfigurations\">\n", 1);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
@@ -450,11 +518,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
i != configs->end(); ++i)
{
this->WriteString("<ProjectConfiguration Include=\"", 2);
- (*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n";
+ (*this->BuildFileStream ) << *i << "|" << platformName << "\">\n";
this->WriteString("<Configuration>", 3);
(*this->BuildFileStream ) << *i << "</Configuration>\n";
this->WriteString("<Platform>", 3);
- (*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ (*this->BuildFileStream) << platformName << "</Platform>\n";
this->WriteString("</ProjectConfiguration>\n", 2);
}
this->WriteString("</ItemGroup>\n", 1);
@@ -517,7 +585,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
this->ClOptions[*i]->UsingUnicode()) ||
- this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ (this->Target->GetType() != cmTarget::UTILITY))))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -537,7 +607,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
- if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ (this->Target->GetType() != cmTarget::UTILITY)))
{
this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
@@ -963,6 +1035,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -974,7 +1050,67 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool addition_prop = false;
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ const char* content = sf->GetProperty("VS_WINRT_CONTENT");
+ if (content)
+ {
+ addition_prop = true;
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(content);
+ if (0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ }
+ }
+ }
+ }
+
+ if (addition_prop)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream) << (end ? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
@@ -1427,6 +1563,11 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX");
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
+ if (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ !this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<CompileAsWinRT>false</CompileAsWinRT>\n", 3);
+ }
this->WriteString("</ClCompile>\n", 2);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d1f3d19..b4ef909 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -61,6 +61,7 @@ private:
void WriteDotNetReferences();
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
+ void WriteWinRTPackageCertificateKeyFile();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
--
1.8.5.2.msysgit.0
0001-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v2.patch [^] (24,293 bytes) 2014-01-31 23:10 [Show Content] [Hide Content]From e907def320e97a9971762eb9442d32c95452e21d Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sat, 1 Feb 2014 12:08:43 +0800
Subject: [PATCH] CMake: Add support for WinRT platforms and "metro" apps.
1. Add AppContainerApplication, ApplicationType, MinimumVisualStudioVersion and ApplicationTypeRevision tags to vcxproj when VS_WINRT_EXTENSIONS is on.
2. Recognize AppxManifest file type.
3. A dedicated boolean source file property "VS_WINRT_CONTENT" is added. Generator expressions is also supported here.
4. Add "Deploy.0" in .sln for deploy WinRT apps by default, as WinCE apps do.
5. Add PackageCertificateKeyFile tag to vcxproj for package certification.
6. Determine MSVC ARM compiler.
7. Modify ARM's utility project to Win32 configuration.
---
Modules/CMakeDetermineCompilerId.cmake | 4 +
Modules/CMakeDetermineSystem.cmake | 6 ++
Modules/CompilerId/VS-10.vcxproj.in | 2 +
Modules/Platform/Windows-MSVC.cmake | 6 +-
Source/cmGlobalVisualStudio71Generator.cxx | 2 +-
Source/cmGlobalVisualStudio71Generator.h | 2 +-
Source/cmGlobalVisualStudio7Generator.cxx | 6 +-
Source/cmGlobalVisualStudio7Generator.h | 2 +-
Source/cmGlobalVisualStudio8Generator.cxx | 16 ++-
Source/cmGlobalVisualStudio8Generator.h | 2 +-
Source/cmLocalGenerator.cxx | 7 ++
Source/cmLocalGenerator.h | 3 +
Source/cmProjectCommand.cxx | 18 +++-
Source/cmVisualStudio10TargetGenerator.cxx | 155 +++++++++++++++++++++++++++--
Source/cmVisualStudio10TargetGenerator.h | 1 +
15 files changed, 209 insertions(+), 23 deletions(-)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 067892d..1a1c896 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -170,6 +170,10 @@ Id flags: ${testflags}
set(id_subsystem 1)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ if(CMAKE_GENERATOR MATCHES "Visual Studio ([0-9]+) ARM")
+ set(id_win_store "<ApplicationType>Windows Store</ApplicationType>")
+ set(id_win_app_container "<WindowsAppContainer>true</WindowsAppContainer>")
+ endif()
get_filename_component(id_src "${src}" NAME)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f1bad99..b45103c 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -121,6 +121,12 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_GENERATOR MATCHES "Visual Studio ([0-9]+) ARM")
+ set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ set(CMAKE_SYSTEM_PROCESSOR "ARM")
+ set(CMAKE_CROSSCOMPILING TRUE)
+ set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..4975cbc 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,12 +10,14 @@
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
+ @id_win_store@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
+ @id_win_app_container@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index e29aaf4..3765c71 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -166,7 +166,11 @@ else()
if(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
- set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ if(CMAKE_GENERATOR MATCHES "Visual Studio ([0-9]+) ARM")
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ endif()
else()
set(_RTC1 "/GZ")
set(_FLAGS_CXX " /GR /GX")
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 22e4f08..a36d3ee 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -277,7 +277,7 @@ void cmGlobalVisualStudio71Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, const cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index 04e3a55..141c6b0 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -65,7 +65,7 @@ protected:
const char* name, const char* path,
cmTarget const& t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteExternalProject(std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index bb63289..71fdb57 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -381,7 +381,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
std::set<std::string> allConfigurations(this->Configurations.begin(),
this->Configurations.end());
this->WriteProjectConfigurations(
- fout, target->GetName(), target->GetType(),
+ fout, target->GetName(), *target, target->GetType(),
allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
}
else
@@ -393,7 +393,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
target->GetProperty("GENERATOR_FILE_NAME");
if (vcprojName)
{
- this->WriteProjectConfigurations(fout, vcprojName, target->GetType(),
+ this->WriteProjectConfigurations(fout, vcprojName, *target, target->GetType(),
configsPartOfDefaultBuild);
}
}
@@ -729,7 +729,7 @@ cmGlobalVisualStudio7Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType,
+ std::ostream& fout, const char* name, const cmTarget&, cmTarget::TargetType,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index f69bd84..1afdf50 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -129,7 +129,7 @@ protected:
const char* name, const char* path,
cmTarget const&t);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual void WriteSLNGlobalSections(std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 12c240b..27c73de 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -372,17 +372,23 @@ cmGlobalVisualStudio8Generator
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping)
{
+ std::string platformName = this->GetPlatformName();
+ if((type >= cmTarget::UTILITY) &&
+ ("ARM" == platformName))
+ {
+ platformName = "Win32";
+ }
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (platformMapping ? platformMapping : platformName)
<< "\n";
std::set<std::string>::const_iterator
ci = configsPartOfDefaultBuild.find(*i);
@@ -390,16 +396,16 @@ cmGlobalVisualStudio8Generator
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (platformMapping ? platformMapping : platformName)
<< "\n";
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || target.GetPropertyAsBool("VS_WINRT_EXTENSIONS")) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
- << (platformMapping ? platformMapping : this->GetPlatformName())
+ << (platformMapping ? platformMapping : platformName)
<< "\n";
}
}
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 5b952c4..e2c3603 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -79,7 +79,7 @@ protected:
virtual void WriteSLNHeader(std::ostream& fout);
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(
- std::ostream& fout, const char* name, cmTarget::TargetType type,
+ std::ostream& fout, const char* name, const cmTarget& target, cmTarget::TargetType type,
const std::set<std::string>& configsPartOfDefaultBuild,
const char* platformMapping = NULL);
virtual bool ComputeTargetDepends();
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index c13b8ee..301de48 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -3451,6 +3451,13 @@ static void cmLGInfoProp(cmMakefile* mf, cmTarget* target, const char* prop)
}
//----------------------------------------------------------------------------
+bool cmLocalGenerator::IsMSVCARMCurrentGlobalGenerator()
+{
+ return (0 == strcmp(this->GlobalGenerator->GetName(), "Visual Studio 11 ARM"))
+ || (0 == strcmp(this->GlobalGenerator->GetName(), "Visual Studio 12 ARM"));
+}
+
+//----------------------------------------------------------------------------
void cmLocalGenerator::GenerateAppleInfoPList(cmTarget* target,
const char* targetName,
const char* fname)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index ad662d5..dd3c678 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -81,6 +81,9 @@ public:
const cmMakefile *GetMakefile() const {
return this->Makefile; };
+ ///! Returns bool value responsible for VS11+ ARM was set as current global generator.
+ bool IsMSVCARMCurrentGlobalGenerator();
+
///! Get the GlobalGenerator this is associated with
cmGlobalGenerator *GetGlobalGenerator() {
return this->GlobalGenerator; };
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index 11f9a76..dc40056 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -72,9 +72,21 @@ bool cmProjectCommand
}
else
{
- // if no language is specified do c and c++
- languages.push_back("C");
- languages.push_back("CXX");
+ std::string flags = this->Makefile->GetDefineFlags();
+ std::transform(flags.begin(), flags.end(), flags.begin(), ::tolower);
+
+ int zwIndex = flags.find("-zw");
+
+ if ((zwIndex != -1) || this->GetMakefile()->GetLocalGenerator()->IsMSVCARMCurrentGlobalGenerator())
+ {
+ languages.push_back("CXX");
+ }
+ else
+ {
+ // if no language is specified do c and c++
+ languages.push_back("C");
+ languages.push_back("CXX");
+ }
}
this->Makefile->EnableLanguage(languages, false);
std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ed7e243..9974a43 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -147,6 +147,13 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
std::ostream* stream)
{
+ std::string platformName = this->Platform;
+ if((0 == strcmp(tag, "PropertyGroup")) &&
+ (this->Target->GetType() >= cmTarget::UTILITY) &&
+ this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator())
+ {
+ platformName = "Win32";
+ }
if(!stream)
{
stream = this->BuildFileStream;
@@ -156,7 +163,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
(*stream ) << "";
(*stream ) << "<" << tag
<< " Condition=\"'$(Configuration)|$(Platform)'=='";
- (*stream ) << config << "|" << this->Platform << "'\"";
+ (*stream ) << config << "|" << platformName << "'\"";
if(attribute)
{
(*stream ) << attribute;
@@ -289,8 +296,14 @@ void cmVisualStudio10TargetGenerator::Generate()
"</RootNamespace>\n";
}
+ std::string platformName = this->Platform;
+ if((this->Target->GetType() >= cmTarget::UTILITY) &&
+ this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator())
+ {
+ platformName = "Win32";
+ }
this->WriteString("<Platform>", 2);
- (*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ (*this->BuildFileStream) << platformName << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
if(!projLabel)
{
@@ -298,6 +311,25 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ (this->Target->GetType() < cmTarget::UTILITY)))
+ {
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
@@ -325,6 +357,7 @@ void cmVisualStudio10TargetGenerator::Generate()
" Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
+ this->WriteWinRTPackageCertificateKeyFile();
this->WritePathAndIncrementalLinkOptions();
this->WriteItemDefinitionGroups();
this->WriteCustomCommands();
@@ -438,10 +471,45 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
}
}
+void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
+{
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")
+ && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ {
+ std::string pfxFile;
+ std::vector<cmSourceFile*> extraSources;
+ this->GeneratorTarget->GetExtraSources(extraSources);
+ for(std::vector<cmSourceFile*>::const_iterator si = extraSources.begin();
+ si != extraSources.end(); ++si)
+ {
+ if ("pfx" == (*si)->GetExtension())
+ {
+ pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(pfxFile);
+ break;
+ }
+ }
+
+ if (!pfxFile.empty())
+ {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<", 2);
+ (*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile << "</PackageCertificateKeyFile>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
{
+ std::string platformName = this->Platform;
+ if((this->Target->GetType() >= cmTarget::UTILITY) &&
+ this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator())
+ {
+ platformName = "Win32";
+ }
this->WriteString("<ItemGroup Label=\"ProjectConfigurations\">\n", 1);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
@@ -450,11 +518,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
i != configs->end(); ++i)
{
this->WriteString("<ProjectConfiguration Include=\"", 2);
- (*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n";
+ (*this->BuildFileStream ) << *i << "|" << platformName << "\">\n";
this->WriteString("<Configuration>", 3);
(*this->BuildFileStream ) << *i << "</Configuration>\n";
this->WriteString("<Platform>", 3);
- (*this->BuildFileStream) << this->Platform << "</Platform>\n";
+ (*this->BuildFileStream) << platformName << "</Platform>\n";
this->WriteString("</ProjectConfiguration>\n", 2);
}
this->WriteString("</ItemGroup>\n", 1);
@@ -517,7 +585,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
this->ClOptions[*i]->UsingUnicode()) ||
- this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ (this->Target->GetType() < cmTarget::UTILITY))))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -537,7 +607,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
- if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ (this->Target->GetType() < cmTarget::UTILITY)))
{
this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
@@ -963,6 +1035,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if (sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -974,7 +1050,67 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool addition_prop = false;
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ const char* content = sf->GetProperty("VS_WINRT_CONTENT");
+ if (content)
+ {
+ addition_prop = true;
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(content);
+ if (0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ }
+ }
+ }
+ }
+
+ if (addition_prop)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream) << (end ? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
@@ -1427,6 +1563,11 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX");
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
+ if (this->LocalGenerator->IsMSVCARMCurrentGlobalGenerator() &&
+ !this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<CompileAsWinRT>false</CompileAsWinRT>\n", 3);
+ }
this->WriteString("</ClCompile>\n", 2);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d1f3d19..b4ef909 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -61,6 +61,7 @@ private:
void WriteDotNetReferences();
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
+ void WriteWinRTPackageCertificateKeyFile();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
--
1.8.5.2.msysgit.0
0001-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v3.patch [^] (11,552 bytes) 2014-02-05 01:43 [Show Content] [Hide Content]From 72273965159fbadd08f6981167b2e8669afe9737 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Wed, 5 Feb 2014 11:12:16 +0800
Subject: [PATCH 1/3] CMake: Add support for WinRT platforms and "metro" apps.
1. Add WinRT generator to VS11 and VS12.
2. Add CMAKE_VS_WINRT_VERSION definition.
---
Modules/CMakeDetermineCompilerId.cmake | 4 ++++
Modules/CMakeDetermineSystem.cmake | 12 ++++++++++++
Modules/CompilerId/VS-10.vcxproj.in | 2 ++
Modules/Platform/Windows-MSVC.cmake | 9 ++++++++-
Source/cmGlobalVisualStudio11Generator.cxx | 26 ++++++++++++++++++++++++++
Source/cmGlobalVisualStudio12Generator.cxx | 27 +++++++++++++++++++++++++++
Source/cmGlobalVisualStudio8Generator.cxx | 6 ++++++
Source/cmGlobalVisualStudio8Generator.h | 5 +++++
Source/cmGlobalVisualStudioGenerator.h | 3 +++
Source/cmProjectCommand.cxx | 19 ++++++++++++++++---
Source/cmVisualStudio10TargetGenerator.cxx | 17 +++++++++++++++++
11 files changed, 126 insertions(+), 4 deletions(-)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 067892d..3013f13 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -170,6 +170,10 @@ Id flags: ${testflags}
set(id_subsystem 1)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ if(CMAKE_VS_WINRT_VERSION)
+ set(id_win_store "<ApplicationType>Windows Store</ApplicationType>")
+ set(id_win_app_container "<WindowsAppContainer>true</WindowsAppContainer>")
+ endif()
get_filename_component(id_src "${src}" NAME)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f1bad99..12ece7b 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -121,6 +121,18 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_VS_WINRT_VERSION)
+ set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ if(CMAKE_GENERATOR MATCHES "Win64")
+ set(CMAKE_SYSTEM_PROCESSOR "AMD64")
+ elseif(CMAKE_GENERATOR MATCHES "ARM")
+ set(CMAKE_SYSTEM_PROCESSOR "ARM")
+ else()
+ set(CMAKE_SYSTEM_PROCESSOR "X86")
+ endif()
+ set(CMAKE_CROSSCOMPILING TRUE)
+ set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..4975cbc 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,12 +10,14 @@
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
+ @id_win_store@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
+ @id_win_app_container@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index e29aaf4..3dd7701 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -45,6 +45,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
else()
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+ if(CMAKE_VS_WINRT_VERSION)
+ set(WINRT 1)
+ endif()
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
@@ -166,7 +169,11 @@ else()
if(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
- set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ if(WINRT)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ endif()
else()
set(_RTC1 "/GZ")
set(_FLAGS_CXX " /GR /GX")
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 1f0c47a..68fff60 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -58,6 +58,28 @@ public:
name, "ARM", NULL);
}
+ if(strcmp(p, " WinRT") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, NULL, NULL);
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+ if(strcmp(p, " Win64 WinRT") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, "x64", NULL);
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+ if(strcmp(p, " ARM WinRT") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, "ARM", NULL);
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+
if(*p++ != ' ')
{
return 0;
@@ -96,6 +118,10 @@ public:
{
names.push_back(std::string(vs11generatorName) + " " + *i);
}
+
+ names.push_back(vs11generatorName + std::string(" WinRT"));
+ names.push_back(vs11generatorName + std::string(" ARM WinRT"));
+ names.push_back(vs11generatorName + std::string(" Win64 WinRT"));
}
};
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 3074794..394c0c2 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -57,6 +57,29 @@ public:
return new cmGlobalVisualStudio12Generator(
name, "ARM", NULL);
}
+
+ if(strcmp(p, " WinRT") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(name, NULL, NULL);
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+ if(strcmp(p, " Win64 WinRT") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(name, "x64", NULL);
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+ if(strcmp(p, " ARM WinRT") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(name, "ARM", NULL);
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+
return 0;
}
@@ -71,6 +94,10 @@ public:
names.push_back(vs12generatorName);
names.push_back(vs12generatorName + std::string(" ARM"));
names.push_back(vs12generatorName + std::string(" Win64"));
+
+ names.push_back(vs12generatorName + std::string(" WinRT"));
+ names.push_back(vs12generatorName + std::string(" ARM WinRT"));
+ names.push_back(vs12generatorName + std::string(" Win64 WinRT"));
}
};
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 12c240b..69ff6a7 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -145,6 +145,12 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
this->WindowsCEVersion.c_str());
}
+
+ if(this->TargetsWinRT())
+ {
+ mf->AddDefinition("CMAKE_VS_WINRT_VERSION",
+ this->WinRTVersion.c_str());
+ }
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 5b952c4..e03567b 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -66,6 +66,10 @@ public:
virtual bool TargetsWindowsCE() const {
return !this->WindowsCEVersion.empty(); }
+ /** Return true if building for WinRT */
+ virtual bool TargetsWinRT() const {
+ return !this->WinRTVersion.empty(); }
+
protected:
virtual const char* GetIDEVersion() { return "8.0"; }
@@ -88,6 +92,7 @@ protected:
std::string Name;
std::string WindowsCEVersion;
+ std::string WinRTVersion;
private:
class Factory;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index eab613d..6d82e2e 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -75,6 +75,9 @@ public:
/** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { return false; }
+ /** Return true if building for WinRT */
+ virtual bool TargetsWinRT() const { return false; }
+
class TargetSet: public std::set<cmTarget const*> {};
struct TargetCompare
{
diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx
index a9ce0cc..439a465 100644
--- a/Source/cmProjectCommand.cxx
+++ b/Source/cmProjectCommand.cxx
@@ -225,9 +225,22 @@ bool cmProjectCommand
if (languages.empty())
{
- // if no language is specified do c and c++
- languages.push_back("C");
- languages.push_back("CXX");
+ std::string flags = this->Makefile->GetDefineFlags();
+ std::transform(flags.begin(), flags.end(), flags.begin(), ::tolower);
+
+ int zwIndex = flags.find("-zw");
+
+ if ((zwIndex != -1)
+ || (strstr(this->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator()->GetName(), " WinRT") != NULL))
+ {
+ languages.push_back("CXX");
+ }
+ else
+ {
+ // if no language is specified do c and c++
+ languages.push_back("C");
+ languages.push_back("CXX");
+ }
}
this->Makefile->EnableLanguage(languages, false);
std::string extraInclude = "CMAKE_PROJECT_" + args[0] + "_INCLUDE";
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ed7e243..1745937 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -298,6 +298,23 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->GlobalGenerator->TargetsWinRT())
+ {
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >= cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
--
1.8.5.2.msysgit.0
0002-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v3.patch [^] (7,190 bytes) 2014-02-05 01:43 [Show Content] [Hide Content]From 0105cabd32b15c20662190e0cae6bec144dbaa3d Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Wed, 5 Feb 2014 12:12:15 +0800
Subject: [PATCH 2/3] CMake: Add support for WinRT platforms and "metro" apps.
1. Recognize AppxManifest file type.
2. A dedicated boolean source file property "VS_WINRT_CONTENT" is added. Generator expressions is also supported here.
3. Add "Deploy.0" in .sln for deploy WinRT apps by default, as WinCE apps do.
4. Add PackageCertificateKeyFile tag to vcxproj for package certification.
---
Source/cmGlobalVisualStudio8Generator.cxx | 2 +-
Source/cmVisualStudio10TargetGenerator.cxx | 103 ++++++++++++++++++++++++++++-
Source/cmVisualStudio10TargetGenerator.h | 1 +
3 files changed, 103 insertions(+), 3 deletions(-)
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 69ff6a7..1ae50a4 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -401,7 +401,7 @@ cmGlobalVisualStudio8Generator
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || this->TargetsWinRT()) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1745937..abce5fb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -342,6 +342,7 @@ void cmVisualStudio10TargetGenerator::Generate()
" Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
+ this->WriteWinRTPackageCertificateKeyFile();
this->WritePathAndIncrementalLinkOptions();
this->WriteItemDefinitionGroups();
this->WriteCustomCommands();
@@ -455,6 +456,35 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
}
}
+void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
+{
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")
+ && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ {
+ std::string pfxFile;
+ std::vector<cmSourceFile*> extraSources;
+ this->GeneratorTarget->GetExtraSources(extraSources);
+ for(std::vector<cmSourceFile*>::const_iterator si = extraSources.begin();
+ si != extraSources.end(); ++si)
+ {
+ if ("pfx" == (*si)->GetExtension())
+ {
+ pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(pfxFile);
+ break;
+ }
+ }
+
+ if (!pfxFile.empty())
+ {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<", 2);
+ (*this->BuildFileStream) << "PackageCertificateKeyFile>" << pfxFile << "</PackageCertificateKeyFile>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
@@ -980,6 +1010,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if(sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -991,8 +1025,68 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
else
{
- (*this->BuildFileStream ) << (end? end : " />\n");
- }
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool additionProp = false;
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ const char* content = sf->GetProperty("VS_WINRT_CONTENT");
+ if (content)
+ {
+ additionProp = true;
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(content);
+ if (0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ }
+ }
+ }
+ }
+
+ if(additionProp)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\"'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|" << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
+ (*this->BuildFileStream ) << (end? end : " />\n");
+ }
+ }
ToolSource toolSource = {sf, forceRelative};
this->Tools[tool].push_back(toolSource);
@@ -1444,6 +1538,11 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX");
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
+ if (this->GlobalGenerator->TargetsWinRT() &&
+ !this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<CompileAsWinRT>false</CompileAsWinRT>\n", 3);
+ }
this->WriteString("</ClCompile>\n", 2);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d1f3d19..b4ef909 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -61,6 +61,7 @@ private:
void WriteDotNetReferences();
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
+ void WriteWinRTPackageCertificateKeyFile();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
--
1.8.5.2.msysgit.0
0003-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v3.patch [^] (3,521 bytes) 2014-02-05 01:44 [Show Content] [Hide Content]From 68901700d9e213e340b695c817fbf56588568d93 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Wed, 5 Feb 2014 14:18:03 +0800
Subject: [PATCH 3/3] CMake: Add support for WinRT platforms and "metro" apps.
Handles UTILITY target type. Use WindowsSDKDesktopARMSupport instead of app container for utilities.
---
Source/cmVisualStudio10TargetGenerator.cxx | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index abce5fb..86544ef 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -298,7 +298,8 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
- if(this->GlobalGenerator->TargetsWinRT())
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (this->Target->GetType() < cmTarget::UTILITY))
{
if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
@@ -458,8 +459,8 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
{
- if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")
- && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (cmTarget::EXECUTABLE == this->Target->GetType()))
{
std::string pfxFile;
std::vector<cmSourceFile*> extraSources;
@@ -467,7 +468,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
for(std::vector<cmSourceFile*>::const_iterator si = extraSources.begin();
si != extraSources.end(); ++si)
{
- if ("pfx" == (*si)->GetExtension())
+ if("pfx" == (*si)->GetExtension())
{
pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
this->ConvertToWindowsSlash(pfxFile);
@@ -475,7 +476,7 @@ void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
}
}
- if (!pfxFile.empty())
+ if(!pfxFile.empty())
{
this->WriteString("<PropertyGroup>\n", 1);
this->WriteString("<", 2);
@@ -564,7 +565,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
this->ClOptions[*i]->UsingUnicode()) ||
- this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ (this->GlobalGenerator->TargetsWinRT() &&
+ (this->Target->GetType() < cmTarget::UTILITY)))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -584,10 +586,18 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
- if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ if(this->GlobalGenerator->TargetsWinRT())
{
- this->WriteString("<WindowsAppContainer>true"
+ if(this->Target->GetType() < cmTarget::UTILITY)
+ {
+ this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<WindowsSDKDesktopARMSupport>true"
+ "</WindowsSDKDesktopARMSupport>\n", 2);
+ }
}
this->WriteString("</PropertyGroup>\n", 1);
--
1.8.5.2.msysgit.0
0001-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v4.patch [^] (10,491 bytes) 2014-02-08 22:15 [Show Content] [Hide Content]From 4de1efcafc330990bfa4cad63c1c6dd51698eba1 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sun, 9 Feb 2014 10:32:07 +0800
Subject: [PATCH 1/3] CMake: Add support for WinRT platforms and "metro" apps.
1. Add WinRT generator to VS11 and VS12.
2. Add CMAKE_VS_WINRT_VERSION definition.
---
Modules/CMakeDetermineCompilerId.cmake | 4 ++++
Modules/CMakeDetermineSystem.cmake | 12 ++++++++++++
Modules/CompilerId/VS-10.vcxproj.in | 2 ++
Modules/Platform/Windows-MSVC.cmake | 9 ++++++++-
Source/cmGlobalVisualStudio11Generator.cxx | 26 ++++++++++++++++++++++++++
Source/cmGlobalVisualStudio12Generator.cxx | 27 +++++++++++++++++++++++++++
Source/cmGlobalVisualStudio8Generator.cxx | 6 ++++++
Source/cmGlobalVisualStudio8Generator.h | 5 +++++
Source/cmGlobalVisualStudioGenerator.h | 3 +++
Source/cmVisualStudio10TargetGenerator.cxx | 18 ++++++++++++++++++
10 files changed, 111 insertions(+), 1 deletion(-)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 067892d..3013f13 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -170,6 +170,10 @@ Id flags: ${testflags}
set(id_subsystem 1)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ if(CMAKE_VS_WINRT_VERSION)
+ set(id_win_store "<ApplicationType>Windows Store</ApplicationType>")
+ set(id_win_app_container "<WindowsAppContainer>true</WindowsAppContainer>")
+ endif()
get_filename_component(id_src "${src}" NAME)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f1bad99..12ece7b 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -121,6 +121,18 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_VS_WINRT_VERSION)
+ set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ if(CMAKE_GENERATOR MATCHES "Win64")
+ set(CMAKE_SYSTEM_PROCESSOR "AMD64")
+ elseif(CMAKE_GENERATOR MATCHES "ARM")
+ set(CMAKE_SYSTEM_PROCESSOR "ARM")
+ else()
+ set(CMAKE_SYSTEM_PROCESSOR "X86")
+ endif()
+ set(CMAKE_CROSSCOMPILING TRUE)
+ set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..4975cbc 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,12 +10,14 @@
<ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
<RootNamespace>CompilerId@id_lang@</RootNamespace>
<Keyword>Win32Proj</Keyword>
+ @id_win_store@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
+ @id_win_app_container@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index e29aaf4..3dd7701 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -45,6 +45,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
else()
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+ if(CMAKE_VS_WINRT_VERSION)
+ set(WINRT 1)
+ endif()
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
@@ -166,7 +169,11 @@ else()
if(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
- set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ if(WINRT)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ endif()
else()
set(_RTC1 "/GZ")
set(_FLAGS_CXX " /GR /GX")
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 1f0c47a..90fd00e 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -58,6 +58,28 @@ public:
name, "ARM", NULL);
}
+ if(strcmp(p, " WinRT-x86") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, NULL, NULL);
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-x64") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, "x64", NULL);
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-ARM") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(name, "ARM", NULL);
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+
if(*p++ != ' ')
{
return 0;
@@ -96,6 +118,10 @@ public:
{
names.push_back(std::string(vs11generatorName) + " " + *i);
}
+
+ names.push_back(vs11generatorName + std::string(" WinRT-x86"));
+ names.push_back(vs11generatorName + std::string(" WinRT-ARM"));
+ names.push_back(vs11generatorName + std::string(" WinRT-x64"));
}
};
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 3074794..8d13428 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -57,6 +57,29 @@ public:
return new cmGlobalVisualStudio12Generator(
name, "ARM", NULL);
}
+
+ if(strcmp(p, " WinRT-x86") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(name, NULL, NULL);
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-x64") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(name, "x64", NULL);
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-ARM") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(name, "ARM", NULL);
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+
return 0;
}
@@ -71,6 +94,10 @@ public:
names.push_back(vs12generatorName);
names.push_back(vs12generatorName + std::string(" ARM"));
names.push_back(vs12generatorName + std::string(" Win64"));
+
+ names.push_back(vs12generatorName + std::string(" WinRT-x86"));
+ names.push_back(vs12generatorName + std::string(" WinRT-ARM"));
+ names.push_back(vs12generatorName + std::string(" WinRT-x64"));
}
};
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 12c240b..69ff6a7 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -145,6 +145,12 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
this->WindowsCEVersion.c_str());
}
+
+ if(this->TargetsWinRT())
+ {
+ mf->AddDefinition("CMAKE_VS_WINRT_VERSION",
+ this->WinRTVersion.c_str());
+ }
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 5b952c4..e03567b 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -66,6 +66,10 @@ public:
virtual bool TargetsWindowsCE() const {
return !this->WindowsCEVersion.empty(); }
+ /** Return true if building for WinRT */
+ virtual bool TargetsWinRT() const {
+ return !this->WinRTVersion.empty(); }
+
protected:
virtual const char* GetIDEVersion() { return "8.0"; }
@@ -88,6 +92,7 @@ protected:
std::string Name;
std::string WindowsCEVersion;
+ std::string WinRTVersion;
private:
class Factory;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 9186d65..8b05e30 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -75,6 +75,9 @@ public:
/** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { return false; }
+ /** Return true if building for WinRT */
+ virtual bool TargetsWinRT() const { return false; }
+
class TargetSet: public std::set<cmTarget const*> {};
struct TargetCompare
{
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ed7e243..f99b58f 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -298,6 +298,24 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->GlobalGenerator->TargetsWinRT())
+ {
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ if (this->LocalGenerator->GetVersion() >=
+ cmLocalVisualStudioGenerator::VS12)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>12.0"
+ "</MinimumVisualStudioVersion>\n", 2);
+ this->WriteString("<ApplicationTypeRevision>8.1"
+ "</ApplicationTypeRevision>\n", 2);
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
--
1.8.5.2.msysgit.0
0002-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v4.patch [^] (7,039 bytes) 2014-02-08 22:15 [Show Content] [Hide Content]From c0e11a2cb18ce0b10e3155c5b54ce9c7ad71e4c8 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sun, 9 Feb 2014 10:55:45 +0800
Subject: [PATCH 2/3] CMake: Add support for WinRT platforms and "metro" apps.
1. Recognize AppxManifest file type.
2. A dedicated boolean source file property "VS_WINRT_CONTENT" is added. Generator expressions is also supported here.
3. Add "Deploy.0" in .sln for deploy WinRT apps by default, as WinCE apps do.
4. Add PackageCertificateKeyFile tag to vcxproj for package certification.
---
Source/cmGlobalVisualStudio8Generator.cxx | 2 +-
Source/cmVisualStudio10TargetGenerator.cxx | 106 +++++++++++++++++++++++++++++
Source/cmVisualStudio10TargetGenerator.h | 1 +
3 files changed, 108 insertions(+), 1 deletion(-)
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 69ff6a7..1ae50a4 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -401,7 +401,7 @@ cmGlobalVisualStudio8Generator
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || this->TargetsWinRT()) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index f99b58f..b00577a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -343,6 +343,7 @@ void cmVisualStudio10TargetGenerator::Generate()
" Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
+ this->WriteWinRTPackageCertificateKeyFile();
this->WritePathAndIncrementalLinkOptions();
this->WriteItemDefinitionGroups();
this->WriteCustomCommands();
@@ -456,6 +457,36 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
}
}
+void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
+{
+ if(this->GlobalGenerator->TargetsWinRT()
+ && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ {
+ std::string pfxFile;
+ std::vector<cmSourceFile*> extraSources;
+ this->GeneratorTarget->GetExtraSources(extraSources);
+ for(std::vector<cmSourceFile*>::const_iterator si = extraSources.begin();
+ si != extraSources.end(); ++si)
+ {
+ if("pfx" == (*si)->GetExtension())
+ {
+ pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(pfxFile);
+ break;
+ }
+ }
+
+ if(!pfxFile.empty())
+ {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<", 2);
+ (*this->BuildFileStream) << "PackageCertificateKeyFile>"
+ << pfxFile << "</PackageCertificateKeyFile>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
@@ -981,6 +1012,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if(sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -992,7 +1027,73 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
else
{
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool additionProp = false;
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ const char* content = sf->GetProperty("VS_WINRT_CONTENT");
+ if (content)
+ {
+ additionProp = true;
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(content);
+ if (0 == strcmp(cge->Evaluate(this->Makefile,
+ (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ }
+ }
+ }
+ }
+
+ if(additionProp)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\""
+ "'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|"
+ << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\""
+ "'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|"
+ << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
(*this->BuildFileStream ) << (end? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
@@ -1445,6 +1546,11 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n", "CXX");
this->WriteString("<ObjectFileName>$(IntDir)</ObjectFileName>\n", 3);
+ if (this->GlobalGenerator->TargetsWinRT() &&
+ !this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<CompileAsWinRT>false</CompileAsWinRT>\n", 3);
+ }
this->WriteString("</ClCompile>\n", 2);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index d1f3d19..b4ef909 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -61,6 +61,7 @@ private:
void WriteDotNetReferences();
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
+ void WriteWinRTPackageCertificateKeyFile();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
--
1.8.5.2.msysgit.0
0003-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v4.patch [^] (2,413 bytes) 2014-02-08 22:16 [Show Content] [Hide Content]From fe9db0374d9518f93d8c0ede9e1ba2076754a9da Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sun, 9 Feb 2014 11:12:06 +0800
Subject: [PATCH 3/3] CMake: Add support for WinRT platforms and "metro" apps.
Handles UTILITY target type. Use WindowsSDKDesktopARMSupport instead of app container for utilities.
---
Source/cmVisualStudio10TargetGenerator.cxx | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b00577a..bd39b51 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -298,7 +298,8 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
- if(this->GlobalGenerator->TargetsWinRT())
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (this->Target->GetType() < cmTarget::UTILITY))
{
if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
@@ -566,7 +567,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
this->ClOptions[*i]->UsingUnicode()) ||
- this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->GlobalGenerator->TargetsWinRT() &&
+ this->Target->GetType() < cmTarget::UTILITY))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -586,10 +589,18 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
- if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ if(this->GlobalGenerator->TargetsWinRT())
{
- this->WriteString("<WindowsAppContainer>true"
+ if(this->Target->GetType() < cmTarget::UTILITY)
+ {
+ this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<WindowsSDKDesktopARMSupport>true"
+ "</WindowsSDKDesktopARMSupport>\n", 2);
+ }
}
this->WriteString("</PropertyGroup>\n", 1);
--
1.8.5.2.msysgit.0
0001-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v5.patch [^] (10,975 bytes) 2014-03-19 21:30 [Show Content] [Hide Content]From 4d3ca162752eafd992fd3bead97f7367e7dbf46d Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sun, 16 Mar 2014 17:40:03 +0800
Subject: [PATCH 1/3] CMake: Add support for WinRT platforms and "metro" apps.
1. Add WinRT generator to VS11 and VS12.
2. Add CMAKE_VS_WINRT_VERSION definition.
---
Modules/CMakeDetermineCompilerId.cmake | 3 +++
Modules/CMakeDetermineSystem.cmake | 12 ++++++++++++
Modules/CompilerId/VS-10.vcxproj.in | 1 +
Modules/Platform/Windows-MSVC.cmake | 9 ++++++++-
Source/cmGlobalVisualStudio10Generator.cxx | 15 +++++++++++++++
Source/cmGlobalVisualStudio11Generator.cxx | 26 ++++++++++++++++++++++++++
Source/cmGlobalVisualStudio12Generator.cxx | 27 +++++++++++++++++++++++++++
Source/cmGlobalVisualStudio8Generator.cxx | 6 ++++++
Source/cmGlobalVisualStudio8Generator.h | 5 +++++
Source/cmGlobalVisualStudioGenerator.h | 3 +++
Source/cmVisualStudio10TargetGenerator.cxx | 22 ++++++++++++++++++++++
11 files changed, 128 insertions(+), 1 deletion(-)
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 067892d..fe43e4d 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -170,6 +170,9 @@ Id flags: ${testflags}
set(id_subsystem 1)
endif()
set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR})
+ if(CMAKE_VS_WINRT_VERSION)
+ set(id_win_sdk_desktop "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>")
+ endif()
get_filename_component(id_src "${src}" NAME)
configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in
${id_dir}/CompilerId${lang}.${ext} @ONLY)
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index f1bad99..b79258d 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -121,6 +121,18 @@ elseif(CMAKE_VS_WINCE_VERSION)
set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
set(CMAKE_CROSSCOMPILING TRUE)
set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_VS_WINRT_VERSION)
+ set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
+ set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
+ if(CMAKE_GENERATOR MATCHES "x64")
+ set(CMAKE_SYSTEM_PROCESSOR "AMD64")
+ elseif(CMAKE_GENERATOR MATCHES "ARM")
+ set(CMAKE_SYSTEM_PROCESSOR "ARM")
+ else()
+ set(CMAKE_SYSTEM_PROCESSOR "X86")
+ endif()
+ set(CMAKE_CROSSCOMPILING TRUE)
+ set(PRESET_CMAKE_SYSTEM_NAME TRUE)
else()
set(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}")
set(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..9f899ab 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -16,6 +16,7 @@
<ConfigurationType>Application</ConfigurationType>
@id_toolset@
<CharacterSet>MultiByte</CharacterSet>
+ @id_win_sdk_desktop@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 5732170..51e5824 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -45,6 +45,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
else()
set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+ if(CMAKE_VS_WINRT_VERSION)
+ set(WINRT 1)
+ endif()
endif()
if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
@@ -166,7 +169,11 @@ else()
if(MSVC_VERSION GREATER 1310)
set(_RTC1 "/RTC1")
set(_FLAGS_CXX " /GR /EHsc")
- set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ if(WINRT)
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "")
+ else()
+ set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
+ endif()
else()
set(_RTC1 "/GZ")
set(_FLAGS_CXX " /GR /GX")
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 840e888..91c0a32 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -119,6 +119,21 @@ bool
cmGlobalVisualStudio10Generator::SetGeneratorToolset(std::string const& ts)
{
this->PlatformToolset = ts;
+ if(this->TargetsWinRT())
+ {
+ if("v110" == this->PlatformToolset)
+ {
+ this->WinRTVersion = "8.0";
+ }
+ else if ("v120" == this->PlatformToolset)
+ {
+ this->WinRTVersion = "8.1";
+ }
+ else
+ {
+ this->WinRTVersion = "";
+ }
+ }
return true;
}
diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx
index 4caa7f2..f3786b9 100644
--- a/Source/cmGlobalVisualStudio11Generator.cxx
+++ b/Source/cmGlobalVisualStudio11Generator.cxx
@@ -59,6 +59,28 @@ public:
genName, "ARM", "");
}
+ if(strcmp(p, " WinRT-x86") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(genName, "", "");
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-x64") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(genName, "x64", "");
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-ARM") == 0)
+ {
+ cmGlobalVisualStudio11Generator* ret =
+ new cmGlobalVisualStudio11Generator(genName, "ARM", "");
+ ret->WinRTVersion = "8.0";
+ return ret;
+ }
+
if(*p++ != ' ')
{
return 0;
@@ -97,6 +119,10 @@ public:
{
names.push_back(std::string(vs11generatorName) + " " + *i);
}
+
+ names.push_back(vs11generatorName + std::string(" WinRT-x86"));
+ names.push_back(vs11generatorName + std::string(" WinRT-ARM"));
+ names.push_back(vs11generatorName + std::string(" WinRT-x64"));
}
};
diff --git a/Source/cmGlobalVisualStudio12Generator.cxx b/Source/cmGlobalVisualStudio12Generator.cxx
index 6cd9f12..dd1c6b4 100644
--- a/Source/cmGlobalVisualStudio12Generator.cxx
+++ b/Source/cmGlobalVisualStudio12Generator.cxx
@@ -58,6 +58,29 @@ public:
return new cmGlobalVisualStudio12Generator(
genName, "ARM", "");
}
+
+ if(strcmp(p, " WinRT-x86") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(genName, "", "");
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-x64") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(genName, "x64", "");
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+ if(strcmp(p, " WinRT-ARM") == 0)
+ {
+ cmGlobalVisualStudio12Generator* ret =
+ new cmGlobalVisualStudio12Generator(genName, "ARM", "");
+ ret->WinRTVersion = "8.1";
+ return ret;
+ }
+
return 0;
}
@@ -72,6 +95,10 @@ public:
names.push_back(vs12generatorName);
names.push_back(vs12generatorName + std::string(" ARM"));
names.push_back(vs12generatorName + std::string(" Win64"));
+
+ names.push_back(vs12generatorName + std::string(" WinRT-x86"));
+ names.push_back(vs12generatorName + std::string(" WinRT-ARM"));
+ names.push_back(vs12generatorName + std::string(" WinRT-x64"));
}
};
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index ab4380c..4fad585 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -147,6 +147,12 @@ void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf)
mf->AddDefinition("CMAKE_VS_WINCE_VERSION",
this->WindowsCEVersion.c_str());
}
+
+ if(this->TargetsWinRT())
+ {
+ mf->AddDefinition("CMAKE_VS_WINRT_VERSION",
+ this->WinRTVersion.c_str());
+ }
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 2459c05..c1e4472 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -67,6 +67,10 @@ public:
virtual bool TargetsWindowsCE() const {
return !this->WindowsCEVersion.empty(); }
+ /** Return true if building for WinRT */
+ virtual bool TargetsWinRT() const {
+ return !this->WinRTVersion.empty(); }
+
protected:
virtual const char* GetIDEVersion() { return "8.0"; }
@@ -90,6 +94,7 @@ protected:
std::string Name;
std::string WindowsCEVersion;
+ std::string WinRTVersion;
private:
class Factory;
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index 7e8dcf8..a5afeb1 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -75,6 +75,9 @@ public:
/** Return true if building for Windows CE */
virtual bool TargetsWindowsCE() const { return false; }
+ /** Return true if building for WinRT */
+ virtual bool TargetsWinRT() const { return false; }
+
class TargetSet: public std::set<cmTarget const*> {};
struct TargetCompare
{
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 7c55f64..a69b80a 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -299,6 +299,28 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
+ if(this->GlobalGenerator->TargetsWinRT())
+ {
+ if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<AppContainerApplication>true"
+ "</AppContainerApplication>\n", 2);
+ }
+ this->WriteString("<ApplicationType>Windows Store"
+ "</ApplicationType>\n", 2);
+ cmLocalVisualStudioGenerator::VSVersion ver =
+ this->LocalGenerator->GetVersion();
+ if (ver >= cmLocalVisualStudioGenerator::VS11)
+ {
+ this->WriteString("<MinimumVisualStudioVersion>", 2);
+ (*this->BuildFileStream) << ver / 10 << ".0"
+ << "</MinimumVisualStudioVersion>\n";
+ this->WriteString("<ApplicationTypeRevision>", 2);
+ (*this->BuildFileStream)
+ << this->Makefile->GetDefinition("CMAKE_VS_WINRT_VERSION")
+ << "</ApplicationTypeRevision>\n";
+ }
+ }
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
--
1.8.5.2.msysgit.0
0002-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v5.patch [^] (6,907 bytes) 2014-03-19 21:30 [Show Content] [Hide Content]From 59d291e4b708d9ddc561c688947b071420982311 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sun, 16 Mar 2014 17:58:04 +0800
Subject: [PATCH 2/3] CMake: Add support for WinRT platforms and "metro" apps.
1. Recognize AppxManifest file type.
2. A dedicated boolean source file property "VS_WINRT_CONTENT" is added. Generator expressions is also supported here.
3. Add "Deploy.0" in .sln for deploy WinRT apps by default, as WinCE apps do.
4. Add PackageCertificateKeyFile tag to vcxproj for package certification.
---
Source/cmGlobalVisualStudio8Generator.cxx | 2 +-
Source/cmVisualStudio10TargetGenerator.cxx | 107 +++++++++++++++++++++++++++++
Source/cmVisualStudio10TargetGenerator.h | 1 +
3 files changed, 109 insertions(+), 1 deletion(-)
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 4fad585..e03faed 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -405,7 +405,7 @@ cmGlobalVisualStudio8Generator
}
bool needsDeploy = (type == cmTarget::EXECUTABLE ||
type == cmTarget::SHARED_LIBRARY);
- if(this->TargetsWindowsCE() && needsDeploy)
+ if((this->TargetsWindowsCE() || this->TargetsWinRT()) && needsDeploy)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->GetPlatformName() << ".Deploy.0 = " << *i << "|"
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index a69b80a..9ec6346 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -348,6 +348,7 @@ void cmVisualStudio10TargetGenerator::Generate()
" Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
+ this->WriteWinRTPackageCertificateKeyFile();
this->WritePathAndIncrementalLinkOptions();
this->WriteItemDefinitionGroups();
this->WriteCustomCommands();
@@ -461,6 +462,36 @@ void cmVisualStudio10TargetGenerator::WriteWinRTReferences()
}
}
+void cmVisualStudio10TargetGenerator::WriteWinRTPackageCertificateKeyFile()
+{
+ if(this->GlobalGenerator->TargetsWinRT()
+ && (cmTarget::EXECUTABLE == this->Target->GetType()))
+ {
+ std::string pfxFile;
+ std::vector<cmSourceFile*> extraSources;
+ this->GeneratorTarget->GetExtraSources(extraSources);
+ for(std::vector<cmSourceFile*>::const_iterator si = extraSources.begin();
+ si != extraSources.end(); ++si)
+ {
+ if("pfx" == (*si)->GetExtension())
+ {
+ pfxFile = this->ConvertPath((*si)->GetFullPath(), false);
+ this->ConvertToWindowsSlash(pfxFile);
+ break;
+ }
+ }
+
+ if(!pfxFile.empty())
+ {
+ this->WriteString("<PropertyGroup>\n", 1);
+ this->WriteString("<", 2);
+ (*this->BuildFileStream) << "PackageCertificateKeyFile>"
+ << pfxFile << "</PackageCertificateKeyFile>\n";
+ this->WriteString("</PropertyGroup>\n", 1);
+ }
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
@@ -987,6 +1018,10 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
this->ConvertToWindowsSlash(sourceFile);
this->WriteString("<", 2);
+ if(sf->GetExtension() == "appxmanifest")
+ {
+ tool = "AppxManifest";
+ }
(*this->BuildFileStream ) << tool << " Include=\"" << sourceFile << "\"";
if(sf->GetExtension() == "h" &&
@@ -998,7 +1033,73 @@ void cmVisualStudio10TargetGenerator::WriteSource(
}
else
{
+ std::vector<bool> deployment;
+ std::vector<bool> excluded;
+ bool additionProp = false;
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (0 == strcmp("None", tool)))
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+ deployment.resize(configs->size(), false);
+ excluded.resize(configs->size(), false);
+ for (size_t i = 0; i != configs->size(); ++i)
+ {
+ const char* content = sf->GetProperty("VS_WINRT_CONTENT");
+ if (content)
+ {
+ additionProp = true;
+
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(content);
+ if (0 == strcmp(cge->Evaluate(this->Makefile,
+ (*configs)[i].c_str()), "1"))
+ {
+ deployment[i] = true;
+ }
+ else
+ {
+ excluded[i] = true;
+ }
+ }
+ }
+ }
+
+ if(additionProp)
+ {
+ std::vector<std::string> *configs =
+ static_cast<cmGlobalVisualStudio7Generator *>
+ (this->GlobalGenerator)->GetConfigurations();
+
+ (*this->BuildFileStream) << ">\n";
+ for (size_t i = 0; i < configs->size(); ++i)
+ {
+ if (deployment[i])
+ {
+ this->WriteString("<DeploymentContent Condition=\""
+ "'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|"
+ << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else if (excluded[i])
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\""
+ "'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|"
+ << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ this->WriteString("</None>\n", 2);
+ }
+ else
+ {
(*this->BuildFileStream ) << (end? end : " />\n");
+ }
}
ToolSource toolSource = {sf, forceRelative};
@@ -1461,6 +1562,12 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
<< "</ProgramDataBaseFileName>\n";
}
+ if (this->GlobalGenerator->TargetsWinRT() &&
+ !this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ {
+ this->WriteString("<CompileAsWinRT>false</CompileAsWinRT>\n", 3);
+ }
+
this->WriteString("</ClCompile>\n", 2);
}
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 02b951c..a42cb0a 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -61,6 +61,7 @@ private:
void WriteDotNetReferences();
void WriteEmbeddedResourceGroup();
void WriteWinRTReferences();
+ void WriteWinRTPackageCertificateKeyFile();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
--
1.8.5.2.msysgit.0
0003-CMake-Add-support-for-WinRT-platforms-and-metro-apps.v5.patch [^] (2,414 bytes) 2014-03-19 21:30 [Show Content] [Hide Content]From 9db9c73f4b53e06a5829a97f6bea31e4c5a74316 Mon Sep 17 00:00:00 2001
From: Minmin Gong <minmin.gong@gmail.com>
Date: Sun, 16 Mar 2014 18:01:02 +0800
Subject: [PATCH 3/3] CMake: Add support for WinRT platforms and "metro" apps.
Handles UTILITY target type. Use WindowsSDKDesktopARMSupport instead of app container for utilities.
---
Source/cmVisualStudio10TargetGenerator.cxx | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 9ec6346..e8f4ccb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -299,7 +299,8 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
- if(this->GlobalGenerator->TargetsWinRT())
+ if(this->GlobalGenerator->TargetsWinRT() &&
+ (this->Target->GetType() < cmTarget::UTILITY))
{
if (this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
{
@@ -571,7 +572,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
this->ClOptions[*i]->UsingUnicode()) ||
- this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS") ||
+ (this->GlobalGenerator->TargetsWinRT() &&
+ this->Target->GetType() < cmTarget::UTILITY))
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
@@ -591,10 +594,18 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
pts += "</PlatformToolset>\n";
this->WriteString(pts.c_str(), 2);
}
- if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
+ if(this->GlobalGenerator->TargetsWinRT())
{
- this->WriteString("<WindowsAppContainer>true"
+ if(this->Target->GetType() < cmTarget::UTILITY)
+ {
+ this->WriteString("<WindowsAppContainer>true"
"</WindowsAppContainer>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<WindowsSDKDesktopARMSupport>true"
+ "</WindowsSDKDesktopARMSupport>\n", 2);
+ }
}
this->WriteString("</PropertyGroup>\n", 1);
--
1.8.5.2.msysgit.0
|