Index: ps/trunk/source/lib/precompiled.h
===================================================================
--- ps/trunk/source/lib/precompiled.h
+++ ps/trunk/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: ps/trunk/source/pch/atlas/precompiled.h
===================================================================
--- ps/trunk/source/pch/atlas/precompiled.h
+++ ps/trunk/source/pch/atlas/precompiled.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -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: ps/trunk/source/pch/engine/precompiled.h
===================================================================
--- ps/trunk/source/pch/engine/precompiled.h
+++ ps/trunk/source/pch/engine/precompiled.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -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: ps/trunk/source/pch/gui/precompiled.h
===================================================================
--- ps/trunk/source/pch/gui/precompiled.h
+++ ps/trunk/source/pch/gui/precompiled.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -15,8 +15,17 @@
* 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
+
+#if HAVE_PCH
+
+#include "ps/CStr.h"
+#include "gui/GUI.h"
+#include "scriptinterface/ScriptInterface.h"
+
+#endif // HAVE_PCH
Index: ps/trunk/source/pch/network/precompiled.h
===================================================================
--- ps/trunk/source/pch/network/precompiled.h
+++ ps/trunk/source/pch/network/precompiled.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -15,5 +15,13 @@
* along with 0 A.D. If not, see .
*/
-#define MINIMAL_PCH 0
+#define MINIMAL_PCH 2
#include "lib/precompiled.h" // common precompiled header
+
+#if HAVE_PCH
+
+// These headers are included by almost all compilation units.
+#include "ps/CStr.h"
+#include "ps/ThreadUtil.h"
+
+#endif // HAVE_PCH
Index: ps/trunk/source/pch/simulation2/precompiled.h
===================================================================
--- ps/trunk/source/pch/simulation2/precompiled.h
+++ ps/trunk/source/pch/simulation2/precompiled.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -20,3 +20,14 @@
// Minimal is a bit *too* minimal to let things compile, so include a few more headers
#include "lib/debug.h"
+
+#if HAVE_PCH
+
+// 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"
+
+#endif // HAVE_PCH
Index: ps/trunk/source/pch/test/precompiled.h
===================================================================
--- ps/trunk/source/pch/test/precompiled.h
+++ ps/trunk/source/pch/test/precompiled.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -17,10 +17,9 @@
#include "lib/precompiled.h" // common precompiled header
-// "test"-specific PCH:
-
#if HAVE_PCH
+#include "simulation2/system/ComponentTest.h"
#include "lib/self_test.h"
#include
#include
Index: ps/trunk/source/simulation2/system/ComponentTest.h
===================================================================
--- ps/trunk/source/simulation2/system/ComponentTest.h
+++ ps/trunk/source/simulation2/system/ComponentTest.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2017 Wildfire Games.
+/* Copyright (C) 2019 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -15,6 +15,9 @@
* along with 0 A.D. If not, see .
*/
+#ifndef INCLUDED_COMPONENTTEST
+#define INCLUDED_COMPONENTTEST
+
#include "lib/self_test.h"
#include "maths/Matrix3D.h"
@@ -244,3 +247,5 @@
{
}
};
+
+#endif // INCLUDED_COMPONENTTEST