]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/base/cef_build.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / base / cef_build.h
1 // Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
30
31 #ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_
32 #define CEF_INCLUDE_BASE_CEF_BUILD_H_
33 #pragma once
34
35 #if defined(BUILDING_CEF_SHARED)
36 // When building CEF include the Chromium header directly.
37 #include "base/compiler_specific.h"
38 #else  // !BUILDING_CEF_SHARED
39 // The following is substantially similar to the Chromium implementation.
40 // If the Chromium implementation diverges the below implementation should be
41 // updated to match.
42
43 #if defined(_WIN32)
44 #ifndef OS_WIN
45 #define OS_WIN 1
46 #endif
47 #elif defined(__APPLE__)
48 #ifndef OS_MACOSX
49 #define OS_MACOSX 1
50 #endif
51 #elif defined(__linux__)
52 #ifndef OS_LINUX
53 #define OS_LINUX 1
54 #endif
55 #else
56 #error Please add support for your platform in cef_build.h
57 #endif
58
59 // For access to standard POSIXish features, use OS_POSIX instead of a
60 // more specific macro.
61 #if defined(OS_MACOSX) || defined(OS_LINUX)
62 #ifndef OS_POSIX
63 #define OS_POSIX 1
64 #endif
65 #endif
66
67 // Compiler detection.
68 #if defined(__GNUC__)
69 #ifndef COMPILER_GCC
70 #define COMPILER_GCC 1
71 #endif
72 #elif defined(_MSC_VER)
73 #ifndef COMPILER_MSVC
74 #define COMPILER_MSVC 1
75 #endif
76 #else
77 #error Please add support for your compiler in cef_build.h
78 #endif
79
80 // Processor architecture detection.  For more info on what's defined, see:
81 //   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
82 //   http://www.agner.org/optimize/calling_conventions.pdf
83 //   or with gcc, run: "echo | gcc -E -dM -"
84 #if defined(_M_X64) || defined(__x86_64__)
85 #define ARCH_CPU_X86_FAMILY 1
86 #define ARCH_CPU_X86_64 1
87 #define ARCH_CPU_64_BITS 1
88 #define ARCH_CPU_LITTLE_ENDIAN 1
89 #elif defined(_M_IX86) || defined(__i386__)
90 #define ARCH_CPU_X86_FAMILY 1
91 #define ARCH_CPU_X86 1
92 #define ARCH_CPU_32_BITS 1
93 #define ARCH_CPU_LITTLE_ENDIAN 1
94 #elif defined(__ARMEL__)
95 #define ARCH_CPU_ARM_FAMILY 1
96 #define ARCH_CPU_ARMEL 1
97 #define ARCH_CPU_32_BITS 1
98 #define ARCH_CPU_LITTLE_ENDIAN 1
99 #elif defined(__aarch64__)
100 #define ARCH_CPU_ARM_FAMILY 1
101 #define ARCH_CPU_ARM64 1
102 #define ARCH_CPU_64_BITS 1
103 #define ARCH_CPU_LITTLE_ENDIAN 1
104 #elif defined(__pnacl__)
105 #define ARCH_CPU_32_BITS 1
106 #define ARCH_CPU_LITTLE_ENDIAN 1
107 #elif defined(__MIPSEL__)
108 #define ARCH_CPU_MIPS_FAMILY 1
109 #define ARCH_CPU_MIPSEL 1
110 #define ARCH_CPU_32_BITS 1
111 #define ARCH_CPU_LITTLE_ENDIAN 1
112 #else
113 #error Please add support for your architecture in cef_build.h
114 #endif
115
116 // Type detection for wchar_t.
117 #if defined(OS_WIN)
118 #define WCHAR_T_IS_UTF16
119 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
120     defined(__WCHAR_MAX__) && \
121     (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
122 #define WCHAR_T_IS_UTF32
123 #elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
124     defined(__WCHAR_MAX__) && \
125     (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
126 // On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
127 // compile in this mode (in particular, Chrome doesn't). This is intended for
128 // other projects using base who manage their own dependencies and make sure
129 // short wchar works for them.
130 #define WCHAR_T_IS_UTF16
131 #else
132 #error Please add support for your compiler in cef_build.h
133 #endif
134
135 // Annotate a virtual method indicating it must be overriding a virtual
136 // method in the parent class.
137 // Use like:
138 //   virtual void foo() OVERRIDE;
139 #ifndef OVERRIDE
140 #if defined(__clang__) || defined(COMPILER_MSVC)
141 #define OVERRIDE override
142 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
143       (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
144 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled.
145 #define OVERRIDE override
146 #else
147 #define OVERRIDE
148 #endif
149 #endif  // OVERRIDE
150
151 // Annotate a function indicating the caller must examine the return value.
152 // Use like:
153 //   int foo() WARN_UNUSED_RESULT;
154 // To explicitly ignore a result, see |ignore_result()| in <base/basictypes.h>.
155 #ifndef WARN_UNUSED_RESULT
156 #if defined(COMPILER_GCC)
157 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
158 #else
159 #define WARN_UNUSED_RESULT
160 #endif
161 #endif  // WARN_UNUSED_RESULT
162
163 // Annotate a typedef or function indicating it's ok if it's not used.
164 // Use like:
165 //   typedef Foo Bar ALLOW_UNUSED_TYPE;
166 #ifndef ALLOW_UNUSED_TYPE
167 #if defined(COMPILER_GCC)
168 #define ALLOW_UNUSED_TYPE __attribute__((unused))
169 #else
170 #define ALLOW_UNUSED_TYPE
171 #endif
172 #endif  // ALLOW_UNUSED_TYPE
173
174 // Annotate a variable indicating it's ok if the variable is not used.
175 // (Typically used to silence a compiler warning when the assignment
176 // is important for some other reason.)
177 // Use like:
178 //   int x = ...;
179 //   ALLOW_UNUSED_LOCAL(x);
180 #ifndef ALLOW_UNUSED_LOCAL
181 #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
182 #endif
183
184 #endif  // !BUILDING_CEF_SHARED
185
186 #endif  // CEF_INCLUDE_BASE_CEF_BUILD_H_