1 # Copyright 2016 Google Inc.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 is_skia_standalone = true
8 # It's best to keep the names and defaults of is_foo flags consistent with Chrome.
11 is_official_build = false
12 is_component_build = false
15 # Android 5.0, Lollipop
24 win_sdk = "C:/Program Files (x86)/Windows Kits/10"
28 win_toolchain_version = ""
31 clang_win_version = ""
35 target_os == "ios" && (target_cpu == "x86" || target_cpu == "x64")
38 is_debug = !is_official_build
41 assert(!(is_debug && is_official_build))
43 if (target_cpu == "wasm") {
48 if (target_os == "") {
54 if (current_os == "") {
55 current_os = target_os
58 is_android = current_os == "android"
59 is_fuchsia = current_os == "fuchsia"
60 is_ios = current_os == "ios" || current_os == "tvos"
61 is_tvos = current_os == "tvos"
62 is_linux = current_os == "linux"
63 is_mac = current_os == "mac"
64 is_wasm = current_os == "wasm"
65 is_win = current_os == "win"
67 # This is just to make the Dawn build files happy. Skia itself uses target_os = "linux"
68 # for ChromeOS, so this variable will not affect Skia proper.
71 # This is to make the ANGLE build files happy. Skia always uses is_mac and/or is_ios.
72 is_apple = is_mac || is_ios
74 if (target_cpu == "") {
76 if (is_android || is_ios) {
80 if (target_cpu == "x86_64") {
83 if (current_cpu == "") {
84 current_cpu = target_cpu
87 is_clang = is_android || is_ios || is_mac || is_fuchsia || is_wasm ||
88 (cc == "clang" && cxx == "clang++") || clang_win != ""
89 if (!is_clang && !is_win) {
90 is_clang = exec_script("//gn/is_clang.py",
103 if (host_os == "linux") {
104 ndk_host = "linux-x86_64"
105 } else if (host_os == "mac") {
106 ndk_host = "darwin-x86_64"
107 } else if (host_os == "win") {
108 ndk_host = "windows-x86_64"
111 if (target_cpu == "arm64") {
112 ndk_target = "aarch64-linux-android"
113 ndk_gdbserver = "prebuilt/android-arm64/gdbserver/gdbserver"
114 } else if (target_cpu == "arm") {
115 ndk_target = "armv7a-linux-androideabi"
116 ndk_gdbserver = "prebuilt/android-arm/gdbserver/gdbserver"
117 } else if (target_cpu == "x64") {
118 ndk_target = "x86_64-linux-android"
119 ndk_gdbserver = "prebuilt/android-x86_64/gdbserver/gdbserver"
120 } else if (target_cpu == "x86") {
121 ndk_target = "i686-linux-android"
122 ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver"
126 if (target_os == "win") {
127 # By default we look for 2017 (Enterprise, Pro, and Community), then 2015. If MSVC is installed in a
128 # non-default location, you can set win_vc to inform us where it is.
131 win_vc = exec_script("//gn/find_msvc.py", [], "trim string")
133 assert(win_vc != "") # Could not find VC installation. Set win_vc to your VC
137 if (target_os == "win") {
138 if (win_toolchain_version == "") {
139 win_toolchain_version = exec_script("//gn/highest_version_dir.py",
141 "$win_vc/Tools/MSVC",
142 "[0-9]{2}\.[0-9]{2}\.[0-9]{5}",
146 if (win_sdk_version == "") {
147 win_sdk_version = exec_script("//gn/highest_version_dir.py",
150 "[0-9]{2}\.[0-9]\.[0-9]{5}\.[0-9]",
154 if (clang_win != "" && clang_win_version == "") {
155 clang_win_version = exec_script("//gn/highest_version_dir.py",
157 "$clang_win/lib/clang",
158 "[0-9]+\.[0-9]+\.[0-9]+",
164 # A component is either a static or a shared library.
165 template("component") {
166 _component_mode = "static_library"
167 if (is_component_build) {
168 _component_mode = "shared_library"
171 target(_component_mode, target_name) {
172 forward_variables_from(invoker, "*")
179 "//gn/skia:no_exceptions",
184 "//gn/skia:optimize",
188 if (!is_official_build) {
189 default_configs += [ "//gn/skia:debug_symbols" ]
191 default_configs += [ "//gn/skia:extra_flags" ]
193 set_defaults("executable") {
194 configs = [ "//gn/skia:executable" ] + default_configs
197 set_defaults("source_set") {
198 configs = default_configs
201 set_defaults("static_library") {
202 configs = default_configs
205 set_defaults("shared_library") {
206 configs = default_configs
209 set_defaults("component") {
210 configs = default_configs
211 if (!is_component_build) {
212 complete_static_lib = true
216 skia_target_default_configs = []
217 if (!is_official_build) {
218 skia_target_default_configs += [ "//gn/skia:warnings" ]
221 skia_header_target_default_configs = []
222 if (!is_official_build) {
223 skia_header_target_default_configs +=
224 [ "//gn/skia:warnings_for_public_headers" ]
229 set_default_toolchain("//gn/toolchain:msvc")
230 default_toolchain_name = "msvc"
231 host_toolchain = "msvc"
232 } else if (is_wasm) {
233 set_default_toolchain("//gn/toolchain:wasm")
234 default_toolchain_name = "wasm"
235 host_toolchain = "wasm"
237 # GCC-like toolchains, including Clang.
238 set_default_toolchain("//gn/toolchain:gcc_like")
239 default_toolchain_name = "gcc_like"
240 host_toolchain = "gcc_like_host"