If the following two lines are also added to this execute_process() call, sccache can also be used when building juceaide which can massively reduce the CMake configure time.
Yeah I noticed that GCC was painfully slow - and then tried to use it to compile a VST3 project and it simply wasn’t having it. Spent a long time trying to set up MSVC with Ninja, but after looking at your fork switched to using this GHA to enable Clang on Windows and it works really well!
Something that stood out to me about your fork though is that in the “Post Run sccache-cache” step, it seems to imply that the caching failed:
So I’ve a feeling the 30s difference you saw between the first and second run was just a fluke! Possibly there’s some other local caching of the CMake config happening somewhere?
Hey @ImJimmi, did you ever get to the bottom of those -Xclang errors with sccache? I’m facing a similar issue on my end and haven’t been able to find a solution. I’ve seen mention of similar problems in the sccache GH issues but the issues were all marked as resolved.
We have revisited sccache recently but this time are just sticking with MSVC on Windows and using the Ninja Multi-Config generator - I believe all that’s needed to get it working is to enable the Visual Studio dev environment (vcvars.bat).
Unfortunately, I can’t apply this from the juceaide invoked build from my main CMakeLists.txt, so the /Zi flag is still set.
I will experiment with modifying juceaide directly to confirm it resolves the issue.
In general, it would be nice to be able to be able to generically pass through some cmake options to the invoked juiceaide build, similar to PASSTHROUGH_ARGS but arbitrary, giving us a bit more flexibility/control over that process.
Yeah I’ve just been struggling with this and worked around it for now by reverting from Ninja to MSVC. Would be great if we could get some speedier builds back again!
BTW thanks for your blog and pamplejuce examples Sudara, I have been leaning heavily on those!
@andrewj Ah, awesome, good point! I should have mentioned I worked around the issue in another project by removing Ninja as well… Figured I’d try and solve the issue in pamplejuce now…
Unfortunately, modifying juceaide’s CMakeLists.txt to include this didn’t work:
That’s concerning- we’ve just spent about 3 months revamping our CI including moving to Ninja on Windows! We were hoping to move to JUCE 8 as the next step, but looks like that might not be possible now
@ImJimmi — Well, someone should probably double check my work, it’s entirely possible I’ve missed something. I didn’t do extensive flag debugging (yet?).
Also of note: the reason /Z7 should work in the first place is that it embeds debug symbols in the obj files themselves, not a pdb. That might not be a desirable consequence, even if the fix works.
It turns out that it’s not juceaide’s CMakeLists.txt setting the compile options, but instead JUCEHelperTargets.cmake.
It sets /Zi, which instructs the creation of a separate pdb file, which makes it cache-unfriendly when building in parallel, as multiple build processes are trying to write to it.
Removing /Zi got me building nice and cached again!
Note, this changes the behavior to not producing a .pdb. I’m not sure if this matters for plugins, since we are middleware and mostly not getting crash dumps and therefore have no ability to hydrate with debug symbols… However, it does put whatever debug symbols exist into the obj files, and therefore the binary. So I’m not quite sure yet if that means it’s going to bloat the juce modules in size with debug symbols, I have to do more testing.
Side question I ended up having: Would it be faster if juceaide was built as Release when building the main project in Release? Right now its always built in Debug. Caveat: I have 0 idea about all the mechanics involved, I’m guessing it’s not considered relevant as the actual modules are built in Release?..
/Zi is being set only as an option in Debug, as part of juce_recommended_config_flags — so one could always just not link against that target to get around it — except in this case, we don’t have control over what juceaide links to.
One way of framing: caching my Release build in CI/Windows is choking on Debug flags.
(That made me check into juceaide build times out of curiosity. And yes, building juceaide in Release takes 2x as long, as expected.)
My earlier mention of obj files and binary size is probably not relevant? The juce module files juceaide builds in Debug are used to prep things like binary data and AU preprocessor stuff — the actual juce headers built into my plugin binary are built in Release, where that flag doesn’t exist anyway.
On my own projects, I’ll just remove the /Zi flag from juce_recommended_config_flags on a fork.
I’m not quite sure what I’ll do about Pamplejuce. I don’t want to run it off a JUCE fork. And sccache doesn’t seem happy on plain MSVC without Ninja…
You don’t need to fork JUCE to create your own version of juce_recommended_config_flags. You can just create your own interface target for configs and copy-paste whatever settings you want or don’t want from the JUCE one, it’s just a few lines.
Yes, that would be great if I needed to set flags for my own build. Unfortunately, the issue is juceaide’s own cmake build, which links against juce_recommended_config_flags, setting /Zi in Debug (unhappy in in the msvc/ninja/ccache context).
Although hmm, maybe I could actually redefine the options set by the juce_recommended_config_flags target itself…
EDIT: no, this doesn’t work because juceaide spins up its own configure/build process.