Browse Source

Windows: Allow manifest files to be bundled as content

Aron Yu 3 years ago
parent
commit
feebc8394f

+ 5 - 1
Source/cmGeneratorTarget.cxx

@@ -2047,7 +2047,11 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
     } else if (ext == "appxmanifest") {
       kind = SourceKindAppManifest;
     } else if (ext == "manifest") {
-      kind = SourceKindManifest;
+      if (sf->GetPropertyAsBool("VS_DEPLOYMENT_CONTENT")) {
+        kind = SourceKindExtra;
+      } else {
+        kind = SourceKindManifest;
+      }
     } else if (ext == "pfx") {
       kind = SourceKindCertificate;
     } else if (ext == "xaml") {

+ 3 - 1
Tests/VSWinStorePhone/CMakeLists.txt

@@ -63,7 +63,8 @@ set(VERTEXSHADER_FILES
   Direct3DApp1/SimpleVertexShader.hlsl
   )
 
-set(CONTENT_FILES ${PIXELSHADER_FILES} ${VERTEXSHADER_FILES})
+  set(COPY_TO_OUTPUT_FILES Direct3DApp1/Simple.manifest)
+  set(CONTENT_FILES ${PIXELSHADER_FILES} ${VERTEXSHADER_FILES} ${COPY_TO_OUTPUT_FILES})
 
 if (WINDOWS_PHONE8)
   set(CONTENT_FILES ${CONTENT_FILES}
@@ -108,6 +109,7 @@ set(RESOURCE_FILES
   ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${ASSET_FILES} ${STRING_FILES}
   Direct3DApp1/Direct3DApp1_TemporaryKey.pfx)
 
+set_property(SOURCE ${COPY_TO_OUTPUT_FILES} PROPERTY VS_COPY_TO_OUT_DIR "PreserveNewest")
 set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
 set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
 set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets")

+ 7 - 0
Tests/VSWinStorePhone/Direct3DApp1/CubeRenderer.cpp

@@ -17,6 +17,13 @@ CubeRenderer::CubeRenderer()
   // Create a new WinRT object to validate that we can link properly
   Batman ^ hero = ref new Batman();
   hero->savePeople();
+
+  // Test that .manifest files can be bundled with app
+  DX::ReadDataAsync("Direct3DApp1\\Simple.manifest")
+    .then([this](Platform::Array<byte> ^ fileData) {
+      std::string manifestContent(fileData->begin(), fileData->end());
+      assert(manifestContent.find("hello") == 0);
+    });
 }
 
 void CubeRenderer::CreateDeviceResources()

+ 1 - 0
Tests/VSWinStorePhone/Direct3DApp1/Simple.manifest

@@ -0,0 +1 @@
+hello