1
0
forked from 0ad/0ad

Precompiled logic update [Windows build]

Nuke HAVE_PCH and use only one macro for PCH logic.
This macro is enabled (=1) or disabled (=0) based on --without-pch and
no_pch parameters in premake5
Visual studio does not more override this logic

Differential Revision: https://code.wildfiregames.com/D1380
Reviewed by: @Itms
This was SVN commit r23314.
This commit is contained in:
Angen 2019-12-31 13:58:48 +00:00
parent 1f65e3df66
commit 5ad75fa580
9 changed files with 18 additions and 28 deletions

View File

@ -456,9 +456,10 @@ function project_add_contents(source_root, rel_source_dirs, rel_include_dirs, ex
pchheader(pch_dir.."precompiled.h")
filter {}
pchsource(pch_dir.."precompiled.cpp")
defines { "USING_PCH" }
defines { "CONFIG_ENABLE_PCH=1" }
files { pch_dir.."precompiled.h", pch_dir.."precompiled.cpp" }
else
defines { "CONFIG_ENABLE_PCH=0" }
flags { "NoPCH" }
end

View File

@ -37,7 +37,7 @@
#endif
#include "lib/config.h" // CONFIG_ENABLE_BOOST, CONFIG_ENABLE_PCH
#include "lib/sysdep/compiler.h" // MSC_VERSION, HAVE_PCH
#include "lib/sysdep/compiler.h" // MSC_VERSION
// must come before any STL headers are included
#if MSC_VERSION
@ -95,7 +95,7 @@ using std::shared_ptr;
// they use. this policy ensures good compile performance whether or not
// PCHs are being used.
#if CONFIG_ENABLE_PCH && HAVE_PCH
#if CONFIG_ENABLE_PCH
// anything placed here won't need to be compiled in each translation unit,
// but will cause a complete rebuild if they change.
@ -108,4 +108,4 @@ using std::shared_ptr;
#include "ps/CLogger.h"
#include "ps/Profile.h"
#endif // #if CONFIG_ENABLE_PCH && HAVE_PCH
#endif // #if CONFIG_ENABLE_PCH

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2017 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
@ -72,17 +72,6 @@
# define __has_cpp_attribute(x) 0
#endif
// are PreCompiled Headers supported?
#if MSC_VERSION
# define HAVE_PCH 1
#elif defined(USING_PCH)
# define HAVE_PCH 1
#else
# define HAVE_PCH 0
#endif
// check if compiling in pure C mode (not C++) with support for C99.
// (this is more convenient than testing __STDC_VERSION__ directly)
//

View File

@ -20,7 +20,7 @@
// Atlas-specific PCH:
#if HAVE_PCH
#if CONFIG_ENABLE_PCH
// These headers are included in over 60% of files.
#include "tools/atlas/GameInterface/Messages.h"
@ -29,4 +29,4 @@
#include <unordered_map>
#endif // HAVE_PCH
#endif // CONFIG_ENABLE_PCH

View File

@ -21,9 +21,9 @@
#include "ps/Pyrogenesis.h" // old error system
#if HAVE_PCH
#if CONFIG_ENABLE_PCH
#include "SDL.h"
#include "SDL_endian.h"
#endif // HAVE_PCH
#endif // CONFIG_ENABLE_PCH

View File

@ -22,11 +22,11 @@
# pragma warning(disable:4250) // "inherits 'IGUITextOwner::IGUITextOwner::UpdateCachedSize' via dominance"
#endif
#if HAVE_PCH
#if CONFIG_ENABLE_PCH
#include "gui/CGUI.h"
#include "gui/ObjectBases/IGUIObject.h"
#include "ps/CStr.h"
#include "scriptinterface/ScriptInterface.h"
#endif // HAVE_PCH
#endif // CONFIG_ENABLE_PCH

View File

@ -18,10 +18,10 @@
#define MINIMAL_PCH 2
#include "lib/precompiled.h" // common precompiled header
#if HAVE_PCH
#if CONFIG_ENABLE_PCH
// These headers are included by almost all compilation units.
#include "ps/CStr.h"
#include "ps/ThreadUtil.h"
#endif // HAVE_PCH
#endif // CONFIG_ENABLE_PCH

View File

@ -21,7 +21,7 @@
// Minimal is a bit *too* minimal to let things compile, so include a few more headers
#include "lib/debug.h"
#if HAVE_PCH
#if CONFIG_ENABLE_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
@ -30,4 +30,4 @@
#include "simulation2/system/Interface.h"
#include "simulation2/system/InterfaceScripted.h"
#endif // HAVE_PCH
#endif // CONFIG_ENABLE_PCH

View File

@ -17,7 +17,7 @@
#include "lib/precompiled.h" // common precompiled header
#if HAVE_PCH
#if CONFIG_ENABLE_PCH
#include "simulation2/system/ComponentTest.h"
#include "lib/self_test.h"
@ -26,4 +26,4 @@
#include <cxxtest/TestRunner.h>
#include <cxxtest/RealDescriptions.h>
#endif // HAVE_PCH
#endif // CONFIG_ENABLE_PCH