Update precompiled headers to improve build times.

Expect a 10-25% build time improvement.

Original Patch By: Angen
Reviewed By: Angen
References #5038

Differential Revision: https://code.wildfiregames.com/D1333
This was SVN commit r22303.
This commit is contained in:
wraitii
2019-05-26 07:21:12 +00:00
parent 9ea68317ad
commit 65fcd66556
8 changed files with 57 additions and 15 deletions
+7 -1
View File
@@ -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 @@ using std::shared_ptr;
#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
+6 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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 <boost/unordered_map.hpp>
#endif // HAVE_PCH
+4 -5
View File
@@ -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
+10 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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
+10 -2
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#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
+12 -1
View File
@@ -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
+2 -3
View File
@@ -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 <cxxtest/TestListener.h>
#include <cxxtest/TestTracker.h>
+6 -1
View File
@@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_COMPONENTTEST
#define INCLUDED_COMPONENTTEST
#include "lib/self_test.h"
#include "maths/Matrix3D.h"
@@ -244,3 +247,5 @@ public:
{
}
};
#endif // INCLUDED_COMPONENTTEST