Changeset View
Changeset View
Standalone View
Standalone View
source/lib/precompiled.h
/* Copyright (C) 2020 Wildfire Games. | /* Copyright (C) 2021 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
Show All 10 Lines | |||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||||
*/ | */ | ||||
/* | /* | ||||
* precompiled header. must be the first non-comment part of every | * precompiled header. must be the first non-comment part of every | ||||
* source file (VC++ requirement). | * source file (VC++ requirement). | ||||
*/ | */ | ||||
// some libraries have only a small number of source files, and the | /** | ||||
// overhead of including loads of headers here outweighs the improvements to | * PCH_LEVEL defines how many standard headers to include in the PCH. | ||||
// incremental rebuild performance. | * At 0, only the absolutely necessary headers (OS, ...) get included. | ||||
// they can set MINIMAL_PCH to 1 so we include far fewer headers (but | * At 1, some the STL headers get included. | ||||
// still do the global disabling of warnings and include config headers etc), | * At 2, more headers still are included. | ||||
// or set it to 2 to remove STL headers too (precompiling STL helps performance | * Some libraries have only a small number of source files, and the | ||||
// in most non-tiny cases) | * overhead of including loads of headers here outweighs the improvements to | ||||
#ifndef MINIMAL_PCH | * incremental rebuild performance. | ||||
# define MINIMAL_PCH 0 | */ | ||||
#ifndef PCH_LEVEL | |||||
# define PCH_LEVEL 0 | |||||
#endif | #endif | ||||
#include "lib/config.h" // CONFIG_ENABLE_BOOST, CONFIG_ENABLE_PCH | #include "lib/config.h" // CONFIG_ENABLE_BOOST | ||||
#include "lib/sysdep/compiler.h" // MSC_VERSION | #include "lib/sysdep/compiler.h" // MSC_VERSION | ||||
// must come before any STL headers are included | // must come before any STL headers are included | ||||
#if MSC_VERSION | #if MSC_VERSION | ||||
# if MSC_VERSION < 1910 | # if MSC_VERSION < 1910 | ||||
# error "Visual Studio 2017 is the minimal supported version" | # error "Visual Studio 2017 is the minimal supported version" | ||||
# endif | # endif | ||||
# ifdef NDEBUG // release: disable all checks | # ifdef NDEBUG // release: disable all checks | ||||
Show All 38 Lines | |||||
// (must come after boost and common lib headers, but before re-enabling | // (must come after boost and common lib headers, but before re-enabling | ||||
// warnings to avoid boost spew) | // warnings to avoid boost spew) | ||||
#include "lib/posix/posix.h" | #include "lib/posix/posix.h" | ||||
// | // | ||||
// precompiled headers | // precompiled headers | ||||
// | // | ||||
// if PCHs are supported and enabled, we make an effort to include all | |||||
// system headers. otherwise, only a few central headers (e.g. types) | |||||
// are pulled in and source files must include all the system headers | |||||
// they use. this policy ensures good compile performance whether or not | |||||
// PCHs are being used. | |||||
#if CONFIG_ENABLE_PCH | |||||
// anything placed here won't need to be compiled in each translation unit, | // anything placed here won't need to be compiled in each translation unit, | ||||
// but will cause a complete rebuild if they change. | // but will cause a complete rebuild if they change. | ||||
#if PCH_LEVEL > 0 | |||||
#include "lib/pch/pch_stdlib.h" | #include "lib/pch/pch_stdlib.h" | ||||
// These two files are included (directly or indirectly) by about half of the .cpp files. | // 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, | // 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. | // and putting them in the precompiled header cuts a large amount of time even even on incremental builds. | ||||
#include "ps/CLogger.h" | #include "ps/CLogger.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#endif // #if CONFIG_ENABLE_PCH | #endif // PCH_LEVEL > 0 |
Wildfire Games · Phabricator