Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
build_config.h
Go to the documentation of this file.
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This file adds defines about the platform we're currently building on.
6//
7// Operating System:
8// OS_AIX / OS_ANDROID / OS_ASMJS / OS_FREEBSD / OS_FUCHSIA / OS_IOS /
9// OS_LINUX / OS_MAC / OS_NACL (SFI or NONSFI) / OS_NETBSD / OS_OPENBSD /
10// OS_QNX / OS_SOLARIS / OS_WIN
11// Operating System family:
12// OS_APPLE: IOS or MAC
13// OS_BSD: FREEBSD or NETBSD or OPENBSD
14// OS_POSIX: AIX or ANDROID or ASMJS or CHROMEOS or FREEBSD or IOS or LINUX
15// or MAC or NACL or NETBSD or OPENBSD or QNX or SOLARIS
16//
17// /!\ Note: OS_CHROMEOS is set by the build system, not this file
18//
19// Compiler:
20// COMPILER_MSVC / COMPILER_GCC
21//
22// Processor:
23// ARCH_CPU_ARM64 / ARCH_CPU_ARMEL / ARCH_CPU_MIPS / ARCH_CPU_MIPS64 /
24// ARCH_CPU_MIPS64EL / ARCH_CPU_MIPSEL / ARCH_CPU_PPC64 / ARCH_CPU_S390 /
25// ARCH_CPU_S390X / ARCH_CPU_X86 / ARCH_CPU_X86_64
26// Processor family:
27// ARCH_CPU_ARM_FAMILY: ARMEL or ARM64
28// ARCH_CPU_MIPS_FAMILY: MIPS64EL or MIPSEL or MIPS64 or MIPS
29// ARCH_CPU_PPC64_FAMILY: PPC64
30// ARCH_CPU_S390_FAMILY: S390 or S390X
31// ARCH_CPU_X86_FAMILY: X86 or X86_64
32// Processor features:
33// ARCH_CPU_31_BITS / ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
34// ARCH_CPU_BIG_ENDIAN / ARCH_CPU_LITTLE_ENDIAN
35
36#ifndef UI_ACCESSIBILITY_BUILD_BUILD_CONFIG_H_
37#define UI_ACCESSIBILITY_BUILD_BUILD_CONFIG_H_
38
39// A set of macros to use for platform detection.
40#if defined(__native_client__)
41// __native_client__ must be first, so that other OS_ defines are not set.
42#define OS_NACL 1
43// OS_NACL comes in two sandboxing technology flavors, SFI or Non-SFI.
44// PNaCl toolchain defines __native_client_nonsfi__ macro in Non-SFI build
45// mode, while it does not in SFI build mode.
46#if defined(__native_client_nonsfi__)
47#define OS_NACL_NONSFI
48#else
49#define OS_NACL_SFI
50#endif
51#elif defined(ANDROID)
52#define OS_ANDROID 1
53#elif defined(__APPLE__)
54// Only include TargetConditionals after testing ANDROID as some Android builds
55// on the Mac have this header available and it's not needed unless the target
56// is really an Apple platform.
57#include <TargetConditionals.h>
58#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
59#define OS_IOS 1
60#else
61#define OS_MAC 1
62#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
63#elif defined(__linux__)
64#define OS_LINUX 1
65// Include a system header to pull in features.h for glibc/uclibc macros.
66#include <unistd.h>
67#if defined(__GLIBC__) && !defined(__UCLIBC__)
68// We really are using glibc, not uClibc pretending to be glibc.
69#define LIBC_GLIBC 1
70#endif
71#elif defined(_WIN32)
72#define OS_WIN 1
73#elif defined(__Fuchsia__)
74#define OS_FUCHSIA 1
75#elif defined(__FreeBSD__)
76#define OS_FREEBSD 1
77#elif defined(__NetBSD__)
78#define OS_NETBSD 1
79#elif defined(__OpenBSD__)
80#define OS_OPENBSD 1
81#elif defined(__sun)
82#define OS_SOLARIS 1
83#elif defined(__QNXNTO__)
84#define OS_QNX 1
85#elif defined(_AIX)
86#define OS_AIX 1
87#elif defined(__asmjs__) || defined(__wasm__)
88#define OS_ASMJS 1
89#else
90#error Please add support for your platform in build/build_config.h
91#endif
92// NOTE: Adding a new port? Please follow
93// https://chromium.googlesource.com/chromium/src/+/master/docs/new_port_policy.md
94
95#if defined(OS_MAC) || defined(OS_IOS)
96#define OS_APPLE 1
97#endif
98
99// For access to standard BSD features, use OS_BSD instead of a
100// more specific macro.
101#if defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD)
102#define OS_BSD 1
103#endif
104
105// For access to standard POSIXish features, use OS_POSIX instead of a
106// more specific macro.
107#if defined(OS_AIX) || defined(OS_ANDROID) || defined(OS_ASMJS) || \
108 defined(OS_FREEBSD) || defined(OS_IOS) || defined(OS_LINUX) || \
109 defined(OS_CHROMEOS) || defined(OS_MAC) || defined(OS_NACL) || \
110 defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_QNX) || \
111 defined(OS_SOLARIS)
112#define OS_POSIX 1
113#endif
114
115// Compiler detection. Note: clang masquerades as GCC on POSIX and as MSVC on
116// Windows.
117#if defined(__GNUC__)
118#define COMPILER_GCC 1
119#elif defined(_MSC_VER)
120#define COMPILER_MSVC 1
121#else
122#error Please add support for your compiler in build/build_config.h
123#endif
124
125// Processor architecture detection. For more info on what's defined, see:
126// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
127// http://www.agner.org/optimize/calling_conventions.pdf
128// or with gcc, run: "echo | gcc -E -dM -"
129#if defined(_M_X64) || defined(__x86_64__)
130#define ARCH_CPU_X86_FAMILY 1
131#define ARCH_CPU_X86_64 1
132#define ARCH_CPU_64_BITS 1
133#define ARCH_CPU_LITTLE_ENDIAN 1
134#elif defined(_M_IX86) || defined(__i386__)
135#define ARCH_CPU_X86_FAMILY 1
136#define ARCH_CPU_X86 1
137#define ARCH_CPU_32_BITS 1
138#define ARCH_CPU_LITTLE_ENDIAN 1
139#elif defined(__s390x__)
140#define ARCH_CPU_S390_FAMILY 1
141#define ARCH_CPU_S390X 1
142#define ARCH_CPU_64_BITS 1
143#define ARCH_CPU_BIG_ENDIAN 1
144#elif defined(__s390__)
145#define ARCH_CPU_S390_FAMILY 1
146#define ARCH_CPU_S390 1
147#define ARCH_CPU_31_BITS 1
148#define ARCH_CPU_BIG_ENDIAN 1
149#elif (defined(__PPC64__) || defined(__PPC__)) && defined(__BIG_ENDIAN__)
150#define ARCH_CPU_PPC64_FAMILY 1
151#define ARCH_CPU_PPC64 1
152#define ARCH_CPU_64_BITS 1
153#define ARCH_CPU_BIG_ENDIAN 1
154#elif defined(__PPC64__)
155#define ARCH_CPU_PPC64_FAMILY 1
156#define ARCH_CPU_PPC64 1
157#define ARCH_CPU_64_BITS 1
158#define ARCH_CPU_LITTLE_ENDIAN 1
159#elif defined(__ARMEL__)
160#define ARCH_CPU_ARM_FAMILY 1
161#define ARCH_CPU_ARMEL 1
162#define ARCH_CPU_32_BITS 1
163#define ARCH_CPU_LITTLE_ENDIAN 1
164#elif defined(__aarch64__) || defined(_M_ARM64)
165#define ARCH_CPU_ARM_FAMILY 1
166#define ARCH_CPU_ARM64 1
167#define ARCH_CPU_64_BITS 1
168#define ARCH_CPU_LITTLE_ENDIAN 1
169#elif defined(__pnacl__) || defined(__asmjs__) || defined(__wasm__)
170#define ARCH_CPU_32_BITS 1
171#define ARCH_CPU_LITTLE_ENDIAN 1
172#elif defined(__MIPSEL__)
173#if defined(__LP64__)
174#define ARCH_CPU_MIPS_FAMILY 1
175#define ARCH_CPU_MIPS64EL 1
176#define ARCH_CPU_64_BITS 1
177#define ARCH_CPU_LITTLE_ENDIAN 1
178#else
179#define ARCH_CPU_MIPS_FAMILY 1
180#define ARCH_CPU_MIPSEL 1
181#define ARCH_CPU_32_BITS 1
182#define ARCH_CPU_LITTLE_ENDIAN 1
183#endif
184#elif defined(__MIPSEB__)
185#if defined(__LP64__)
186#define ARCH_CPU_MIPS_FAMILY 1
187#define ARCH_CPU_MIPS64 1
188#define ARCH_CPU_64_BITS 1
189#define ARCH_CPU_BIG_ENDIAN 1
190#else
191#define ARCH_CPU_MIPS_FAMILY 1
192#define ARCH_CPU_MIPS 1
193#define ARCH_CPU_32_BITS 1
194#define ARCH_CPU_BIG_ENDIAN 1
195#endif
196#else
197#error Please add support for your architecture in build/build_config.h
198#endif
199
200// Type detection for wchar_t.
201#if defined(OS_WIN)
202#define WCHAR_T_IS_UTF16
203#elif defined(OS_FUCHSIA)
204#define WCHAR_T_IS_UTF32
205#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
206 (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
207#define WCHAR_T_IS_UTF32
208#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \
209 (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
210// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
211// compile in this mode (in particular, Chrome doesn't). This is intended for
212// other projects using base who manage their own dependencies and make sure
213// short wchar works for them.
214#define WCHAR_T_IS_UTF16
215#else
216#error Please add support for your compiler in build/build_config.h
217#endif
218
219#if defined(OS_ANDROID)
220// The compiler thinks std::string::const_iterator and "const char*" are
221// equivalent types.
222#define STD_STRING_ITERATOR_IS_CHAR_POINTER
223// The compiler thinks std::u16string::const_iterator and "char16*" are
224// equivalent types.
225#define BASE_STRING16_ITERATOR_IS_CHAR16_POINTER
226#endif
227
228#endif // UI_ACCESSIBILITY_BUILD_BUILD_CONFIG_H_