Hi!
I’ve developed patch for Visual Studio ARM support. (Patch file is attached)

I'd like you to try patch functionality and get a review. 
With regards, Vladimir.
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)
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to