MantisBT - CMake
View Issue Details
0014349CMakeCMakepublic2013-08-11 01:592015-06-01 08:38
Chad Vernon 
 
normalminoralways
closedfixed 
WindowsWindows 8
CMake 2.8.11.2 
CMake 3.1 
0014349: Add hlsl compiler support to Visual Studio 2012
Adding *.hlsl files to a Visual Studio 2012 project should activate the HLSL compiler for those files. We should also be able to specify the Shader Type of each hlsl file.

Currently, the hlsl files are added like the following in the project:

<ItemGroup>
  <None Include="..\shaders\simplePS.hlsl" />
  <None Include="..\shaders\simpleVS.hlsl" />
</ItemGroup>

They need to be added like so:

<ItemGroup>
  <FxCompile Include="..\shaders\simplePS.hlsl" />
  <FxCompile Include="..\shaders\simpleVS.hlsl" />
</ItemGroup>

And ideally, we could specify the type of shader from the following choices:
Effect, Vertex, Pixel, Geometry, Hull, Domain, Compute, Texture.
This would create the following:

<FxCompile Include="..\shaders\simplePS.hlsl">
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">Pixel</ShaderType>
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">Pixel</ShaderType>
</FxCompile>
<FxCompile Include="..\shaders\simpleVS.hlsl">
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">Vertex</ShaderType>
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
  <ShaderType Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|x64'">Vertex</ShaderType>
</FxCompile>
Just create a Win32 executable project with Visual Studio 2012 and add an test.hlsl file to it.
No tags attached.
Issue History
2013-08-11 01:59Chad VernonNew Issue
2013-08-13 09:34Brad KingNote Added: 0033704
2013-08-13 09:34Brad KingStatusnew => backlog
2015-01-18 19:34Chad VernonNote Added: 0037732
2015-01-19 07:41Brad KingNote Added: 0037733
2015-01-19 07:41Brad KingStatusbacklog => resolved
2015-01-19 07:41Brad KingResolutionopen => fixed
2015-01-19 07:41Brad KingFixed in Version => CMake 3.1
2015-06-01 08:38Robert MaynardNote Added: 0038846
2015-06-01 08:38Robert MaynardStatusresolved => closed

Notes
(0033704)
Brad King   
2013-08-13 09:34   
As of commit b26f0e03 in master, take a look at cmVisualStudio10TargetGenerator::WriteAllSources for where the tool is selected for each file type:

http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmVisualStudio10TargetGenerator.cxx;hb=b26f0e03#l979 [^]
(0037732)
Chad Vernon   
2015-01-18 19:34   
CMake 3.1 seems to resolve this with the source file properties:

VS_SHADER_ENTRYPOINT
VS_SHADER_MODEL
VS_SHADER_TYPE
(0037733)
Brad King   
2015-01-19 07:41   
Re 0014349:0037732: Indeed, thanks.
(0038846)
Robert Maynard   
2015-06-01 08:38   
Closing resolved issues that have not been updated in more than 4 months.