microsoft / microsoft/D3D12TranslationLayer

Circular dependency in include files

Open
#15 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #28 by @xaphier — closed without merging
bug
Dominant language
C++
Stars
357
Forks
56
Avg merge
5d 6h
Merged PRs (30d)
4

Description

I'm trying to compile the library using CMake and Ninja instead of the Visual Studio generators. I was aware that IntelliSense is smarter when used in tandem with MSBuild, as it picks up global information of the build and doesn't operate solely based on translation units. When building with Ninja, after realizing that PCH isn't a build acceleration method but is actually a hard requirement of the build, I added target_precompiled_header invocation and realized that the project still doesn't build. I started adding #includes directives to the headers to please the compiler, but ultimately engaged in cyclic include directives. A lot of headers arrive to including DeviceChild.hpp which in turn requires ImmediateContext.hpp which in turn requires Resource.hpp which then requires DeviceChild.hpp again. Removing any of these includes results in undefined types when compiling the very same pch.hpp the build otherwise relies on.

Can anyone comment on how to untie this knot?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Ninja build and inspect the include chain among DeviceChild.hpp, ImmediateContext.hpp, Resource.hpp, and pch.hpp. Check the existing CMake target_precompiled_header setup and the closed pull request for prior context. Done means the project builds with CMake and Ninja without cyclic includes or undefined types.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.