Flutter Engine
The 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// FML_OS_WIN / FML_OS_MACOSX / FML_OS_LINUX / FML_OS_POSIX (MACOSX or LINUX)
8// / FML_OS_NACL (NACL_SFI or NACL_NONSFI) / FML_OS_NACL_SFI /
9// FML_OS_NACL_NONSFI
10// Compiler:
11// COMPILER_MSVC / COMPILER_GCC
12// Processor:
13// FML_ARCH_CPU_X86 / FML_ARCH_CPU_X86_64 / FML_ARCH_CPU_X86_FAMILY (X86 or
14// X86_64) FML_ARCH_CPU_32_BITS / FML_ARCH_CPU_64_BITS
15
16#ifndef FLUTTER_FML_BUILD_CONFIG_H_
17#define FLUTTER_FML_BUILD_CONFIG_H_
18
19#if defined(__Fuchsia__)
20#define OS_FUCHSIA 1
21#elif defined(ANDROID)
22#define FML_OS_ANDROID 1
23#elif defined(__APPLE__)
24// only include TargetConditions after testing ANDROID as some android builds
25// on mac don't have this header available and it's not needed unless the target
26// is really mac/ios.
27#include <TargetConditionals.h>
28#define FML_OS_MACOSX 1
29#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
30#define FML_OS_IOS 1
31#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
32#if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
33#define FML_OS_IOS_SIMULATOR 1
34#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
35#elif defined(__linux__)
36#define FML_OS_LINUX 1
37// include a system header to pull in features.h for glibc/uclibc macros.
38#include <unistd.h>
39#if defined(__GLIBC__) && !defined(__UCLIBC__)
40// we really are using glibc, not uClibc pretending to be glibc
41#define LIBC_GLIBC 1
42#endif
43#elif defined(_WIN32)
44#define FML_OS_WIN 1
45#elif defined(__FreeBSD__)
46#define FML_OS_FREEBSD 1
47#elif defined(__OpenBSD__)
48#define FML_OS_OPENBSD 1
49#elif defined(__sun)
50#define FML_OS_SOLARIS 1
51#elif defined(__QNXNTO__)
52#define FML_OS_QNX 1
53#else
54#error Please add support for your platform in flutter/fml/build_config.h
55#endif
56
57// For access to standard BSD features, use FML_OS_BSD instead of a
58// more specific macro.
59#if defined(FML_OS_FREEBSD) || defined(FML_OS_OPENBSD)
60#define FML_OS_BSD 1
61#endif
62
63// For access to standard POSIXish features, use FML_OS_POSIX instead of a
64// more specific macro.
65#if defined(FML_OS_MACOSX) || defined(FML_OS_LINUX) || \
66 defined(FML_OS_FREEBSD) || defined(FML_OS_OPENBSD) || \
67 defined(FML_OS_SOLARIS) || defined(FML_OS_ANDROID) || \
68 defined(FML_OS_NACL) || defined(FML_OS_QNX)
69#define FML_OS_POSIX 1
70#endif
71
72// Processor architecture detection. For more info on what's defined, see:
73// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
74// http://www.agner.org/optimize/calling_conventions.pdf
75// or with gcc, run: "echo | gcc -E -dM -"
76#if defined(_M_X64) || defined(__x86_64__)
77#define FML_ARCH_CPU_X86_FAMILY 1
78#define FML_ARCH_CPU_X86_64 1
79#define FML_ARCH_CPU_64_BITS 1
80#define FML_ARCH_CPU_LITTLE_ENDIAN 1
81#elif defined(_M_IX86) || defined(__i386__)
82#define FML_ARCH_CPU_X86_FAMILY 1
83#define FML_ARCH_CPU_X86 1
84#define FML_ARCH_CPU_32_BITS 1
85#define FML_ARCH_CPU_LITTLE_ENDIAN 1
86#elif defined(__ARMEL__)
87#define FML_ARCH_CPU_ARM_FAMILY 1
88#define FML_ARCH_CPU_ARMEL 1
89#define FML_ARCH_CPU_32_BITS 1
90#define FML_ARCH_CPU_LITTLE_ENDIAN 1
91#elif defined(__aarch64__)
92#define FML_ARCH_CPU_ARM_FAMILY 1
93#define FML_ARCH_CPU_ARM64 1
94#define FML_ARCH_CPU_64_BITS 1
95#define FML_ARCH_CPU_LITTLE_ENDIAN 1
96#elif defined(__pnacl__)
97#define FML_ARCH_CPU_32_BITS 1
98#define FML_ARCH_CPU_LITTLE_ENDIAN 1
99#else
100#error Please add support for your architecture in flutter/fml/build_config.h
101#endif
102
103#endif // FLUTTER_FML_BUILD_CONFIG_H_