Flutter Engine
The Flutter Engine
SkLoadUserConfig.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SK_USER_CONFIG_WAS_LOADED
9
10// Include this to set reasonable defaults (e.g. for SK_CPU_LENDIAN)
12
13// Allows embedders that want to disable macros that take arguments to just
14// define that symbol to be one of these
15#define SK_NOTHING_ARG1(arg1)
16#define SK_NOTHING_ARG2(arg1, arg2)
17#define SK_NOTHING_ARG3(arg1, arg2, arg3)
18
19// IWYU pragma: begin_exports
20
21// Note: SK_USER_CONFIG_HEADER will not work with Bazel builds and some C++ compilers.
22#if defined(SK_USER_CONFIG_HEADER)
23 #include SK_USER_CONFIG_HEADER
24#elif defined(SK_USE_BAZEL_CONFIG_HEADER)
25 // The Bazel config file is presumed to be in the root directory of its Bazel Workspace.
26 // This is achieved in Skia by having a nested WORKSPACE in include/config and a cc_library
27 // defined in that folder. As a result, we do not try to include SkUserConfig.h from the
28 // top of Skia because Bazel sandboxing will move it to a different location.
29 #include "SkUserConfig.h" // NO_G3_REWRITE
30#else
32#endif
33// IWYU pragma: end_exports
34
35// Checks to make sure the SkUserConfig options do not conflict.
36#if !defined(SK_DEBUG) && !defined(SK_RELEASE)
37 #ifdef NDEBUG
38 #define SK_RELEASE
39 #else
40 #define SK_DEBUG
41 #endif
42#endif
43
44#if defined(SK_DEBUG) && defined(SK_RELEASE)
45# error "cannot define both SK_DEBUG and SK_RELEASE"
46#elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
47# error "must define either SK_DEBUG or SK_RELEASE"
48#endif
49
50#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
51# error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
52#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
53# error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
54#endif
55
56#if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN)
57 #error "The Skia team is not endian-savvy enough to support big-endian CPUs."
58 #error "If you still want to use Skia,"
59 #error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN."
60#endif
61
62#define SK_USER_CONFIG_WAS_LOADED
63#endif // SK_USER_CONFIG_WAS_LOADED