Debian Codegraph @

include/private/base/SkLoadUserConfig.h

raw
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)
11 #include "include/private/base/SkFeatures.h"
12 // Include this so that users can define the lowest active log priority in their config
13 #include "include/private/base/SkLogPriority.h" // IWYU pragma: keep
14
15 // Allows embedders that want to disable macros that take arguments to just
16 // define that symbol to be one of these
17 #define SK_NOTHING_ARG1(arg1)
18 #define SK_NOTHING_ARG2(arg1, arg2)
19 #define SK_NOTHING_ARG3(arg1, arg2, arg3)
20
21 // IWYU pragma: begin_exports
22 // Note: SK_USER_CONFIG_HEADER will not work with Bazel builds and some C++ compilers.
23 #if defined(SK_USER_CONFIG_HEADER)
24 #include SK_USER_CONFIG_HEADER
25 #elif defined(SK_USE_BAZEL_CONFIG_HEADER)
26 // The Bazel config file is presumed to be in the root directory of its Bazel Workspace.
27 // This is achieved in Skia by having a nested WORKSPACE in include/config and a cc_library
28 // defined in that folder. As a result, we do not try to include SkUserConfig.h from the
29 // top of Skia because Bazel sandboxing will move it to a different location.
30 #include "SkUserConfig.h" // NO_G3_REWRITE
31 #else
32 #include "include/config/SkUserConfig.h"
33 #endif
34 // IWYU pragma: end_exports
35
36 // Checks to make sure the SkUserConfig options do not conflict.
37 #if !defined(SK_DEBUG) && !defined(SK_RELEASE)
38 #ifdef NDEBUG
39 #define SK_RELEASE
40 #else
41 #define SK_DEBUG
42 #endif
43 #endif
44
45 #if defined(SK_DEBUG) && defined(SK_RELEASE)
46 # error "cannot define both SK_DEBUG and SK_RELEASE"
47 #elif !defined(SK_DEBUG) && !defined(SK_RELEASE)
48 # error "must define either SK_DEBUG or SK_RELEASE"
49 #endif
50
51 #if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN)
52 # error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN"
53 #elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN)
54 # error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN"
55 #endif
56
57 #if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN)
58 #error "The Skia team is not endian-savvy enough to support big-endian CPUs."
59 #error "If you still want to use Skia,"
60 #error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN."
61 #endif
62
63 #define SK_USER_CONFIG_WAS_LOADED
64 #endif // SK_USER_CONFIG_WAS_LOADED