Pyrogenesis  trunk
precompiled.h
Go to the documentation of this file.
1 /* Copyright (c) 2015 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /*
24  * precompiled header. must be the first non-comment part of every
25  * source file (VC++ requirement).
26  */
27 
28 // some libraries have only a small number of source files, and the
29 // overhead of including loads of headers here outweighs the improvements to
30 // incremental rebuild performance.
31 // they can set MINIMAL_PCH to 1 so we include far fewer headers (but
32 // still do the global disabling of warnings and include config headers etc),
33 // or set it to 2 to remove STL headers too (precompiling STL helps performance
34 // in most non-tiny cases)
35 #ifndef MINIMAL_PCH
36 # define MINIMAL_PCH 0
37 #endif
38 
39 #include "lib/config.h" // CONFIG_ENABLE_BOOST, CONFIG_ENABLE_PCH
40 #include "lib/sysdep/compiler.h" // MSC_VERSION, HAVE_PCH
41 
42 // must come before any STL headers are included
43 #if MSC_VERSION
44 # ifdef NDEBUG // release: disable all checks
45 # define _HAS_ITERATOR_DEBUGGING 0
46 # define _SECURE_SCL 0
47 # endif
48 #endif
49 
50 // disable some common and annoying warnings
51 // (as soon as possible so that headers below are covered)
52 #include "lib/pch/pch_warnings.h"
53 
54 #if ICC_VERSION
55 #include <mathimf.h> // (must come before <cmath> or <math.h> (replaces them))
56 double __cdecl abs(double x); // not declared by mathimf
57 #endif
58 
59 
60 //
61 // headers made available everywhere for convenience
62 //
63 
64 #include "lib/posix/posix_types.h" // (must come before any system headers because it fixes off_t)
65 #include "lib/code_annotation.h"
66 #include "lib/sysdep/arch.h"
67 #include "lib/sysdep/os.h"
68 #include "lib/sysdep/stl.h"
69 #include "lib/lib_api.h"
70 #include "lib/types.h"
71 #include "lib/debug.h"
72 #include "lib/lib.h"
73 #include "lib/secure_crt.h"
74 
75 #if CONFIG_ENABLE_BOOST
76 # include "lib/pch/pch_boost.h"
77 #endif
78 
79 #include <array>
80 #include <memory>
81 using std::shared_ptr;
82 
83 // (must come after boost and common lib headers, but before re-enabling
84 // warnings to avoid boost spew)
85 #include "lib/posix/posix.h"
86 
87 
88 //
89 // precompiled headers
90 //
91 
92 // if PCHs are supported and enabled, we make an effort to include all
93 // system headers. otherwise, only a few central headers (e.g. types)
94 // are pulled in and source files must include all the system headers
95 // they use. this policy ensures good compile performance whether or not
96 // PCHs are being used.
97 
98 #if CONFIG_ENABLE_PCH && HAVE_PCH
99 
100 // anything placed here won't need to be compiled in each translation unit,
101 // but will cause a complete rebuild if they change.
102 
103 #include "lib/pch/pch_stdlib.h"
104 
105 #endif // #if CONFIG_ENABLE_PCH && HAVE_PCH