turanszkij / WickedEngine

3D engine with modern graphics
https://wickedengine.net
Other
5.85k stars 618 forks source link

use ccache on linux builds #889

Closed brakhane closed 4 months ago

brakhane commented 4 months ago

While debugging the failing linux build on my cmake pull request, the long build time for linux became annoying.

This PR changes the linux build targets on linux to cache the results using ccache and github's cache action; the effects are significant, in my tests, the build time went from 25m to 9m for the very first build (because the rebuild after compiling shaders can already use it) and just over 3m for a small change that didn't affect many files.

ccache also exists in a windows version for MSVC, but it's not officially supported, so I skipped it for the windows build for now, but I'm open to experiment with it if there's interest.

Another optimization could be cache of the compiled shaders, but I'm not 100% sure what actually can change the output apart from the shader files themselves, offlineshadercompiler.cpp and dxcompiler/dxil, so I didn't add it for now. It's certainly doable, if there's interest, though.

For context: ccache is a mature compiler cache that guarantees the results for any given command line and contents of source files will be the same as if the compiler was called directly. I've been using it in the past for various projects as well as for my local wicked builds on my laptop without any problems.