Skip to content

Claude authored PCH & Unity Builds#6381

Open
garrettjoecox wants to merge 1 commit intoHarbourMasters:developfrom
garrettjoecox:pch-unit
Open

Claude authored PCH & Unity Builds#6381
garrettjoecox wants to merge 1 commit intoHarbourMasters:developfrom
garrettjoecox:pch-unit

Conversation

@garrettjoecox
Copy link
Contributor

@garrettjoecox garrettjoecox commented Mar 21, 2026

Take or leave it, not really something I put effort into and I don't fully understand the downsides of PCH or Unity builds, but it's something that has gone smoothly on 2ship for a while now.

Completely fresh build on my macbook m4

develop: 240s
pch-unit: 79s

Build Artifacts

@serprex
Copy link
Member

serprex commented Mar 21, 2026

Build improvements always welcome

HarbourMasters/2ship2harkinian#1358 is all I can find looking up pch on 2ship, & not seeing similar pattern in CMakeLists.txt. Is there a different PR to use for comparison?

@louist103
Copy link
Contributor

I think it would be more worth it to fix the header bloat problem first. Using something like https://include-what-you-use.org

@garrettjoecox
Copy link
Contributor Author

Build improvements always welcome

HarbourMasters/2ship2harkinian#1358 is all I can find looking up pch on 2ship, & not seeing similar pattern in CMakeLists.txt. Is there a different PR to use for comparison?

That's the one, though I realize that was just PCH not unity builds, going to be trying unity builds on 2ship now

@serprex
Copy link
Member

serprex commented Mar 21, 2026

I'd prefer to start with just PCH, unity builds seem to have some drawbacks I'm hesitant towards, & think louist's suggestion to clean up header usage first is something I can look into

@serprex serprex requested review from Malkierian and serprex March 21, 2026 18:48
@Pepe20129
Copy link
Contributor

There's also the idea to use C++ 20 modules when possible, that'd require a lot more work but it's worth keeping in mind.

@louist103
Copy link
Contributor

There's also the idea to use C++ 20 modules when possible, that'd require a lot more work but it's worth keeping in mind.

That is an option but they break edit and continue and I don't think they are fully supported by all platforms yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants