google / google/bigwheels

CMake rules create duplicate implicit targets on Windows

Open
#97 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
107
Forks
42
PR merge metrics
No merged PRs in 30d

Description

There is a problem on how we generate CMake rules for shader targets, specifically on Windows.

We use `MAIN_DEPENDENCY` to specify the input shader file (`.hlsl`) when we create custom commands to compiler shaders with DXC (`add_custom_command`). We use `MAIN_DEPENDENCY` instead of `DEPENDS` because the former allows Visual Studio to avoid trying to compile the HLSL file with its built-in compiler (FXC). However, due to Visual Studio limitations, it is not possible to have multiple `add_custom_command` rules with the same `MAIN_DEPENDENCY` file. We do that when we compile the same shader for multiple stages. This does work in the sense that CMake generation succeeds, but it creates implicit multiple targets that cause Visual Studio to try to compile the same file multiple times in parallel causing sporadic build failures (in case the rules run in parallel).

To reproduce, try generating a VS solution and building a shader target with multiple stages.

I will add more specific information soon.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.