Переглянути джерело

VS: Honor WinCE deployment properties in VS 2010+

Previously only VS 2008 was supported.
Wil Stark 7 роки тому
батько
коміт
5e4887e673

+ 27 - 0
Source/cmVisualStudio10TargetGenerator.cxx

@@ -623,6 +623,7 @@ void cmVisualStudio10TargetGenerator::Generate()
     Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros");
     Elem(e0, "PropertyGroup").Attribute("Label", "UserMacros");
     this->WriteWinRTPackageCertificateKeyFile(e0);
     this->WriteWinRTPackageCertificateKeyFile(e0);
     this->WritePathAndIncrementalLinkOptions(e0);
     this->WritePathAndIncrementalLinkOptions(e0);
+    this->WriteCEDebugProjectConfigurationValues(e0);
     this->WriteItemDefinitionGroups(e0);
     this->WriteItemDefinitionGroups(e0);
     this->WriteCustomCommands(e0);
     this->WriteCustomCommands(e0);
     this->WriteAllSources(e0);
     this->WriteAllSources(e0);
@@ -1071,6 +1072,32 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues(Elem& e0)
   }
   }
 }
 }
 
 
+void cmVisualStudio10TargetGenerator::WriteCEDebugProjectConfigurationValues(
+  Elem& e0)
+{
+  if (!this->GlobalGenerator->TargetsWindowsCE()) {
+    return;
+  }
+  const char* additionalFiles =
+    this->GeneratorTarget->GetProperty("DEPLOYMENT_ADDITIONAL_FILES");
+  const char* remoteDirectory =
+    this->GeneratorTarget->GetProperty("DEPLOYMENT_REMOTE_DIRECTORY");
+  if (!(additionalFiles || remoteDirectory)) {
+    return;
+  }
+  for (std::string const& c : this->Configurations) {
+    Elem e1(e0, "PropertyGroup");
+    e1.Attribute("Condition", this->CalcCondition(c));
+
+    if (remoteDirectory) {
+      e1.Element("RemoteDirectory", remoteDirectory);
+    }
+    if (additionalFiles) {
+      e1.Element("CEAdditionalFiles", additionalFiles);
+    }
+  }
+}
+
 void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
 void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
   Elem& e1, std::string const& config)
   Elem& e1, std::string const& config)
 {
 {

+ 1 - 0
Source/cmVisualStudio10TargetGenerator.h

@@ -57,6 +57,7 @@ private:
   void WriteProjectConfigurations(Elem& e0);
   void WriteProjectConfigurations(Elem& e0);
   void WriteProjectConfigurationValues(Elem& e0);
   void WriteProjectConfigurationValues(Elem& e0);
   void WriteMSToolConfigurationValues(Elem& e1, std::string const& config);
   void WriteMSToolConfigurationValues(Elem& e1, std::string const& config);
+  void WriteCEDebugProjectConfigurationValues(Elem& e0);
   void WriteMSToolConfigurationValuesManaged(Elem& e1,
   void WriteMSToolConfigurationValuesManaged(Elem& e1,
                                              std::string const& config);
                                              std::string const& config);
   void WriteHeaderSource(Elem& e1, cmSourceFile const* sf);
   void WriteHeaderSource(Elem& e1, cmSourceFile const* sf);

+ 0 - 1
Tests/CMakeLists.txt

@@ -178,7 +178,6 @@ if(BUILD_TESTING)
         endif()
         endif()
         # Build a key to be used by get_filename_component that is pointing to the SDK directory
         # Build a key to be used by get_filename_component that is pointing to the SDK directory
         set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]")
         set(_reg "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows CE Tools\\SDKs\\${_sdk}]")
-
         # Set return values
         # Set return values
         set(${selected_reg} ${_reg})
         set(${selected_reg} ${_reg})
         set(${selected_sdk} ${_sdk})
         set(${selected_sdk} ${_sdk})

+ 3 - 0
Tests/RunCMake/CMakeLists.txt

@@ -338,6 +338,9 @@ endif()
 
 
 if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^9]|9[0-9])")
 if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([^9]|9[0-9])")
   add_RunCMake_test(VS10Project)
   add_RunCMake_test(VS10Project)
+  if( vs12 AND wince )
+    add_RunCMake_test( VS10ProjectWinCE "-DRunCMake_GENERATOR_PLATFORM=${wince_sdk}")
+  endif()
 endif()
 endif()
 
 
 if(XCODE_VERSION)
 if(XCODE_VERSION)

+ 3 - 0
Tests/RunCMake/VS10ProjectWinCE/CMakeLists.txt

@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.5.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)

+ 8 - 0
Tests/RunCMake/VS10ProjectWinCE/RunCMakeTest.cmake

@@ -0,0 +1,8 @@
+include(RunCMake)
+
+set(RunCMake_GENERATOR "Visual Studio 12 2013")
+set(RunCMake_GENERATOR_TOOLSET CE800)
+set(RunCMake_GENERATOR_INSTANCE "")
+set(RunCMake_TEST_OPTIONS -DCMAKE_SYSTEM_NAME=WindowsCE  )
+
+run_cmake(VsCEDebuggerDeploy)

+ 34 - 0
Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy-check.cmake

@@ -0,0 +1,34 @@
+set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj")
+if(NOT EXISTS "${vcProjectFile}")
+  set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.")
+  return()
+endif()
+
+
+if( NOT ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsCE" )
+  set(RunCMake_TEST_FAILED "Test only valid for WindowsCE")
+  return()
+endif()
+
+
+set(FoundCEAdditionalFiles FALSE)
+set(FoundRemoteDirectory FALSE)
+
+file(STRINGS "${vcProjectFile}" lines)
+foreach(line IN LISTS lines)
+  if(line MATCHES "^ *<CEAdditionalFiles> *foo\\.dll\\|\\\\foo\\\\src\\\\dir\\\\on\\\\host\\|\\$\\(RemoteDirectory\\)\\|0;bar\\.dll\\|\\\\bar\\\\src\\\\dir\\|\\$\\(RemoteDirectory\\)bardir\\|0.*</CEAdditionalFiles> *$")
+    set(FoundCEAdditionalFiles TRUE)
+  elseif(line MATCHES " *<RemoteDirectory>[A-Za-z0-9\\]+</RemoteDirectory> *$")
+    set(FoundRemoteDirectory TRUE)
+  endif()
+endforeach()
+
+if(NOT FoundCEAdditionalFiles)
+  set(RunCMake_TEST_FAILED "CEAddionalFiles not found or not set correctly.")
+  return()
+endif()
+
+if(NOT FoundRemoteDirectory)
+  set(RunCMake_TEST_FAILED "RemoteDirectory not found or not set correctly.")
+  return()
+endif()

+ 13 - 0
Tests/RunCMake/VS10ProjectWinCE/VsCEDebuggerDeploy.cmake

@@ -0,0 +1,13 @@
+enable_language(CXX)
+
+set(DEPLOY_DIR
+   "temp\\foodir"
+)
+
+add_library(foo foo.cpp)
+
+set_target_properties(foo
+ PROPERTIES
+  DEPLOYMENT_ADDITIONAL_FILES "foo.dll|\\foo\\src\\dir\\on\\host|$(RemoteDirectory)|0;bar.dll|\\bar\\src\\dir|$(RemoteDirectory)bardir|0"
+  DEPLOYMENT_REMOTE_DIRECTORY ${DEPLOY_DIR}
+)

+ 3 - 0
Tests/RunCMake/VS10ProjectWinCE/foo.cpp

@@ -0,0 +1,3 @@
+void foo()
+{
+}

+ 3 - 0
Tests/RunCMake/VS10ProjectWinCE/foo.cs

@@ -0,0 +1,3 @@
+void foo()
+{
+}