We are looking for a way to speed up our local C++ builds. We have a simple idea in mind. We build our solution regularly on a build server. This build is incremental: when we push new changes, only necessary part of solution is rebuilt. Fast, convenient.
What if we copy all intermediate files produced by VS from the build server to our local machine? Ideally, VS should produce incremental build on top of these intermediate files. Fast, convenient.
The problem is, our build server and local machines use different paths for the solution. This does not play well with incremental builds.
What I tried for a test project: 1. Copy all intermediate files from build server to local machine 2. Update time stamps of all intermediate files to current time 3. Change all paths in all *.tlog files from server-specific to local-specific
And the first impression is good: VS reports that the project is up to date, nothing to build, yey! However, if I change a single file, VS tries to rebuild it reusing a precompiled header that it already has. And I have tons of errors like this:
1>e:\dev\prod3\shared\sdk\src\common\tblockalloc.h(18): error C2995: 'BlockManagerSPtr GetBlockManager(void)': function template has already been defined (compiling source file Requests.cpp)
1>d:\agent-home\xml-data\build-dir\ama-actd-job1\shared\sdk\src\common\tblockalloc.h(15): note: see declaration of 'GetBlockManager' (compiling source file Requests.cpp)
Seems like it is confused that the same symbol appears in headers with different paths.
Ok, I tried to simply replace paths in the PCH file the same way I did for .tlog files. But then even when I don't change any files, VS immediately thinks the project is out of date. Which is surprizing, because I thought it does not look into files themselves, but only observes their timestamps. Anyway, it then spitted off tons of errors like this:
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'StdCall(/Gz)' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'CDecl(/Gd)' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'general PM representation(/vm[smv])' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'support for new floating-point model (/FP)' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'vtordisp(/vd[012])' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'DLL library (/MD)' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4652: compiler option 'Debug static MT library (/MTd)' inconsistent with precompiled header; current command-line option will override that defined in the precompiled header
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4653: compiler option 'Optimizations (one or more of /Oawstgp[y]) or debug checks (one or more of /GZ, /RTCcsu)' inconsistent with precompiled header; current command-line option ignored
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): warning C4653: compiler option 'For loop scope conformance (/Zc:forScope)' inconsistent with precompiled header; current command-line option ignored
1>e:\dev\prod3\shared\app.restserver\src\constants.cpp(1): error C2855: command-line option '/Zc:threadSafeInit' inconsistent with precompiled header
Seems like it does not like when I mess with PCH.
So at this point I am a little stuck. I expected to find some info about how to reuse build artifacts of Visual Studio to achieve easy incremental builds, but I actually found nothing.
Is it even possible? Had anyone tried it?