Flutter Engine
build_config.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter 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 // Operating System:
7 // OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) /
8 // OS_NACL (NACL_SFI or NACL_NONSFI) / OS_NACL_SFI / OS_NACL_NONSFI
9 // Compiler:
10 // COMPILER_MSVC / COMPILER_GCC
11 // Processor:
12 // ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
13 // ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
14 
15 #ifndef TONIC_COMMON_BUILD_CONFIG_H_
16 #define TONIC_COMMON_BUILD_CONFIG_H_
17 
18 #if defined(__Fuchsia__)
19 #define OS_FUCHSIA 1
20 #elif defined(ANDROID)
21 #define OS_ANDROID 1
22 #elif defined(__APPLE__)
23 // only include TargetConditions after testing ANDROID as some android builds
24 // on mac don't have this header available and it's not needed unless the target
25 // is really mac/ios.
26 #include <TargetConditionals.h>
27 #define OS_MACOSX 1
28 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
29 #define OS_IOS 1
30 #endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
31 #elif defined(__linux__)
32 #define OS_LINUX 1
33 // include a system header to pull in features.h for glibc/uclibc macros.
34 #include <unistd.h>
35 #if defined(__GLIBC__) && !defined(__UCLIBC__)
36 // we really are using glibc, not uClibc pretending to be glibc
37 #define LIBC_GLIBC 1
38 #endif
39 #elif defined(_WIN32)
40 #define OS_WIN 1
41 #elif defined(__FreeBSD__)
42 #define OS_FREEBSD 1
43 #elif defined(__OpenBSD__)
44 #define OS_OPENBSD 1
45 #elif defined(__sun)
46 #define OS_SOLARIS 1
47 #elif defined(__QNXNTO__)
48 #define OS_QNX 1
49 #else
50 #error Please add support for your platform in tonic/common/build_config.h
51 #endif
52 
53 // For access to standard BSD features, use OS_BSD instead of a
54 // more specific macro.
55 #if defined(OS_FREEBSD) || defined(OS_OPENBSD)
56 #define OS_BSD 1
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) || defined(OS_FREEBSD) || \
62  defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
63  defined(OS_NACL) || defined(OS_QNX)
64 #define OS_POSIX 1
65 #endif
66 
67 // Processor architecture detection. For more info on what's defined, see:
68 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
69 // http://www.agner.org/optimize/calling_conventions.pdf
70 // or with gcc, run: "echo | gcc -E -dM -"
71 #if defined(_M_X64) || defined(__x86_64__)
72 #define ARCH_CPU_X86_FAMILY 1
73 #define ARCH_CPU_X86_64 1
74 #define ARCH_CPU_64_BITS 1
75 #define ARCH_CPU_LITTLE_ENDIAN 1
76 #elif defined(_M_IX86) || defined(__i386__)
77 #define ARCH_CPU_X86_FAMILY 1
78 #define ARCH_CPU_X86 1
79 #define ARCH_CPU_32_BITS 1
80 #define ARCH_CPU_LITTLE_ENDIAN 1
81 #elif defined(__ARMEL__)
82 #define ARCH_CPU_ARM_FAMILY 1
83 #define ARCH_CPU_ARMEL 1
84 #define ARCH_CPU_32_BITS 1
85 #define ARCH_CPU_LITTLE_ENDIAN 1
86 #elif defined(__aarch64__)
87 #define ARCH_CPU_ARM_FAMILY 1
88 #define ARCH_CPU_ARM64 1
89 #define ARCH_CPU_64_BITS 1
90 #define ARCH_CPU_LITTLE_ENDIAN 1
91 #elif defined(__pnacl__)
92 #define ARCH_CPU_32_BITS 1
93 #define ARCH_CPU_LITTLE_ENDIAN 1
94 #elif defined(__MIPSEL__)
95 #if defined(__LP64__)
96 #define ARCH_CPU_MIPS64_FAMILY 1
97 #define ARCH_CPU_MIPS64EL 1
98 #define ARCH_CPU_64_BITS 1
99 #define ARCH_CPU_LITTLE_ENDIAN 1
100 #else
101 #define ARCH_CPU_MIPS_FAMILY 1
102 #define ARCH_CPU_MIPSEL 1
103 #define ARCH_CPU_32_BITS 1
104 #define ARCH_CPU_LITTLE_ENDIAN 1
105 #endif
106 #else
107 #error Please add support for your architecture in build/build_config.h
108 #endif
109 
110 #endif // TONIC_COMMON_BUILD_CONFIG_H_