microsoft / D3D12TranslationLayer

A library containing utilities for mapping higher-level graphics work to D3D12
MIT License
327 stars 47 forks source link

Fix for USE_PIX cmake option not working. #63

Closed hanfling closed 2 years ago

hanfling commented 2 years ago

While this option was included in cmake, the required #if USE_PIX [...] #endif were missing inside the C++ code.

This is required for the x86 build, as the pix nuget package appears to be x64 only.

vdwtanner commented 2 years ago

This change shouldn't actually be needed as pix3.h already noops their code when USE_PIX is undefined. I build for x86 pretty frequently and haven't had issues with the pix nuget package being pulled. Are you running into issues with it? I'd rather not have a bunch if #if'd code if it's not needed.

hanfling commented 2 years ago

Oh, I actually missed that pix is doing that inside the header, I just looked at the included libraries in the nuget packages explorer and assumed it wouldn't support x86.

The issue I was running into when trying to build over

cmake -G "NMake Makefiles" .\
nmake

was the missing the pix dependency, and I couldn't get cmake 3.15+ VS_PACKAGE_REFERENCES to work to add the nuget reference. Doing a bit of more research, this doesn't even seem to work for C++ projects, only for other languages. Also now that I think about it, that may even only work for generating visual studio project files, not nmake Makefiles.

I'm not really hung up on using nmake, it was just the first way I came across how to build from the CMakeLists.txt.

Any idea how to add the pix nuget reference automatically? Otherwise I presume using cmake to create vc project files, and manually instally install inside the project would work.

Maybe just having this is as part of detailed build instructions in the Readme.md is enough.

vdwtanner commented 2 years ago

Oh gotcha. The simplest way to get things building right now is to generate a Visual Studio project with cmake (cmake -G "Visual Studio 16 2019") and then when you build inside of visual studio it will automatically pull in the pix nuget package.