7

This problem touches too many topics outside of the CMake, C++, Windows world I am familiar with. I kind of hit a wall of way to many options to explore each one. Actually I am hoping for someone posting their workflow which we can adopt. Otherwise answers to these questions that came up while researching would help me to come closer to a solution:

  • If a tool states to support a compiler, does that equal to support debugging with it? Or is MSVC support but without PDB files an exception?
  • Is Cygwin the only way to use some of the Unix-like tools for Windows?
  • Do we fall under the Cygwin licencing if the tools we use to compile our code were build with Cygwin? If we would only internally use that tools not to distribute the software would the licence apply?
  • Would it be feasible use sccache and run the servers for distribution in a VM with Linux on our Windows Systems?
  • What is the progress on the ccache Windows adoption?
  • I ruled out some of the option due to there lack of maintenance, does someone have experience with them? Uses them in production?

Goal

We want to improve the build time of our project. Other steps like dependency reduction or reduced template instantiations and more are known but done/explored by others. I am supposed to setup a compile environment that is as fast as possible. My goal is to cache the compiler results, compile in parallel and distributed. Speeding up the debugging process is more important than building a release. The jobs should be distribution on Windows workstations. If possible, distribution should consider the capacities of each system.

Setup/Limitations

We use CMake 3.16 and if somehow possible we do not want to change that. All workstations run Windows 10 which cannot be changed. We use C++17 with Qt 5.11.3 and QML. Our current development environments are Visual Studio Code using the CMake Ninja generator or Visual Studio Community in the CMake folder mode. In the end both run the MSVC 15 2017 or MSVC 16 2019 compiler. Our software needs to build for Windows as 64 Bit. We are searching for free solution to use in our commercially used software.

Research

Summary

There are great free solutions for Unix-like systems but they do not support Windows. For Windows with CMake there are some free but outdated options for caching. sccache seems to be the only applicable option which might force us to switch the compiler to be able to cache when debugging. There seems to be no free solution for distribution. Also there are fee required options for caching and distribution. FastBuild would be a perfect fit but there is no CMake generator for it.

CMake

On Unix-like systems one can easily setup caching with CMake. code from modern-cmake

    find_program(CCACHE_PROGRAM ccache)
    if(CCACHE_PROGRAM)
        set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
        set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
    endif()

And one needs to set CCACHE_PREFIX=distcc to enable distribution. This would also apply on Windows but ccache is not officially supported on that platform. Same goes for distribution with distcc. Therefore I researched which tools there are and listed the problems with them.

Cache

  • ccache
    • Does not officially support Windows. They state, it could be build with MinGW but give no instructions on how to do that. Also they state that they want to have native Windows support at some point but I find no information about their progress or where to get a current version.
    • There seems to also be a way to build an executable with Cygwin but I do not fully understand the process described in the comments of this Stack Overflow question due to lack of Unix-like knowledge, furthermore I don't know if this would bound our application to the Cygwin licencing. I have not put much afford into these types of solutions as I hope to find a Windows native one.
    • Does only support GCC-like. "Only works with GCC"
    • Does not support debug caching? "...multi-file compilation, linking, etc) will silently fall back..."
  • clcache is no longer maintained. "It's unmaintained, yes"
  • CClash is also no longer maintained. Last changes are form Sep 2017.
  • Stashed uses a remote cache for all system. But it is not free.
  • sccache also uses a shared cache. They list MSVC as supported but I read that people have problems with it. But it does not support debugging with it anyway. "It's effectively impossible to cache PDB files that MSVC outputs"

Distribution

Other

  • FastBuild is an entire build system including caching, distribution and more, supporting all major compilers. Nearly everything I found about it was positive but it has no CMake generator yet.

I first posted this question on Stack Overflow where it was closed as off-topic, I hope this is the right place to ask.

1 Answer 1

3

It doesn't contain distributed builds, but might still help (and seems to work with Cmake): buildcache:

https://github.com/mbitsnbites/buildcache

It also seems to be actively developed but I have never used it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.