1 # Copyright 2019 Google LLC.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 if (!defined(is_skia_standalone)) {
6 is_skia_standalone = false
9 is_skia_dev_build = is_skia_standalone && !is_official_build
12 skia_android_serial = ""
13 skia_compile_modules = false
14 skia_compile_sksl_tests = false
15 skia_enable_api_available_macro = true
16 skia_enable_android_utils = is_skia_dev_build
17 skia_enable_skgpu_v1 = true
18 skia_enable_discrete_gpu = true
19 skia_enable_flutter_defines = false
20 skia_enable_fontmgr_empty = false
21 skia_enable_fontmgr_fuchsia = is_fuchsia
22 skia_enable_fontmgr_win = is_win
23 skia_enable_gpu = true
24 skia_enable_pdf = !is_wasm
25 skia_enable_skottie = !(is_win && is_component_build) ||
26 (is_wasm && skia_canvaskit_enable_skottie)
27 skia_enable_sksl = true
28 skia_enable_sksl_tracing = is_skia_dev_build
29 skia_enable_skvm_jit_when_possible = is_skia_dev_build
30 skia_enable_svg = !is_component_build
31 skia_enable_tools = is_skia_dev_build
32 skia_enable_gpu_debug_layers = is_skia_dev_build && is_debug
33 skia_disable_vma_stl_shared_mutex = false
34 skia_enable_winuwp = false
35 skia_generate_workarounds = false
36 skia_include_multiframe_procs = false
38 skia_libgifcodec_path = "third_party/externals/libgifcodec"
39 skia_tools_require_resources = false
40 skia_update_fuchsia_sdk = false
41 skia_use_angle = false
43 skia_use_direct3d = false
45 skia_use_expat = !is_wasm
46 skia_use_ffmpeg = false
47 skia_use_fixed_gamma_text = is_android
48 skia_use_fontconfig = is_linux
49 skia_use_fonthost_mac = is_mac || is_ios
50 skia_use_freetype = is_android || is_fuchsia || is_linux || is_wasm
51 skia_use_harfbuzz = true
52 skia_use_gl = !is_fuchsia
53 skia_use_icu = !is_fuchsia
54 skia_use_libheif = is_skia_dev_build
55 skia_use_libjpeg_turbo_decode = true
56 skia_use_libjpeg_turbo_encode = true
57 skia_use_libjxl_decode = false
58 skia_use_libpng_decode = true
59 skia_use_libpng_encode = true
60 skia_use_libwebp_decode = true
61 skia_use_libwebp_encode = !is_wasm
62 skia_use_lua = is_skia_dev_build && !is_ios
63 skia_use_metal = false
64 skia_use_ndk_images = is_android && defined(ndk_api) && ndk_api >= 30
65 skia_use_perfetto = is_linux || is_mac || is_android
66 skia_use_piex = !is_win && !is_wasm
68 skia_use_webgl = is_wasm
69 skia_use_wuffs = is_wasm
70 skia_use_x11 = is_linux
72 skia_enable_graphite = false
78 skia_ios_identity = ".*Google.*"
79 skia_ios_profile = "Google Development"
82 skia_compare_vm_vs_rp = false
87 skia_gl_standard = "gl"
89 skia_gl_standard = "gles"
90 } else if (is_wasm && skia_enable_gpu) {
91 skia_gl_standard = "webgl"
97 skia_use_vulkan = defined(ndk_api) && ndk_api >= 24
98 } else if (is_fuchsia) {
99 skia_use_vulkan = true
101 skia_use_vulkan = false
104 skia_build_fuzzers = is_clang && is_linux && target_cpu == "x64"
105 skia_use_libfuzzer_defaults = true
108 if (skia_use_angle && skia_gl_standard != "gles") {
109 skia_gl_standard = ""
113 skia_pdf_subset_harfbuzz = skia_use_harfbuzz
117 skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype
118 skia_enable_fontmgr_custom_directory =
119 skia_use_freetype && !is_fuchsia && !is_wasm
120 skia_enable_fontmgr_custom_embedded = skia_use_freetype && !is_fuchsia
121 skia_enable_fontmgr_custom_empty = skia_use_freetype && !is_wasm
122 skia_enable_fontmgr_fontconfig = skia_use_freetype && skia_use_fontconfig
123 skia_enable_fontmgr_win_gdi = is_win && !skia_enable_winuwp
124 skia_enable_fontmgr_FontConfigInterface =
125 skia_use_freetype && skia_use_fontconfig
126 skia_enable_spirv_validation = is_skia_dev_build && is_debug && !skia_use_dawn
128 !is_fuchsia && !is_wasm && skia_use_libjpeg_turbo_decode && skia_use_zlib
129 skia_use_libgifcodec = !skia_use_wuffs
130 skia_use_sfntly = skia_use_icu
131 skia_enable_vulkan_debug_layers = skia_enable_gpu_debug_layers
132 skia_enable_direct3d_debug_layer = skia_enable_gpu_debug_layers
133 skia_enable_metal_debug_info = skia_enable_gpu_debug_layers
134 skia_use_vma = skia_use_vulkan
135 skia_build_for_debugger = false
139 # skia_fontmgr_factory should define SkFontMgr::Factory()
140 if (skia_enable_fontmgr_empty) {
141 skia_fontmgr_factory = ":fontmgr_empty_factory"
142 } else if (is_android && skia_enable_fontmgr_android) {
143 skia_fontmgr_factory = ":fontmgr_android_factory"
144 } else if (is_win && skia_enable_fontmgr_win) {
145 skia_fontmgr_factory = ":fontmgr_win_factory"
146 } else if ((is_mac || is_ios) && skia_use_fonthost_mac) {
147 skia_fontmgr_factory = ":fontmgr_mac_ct_factory"
148 } else if (skia_enable_fontmgr_fontconfig) {
149 skia_fontmgr_factory = ":fontmgr_fontconfig_factory"
150 } else if (skia_enable_fontmgr_custom_directory) {
151 skia_fontmgr_factory = ":fontmgr_custom_directory_factory"
152 } else if (skia_enable_fontmgr_custom_embedded) {
153 skia_fontmgr_factory = ":fontmgr_custom_embedded_factory"
154 } else if (skia_enable_fontmgr_custom_empty) {
155 skia_fontmgr_factory = ":fontmgr_custom_empty_factory"
157 #"src/ports/SkFontMgr_FontConfigInterface_factory.cpp" #WontFix
158 #"src/ports/SkFontMgr_win_gdi_factory.cpp" # WontFix
159 skia_fontmgr_factory = ":fontmgr_empty_factory"
163 # Our tools require static linking (they use non-exported symbols), and the GPU backend.
164 skia_enable_tools = skia_enable_tools && !is_component_build && skia_enable_gpu
166 # The GPU build requires SkSL
167 skia_enable_sksl = skia_enable_sksl || skia_enable_gpu
169 # Skia's targets may be built inside other gn build systems.
170 # Skia builds other project's build targets inside its build.
171 # This is easier if the built-in target types remain generic.
172 # Place Skia target specific configs in skia_target_default_configs.
173 # These will be applied by the 'skia_*' templates.
174 # In the Skia build these configs apply many warnings as errors.
175 # Other projects may optionally set these configs as they see fit.
176 template("skia_target") {
177 target(invoker._skia_target_type, target_name) {
178 # set_defaults(invoker._skia_target_type) might not exist or set configs
179 if (!defined(configs)) {
183 # Explicit configs instead of set_defaults("skia_target")
184 # Allows template("skia_*") below to avoid the configs dance.
185 if (defined(skia_target_default_configs)) {
186 configs += skia_target_default_configs
189 # "*" clobbers the current scope; append to existing configs
190 forward_variables_from(invoker, "*", [ "configs" ])
191 if (defined(invoker.configs)) {
192 configs += invoker.configs
197 template("skia_executable") {
198 skia_target(target_name) {
199 assert(!defined(configs), "No set_defaults(skia_target)")
200 _skia_target_type = "executable"
201 forward_variables_from(invoker, "*")
204 template("skia_source_set") {
205 skia_target(target_name) {
206 assert(!defined(configs), "No set_defaults(skia_target)")
207 _skia_target_type = "source_set"
208 forward_variables_from(invoker, "*")
211 template("skia_static_library") {
212 skia_target(target_name) {
213 assert(!defined(configs), "No set_defaults(skia_target)")
214 _skia_target_type = "static_library"
215 forward_variables_from(invoker, "*")
218 template("skia_shared_library") {
219 skia_target(target_name) {
220 assert(!defined(configs), "No set_defaults(skia_target)")
221 _skia_target_type = "shared_library"
222 forward_variables_from(invoker, "*")
225 template("skia_component") {
226 skia_target(target_name) {
227 assert(!defined(configs), "No set_defaults(skia_target)")
228 _skia_target_type = "component"
229 forward_variables_from(invoker, "*")