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
14 if (target_cpu == "x86" || target_cpu == "mipsel" || target_cpu == "arm") {
19 linux_soname_version = ""
22 building_for_tizen = false
27 is_debug = !is_official_build
30 assert(!(is_debug && is_official_build))
33 if (target_os == "") {
39 if (current_os == "") {
40 current_os = target_os
43 is_android = current_os == "android"
44 is_fuchsia = current_os == "fuchsia"
45 is_ios = current_os == "ios" || current_os == "tvos" || current_os == "watchos"
46 is_tvos = current_os == "tvos"
47 is_watchos = current_os == "watchos"
48 is_linux = current_os == "linux"
49 is_mac = current_os == "mac"
50 is_win = current_os == "win" || current_os == "winrt"
51 is_winrt = current_os == "winrt"
52 is_tizen = building_for_tizen
54 if (target_cpu == "") {
56 if (is_android || is_ios) {
60 if (target_cpu == "x86_64") {
63 if (current_cpu == "") {
64 current_cpu = target_cpu
75 if (host_os == "linux") {
76 ndk_host = "linux-x86_64"
77 } else if (host_os == "mac") {
78 ndk_host = "darwin-x86_64"
79 } else if (host_os == "win") {
80 ndk_host = "windows-x86_64"
83 if (target_cpu == "arm64") {
84 ndk_target = "aarch64-linux-android"
85 ndk_platform = "android-${ndk_api}/arch-arm64"
86 ndk_stdlib = "arm64-v8a"
87 ndk_gccdir = ndk_target
88 ndk_gdbserver = "prebuilt/android-arm64/gdbserver/gdbserver"
89 } else if (target_cpu == "arm") {
90 ndk_target = "arm-linux-androideabi"
91 ndk_platform = "android-${ndk_api}/arch-arm"
92 ndk_stdlib = "armeabi-v7a"
93 ndk_gccdir = ndk_target
94 ndk_gdbserver = "prebuilt/android-arm/gdbserver/gdbserver"
95 } else if (target_cpu == "mips64el") {
96 ndk_target = "mips64el-linux-android"
97 ndk_platform = "android-${ndk_api}/arch-mips64"
99 ndk_gccdir = ndk_target
100 ndk_gdbserver = "prebuilt/android-mips64/gdbserver/gdbserver"
101 } else if (target_cpu == "mipsel") {
102 ndk_target = "mipsel-linux-android"
103 ndk_platform = "android-${ndk_api}/arch-mips"
105 ndk_gccdir = ndk_target
106 ndk_gdbserver = "prebuilt/android-mips/gdbserver/gdbserver"
107 } else if (target_cpu == "x64") {
108 ndk_target = "x86_64-linux-android"
109 ndk_platform = "android-${ndk_api}/arch-x86_64"
110 ndk_stdlib = "x86_64"
111 ndk_gccdir = ndk_stdlib
112 ndk_gdbserver = "prebuilt/android-x86_64/gdbserver/gdbserver"
113 } else if (target_cpu == "x86") {
114 ndk_target = "i686-linux-android"
115 ndk_platform = "android-${ndk_api}/arch-x86"
117 ndk_gccdir = ndk_stdlib
118 ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver"
127 if (target_cpu == "arm") {
128 ncli_target = "arm-tizen-linux-gnueabi"
129 ncli_platform = "tizen-${ncli_version}/mobile/rootstraps/mobile-${ncli_version}-device.core"
130 ncli_gccdir = "arm-linux-gnueabi-gcc-6.2"
131 } else if (target_cpu == "x86") {
132 ncli_target = "i586-tizen-linux-gnueabi"
133 ncli_platform = "tizen-${ncli_version}/mobile/rootstraps/mobile-${ncli_version}-emulator.core"
134 ncli_gccdir = "i586-linux-gnueabi-gcc-6.2"
138 # A component is either a static or a shared library.
139 template("component") {
140 _component_mode = "static_library"
141 if (is_component_build) {
142 _component_mode = "shared_library"
145 target(_component_mode, target_name) {
146 forward_variables_from(invoker, "*")
153 "//gn:no_exceptions",
156 "//gn:warnings_except_public_headers",
159 default_configs += [ "//gn:release" ]
161 if (!is_official_build) {
162 default_configs += [ "//gn:debug_symbols" ]
164 default_configs += [ "//gn:extra_flags" ]
166 set_defaults("executable") {
167 configs = [ "//gn:executable" ] + default_configs
170 set_defaults("source_set") {
171 configs = default_configs
174 set_defaults("static_library") {
175 configs = default_configs
178 set_defaults("shared_library") {
179 configs = default_configs
182 set_defaults("component") {
183 configs = default_configs
184 if (!is_component_build) {
185 complete_static_lib = true
191 set_default_toolchain("//gn:msvc")
193 # GCC-like toolchains, including Clang.
194 set_default_toolchain("//gn:gcc_like")