Index: source/lib/precompiled.h =================================================================== --- source/lib/precompiled.h +++ source/lib/precompiled.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2019 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -102,4 +102,10 @@ #include "lib/pch/pch_stdlib.h" +// These two files are included (directly or indirectly) by about half of the .cpp files. +// Changing these thus forces recompilation of most of the project regardless, +// and putting them in the precompiled header cuts a large amount of time even even on incremental builds. +#include "ps/CLogger.h" +#include "ps/Profile.h" + #endif // #if CONFIG_ENABLE_PCH && HAVE_PCH Index: source/pch/atlas/precompiled.h =================================================================== --- source/pch/atlas/precompiled.h +++ source/pch/atlas/precompiled.h @@ -15,13 +15,18 @@ * along with 0 A.D. If not, see . */ +#define MINIMAL_PCH 2 #include "lib/precompiled.h" // common precompiled header // Atlas-specific PCH: #if HAVE_PCH +// These headers are included in over 60% of files. #include "tools/atlas/GameInterface/Messages.h" #include "ps/CStr.h" +#include "ps/Game.h" + +#include #endif // HAVE_PCH Index: source/pch/engine/precompiled.h =================================================================== --- source/pch/engine/precompiled.h +++ source/pch/engine/precompiled.h @@ -23,9 +23,8 @@ #if HAVE_PCH -// some other external libraries that are used in several places: -// .. CStr is included very frequently, so a reasonable amount of time is -// saved by including it here. (~10% in a full rebuild, as of r2365) -#include "ps/CStr.h" +#include "SDL.h" +#include "SDL_thread.h" +#include "SDL_endian.h" #endif // HAVE_PCH Index: source/pch/gui/precompiled.h =================================================================== --- source/pch/gui/precompiled.h +++ source/pch/gui/precompiled.h @@ -15,8 +15,14 @@ * along with 0 A.D. If not, see . */ +#define MINIMAL_PCH 2 #include "lib/precompiled.h" // common precompiled header #if MSC_VERSION # pragma warning(disable:4250) // "inherits 'IGUITextOwner::IGUITextOwner::UpdateCachedSize' via dominance" #endif + +#include "ps/CStr.h" + +#include "gui/GUI.h" +#include "scriptinterface/ScriptInterface.h" Index: source/pch/network/precompiled.h =================================================================== --- source/pch/network/precompiled.h +++ source/pch/network/precompiled.h @@ -15,5 +15,9 @@ * along with 0 A.D. If not, see . */ -#define MINIMAL_PCH 0 +#define MINIMAL_PCH 2 #include "lib/precompiled.h" // common precompiled header + +// These headers are included by almost all compilation units. +#include "ps/CStr.h" +#include "ps/ThreadUtil.h" Index: source/pch/simulation2/precompiled.h =================================================================== --- source/pch/simulation2/precompiled.h +++ source/pch/simulation2/precompiled.h @@ -20,3 +20,10 @@ // Minimal is a bit *too* minimal to let things compile, so include a few more headers #include "lib/debug.h" + +// The simulation has many header files (component interfaces) which are quick to compile on their own +// but bring in a lot of headers indirectly. Adding these to the precompiled header +// cuts down compilation time by about half. +#include "simulation2/system/Component.h" +#include "simulation2/system/Interface.h" +#include "simulation2/system/InterfaceScripted.h" Index: source/pch/test/precompiled.h =================================================================== --- source/pch/test/precompiled.h +++ source/pch/test/precompiled.h @@ -17,7 +17,7 @@ #include "lib/precompiled.h" // common precompiled header -// "test"-specific PCH: +#include "simulation2/system/ComponentTest.h" #if HAVE_PCH