Browse Source

VS: Add VS_SHADER_OBJECT_FILE_NAME source file property

Jeremiah van Oosten 7 years ago
parent
commit
8d1ccbc693

+ 1 - 0
Help/manual/cmake-properties.7.rst

@@ -405,6 +405,7 @@ Properties on Source Files
    /prop_sf/VS_SHADER_ENTRYPOINT
    /prop_sf/VS_SHADER_FLAGS
    /prop_sf/VS_SHADER_MODEL
+   /prop_sf/VS_SHADER_OBJECT_FILE_NAME
    /prop_sf/VS_SHADER_OUTPUT_HEADER_FILE
    /prop_sf/VS_SHADER_TYPE
    /prop_sf/VS_SHADER_VARIABLE_NAME

+ 6 - 0
Help/prop_sf/VS_SHADER_OBJECT_FILE_NAME.rst

@@ -0,0 +1,6 @@
+VS_SHADER_OBJECT_FILE_NAME
+--------------------------
+
+Specifies a file name for the compiled shader object file for an ``.hlsl``
+source file.  This adds the ``-Fo`` flag to the command line for the FxCompiler
+tool.

+ 6 - 0
Help/release/dev/vs-hlsl-object-name.rst

@@ -0,0 +1,6 @@
+vs-hlsl-object-name
+-------------------
+
+* HLSL source file property :prop_sf:`VS_SHADER_OBJECT_FILE_NAME` has been
+  added to the :ref:`Visual Studio Generators` for VS 2010 and above.
+  The property specifies the file name of the compiled shader object.

+ 8 - 0
Source/cmVisualStudio10TargetGenerator.cxx

@@ -1590,6 +1590,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
   std::string shaderAdditionalFlags;
   std::string shaderDisableOptimizations;
   std::string shaderEnableDebug;
+  std::string shaderObjectFileName;
   std::string outputHeaderFile;
   std::string variableName;
   std::string settingsGenerator;
@@ -1666,6 +1667,10 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       shaderDisableOptimizations = cmSystemTools::IsOn(sdo) ? "true" : "false";
       toolHasSettings = true;
     }
+    if (const char* sofn = sf->GetProperty("VS_SHADER_OBJECT_FILE_NAME")) {
+      shaderObjectFileName = sofn;
+      toolHasSettings = true;
+    }
   } else if (ext == "jpg" || ext == "png") {
     tool = "Image";
   } else if (ext == "resw") {
@@ -1808,6 +1813,9 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       this->WriteElemEscapeXML("DisableOptimizations",
                                shaderDisableOptimizations, 3);
     }
+    if (!shaderObjectFileName.empty()) {
+      this->WriteElemEscapeXML("ObjectFileOutput", shaderObjectFileName, 3);
+    }
     if (!shaderAdditionalFlags.empty()) {
       this->WriteElemEscapeXML("AdditionalOptions", shaderAdditionalFlags, 3);
     }