Fix file mode of changed files (remove -x)
[platform/upstream/libSkiaSharp.git] / gn / BUILDCONFIG.gn
1 # Copyright 2016 Google Inc.
2 #
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 is_skia_standalone = true
7
8 # It's best to keep the names and defaults of is_foo flags consistent with Chrome.
9
10 declare_args() {
11   is_official_build = false
12   is_component_build = false
13   ndk = ""
14   if (target_cpu == "x86" || target_cpu == "mipsel" || target_cpu == "arm") {
15     ndk_api = 18
16   } else {
17     ndk_api = 21
18   }
19   linux_soname_version = ""
20   sanitize = ""
21
22   building_for_tizen = false
23   ncli = ""
24   ncli_version = "4.0"
25 }
26 declare_args() {
27   is_debug = !is_official_build
28 }
29
30 assert(!(is_debug && is_official_build))
31
32 # Platform detection
33 if (target_os == "") {
34   target_os = host_os
35   if (ndk != "") {
36     target_os = "android"
37   }
38 }
39 if (current_os == "") {
40   current_os = target_os
41 }
42
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
53
54 if (target_cpu == "") {
55   target_cpu = host_cpu
56   if (is_android || is_ios) {
57     target_cpu = "arm64"
58   }
59 }
60 if (target_cpu == "x86_64") {
61   target_cpu = "x64"
62 }
63 if (current_cpu == "") {
64   current_cpu = target_cpu
65 }
66
67 if (is_android) {
68   ndk_host = ""
69   ndk_target = ""
70   ndk_platform = ""
71   ndk_stdlib = ""
72   ndk_gccdir = ""
73   ndk_gdbserver = ""
74
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"
81   }
82
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"
98     ndk_stdlib = "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"
104     ndk_stdlib = "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"
116     ndk_stdlib = "x86"
117     ndk_gccdir = ndk_stdlib
118     ndk_gdbserver = "prebuilt/android-x86/gdbserver/gdbserver"
119   }
120 }
121
122 if (is_tizen) {
123   ncli_target = ""
124   ncli_platform = ""
125   ncli_gccdir = ""
126
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"
135   }
136 }
137
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"
143   }
144
145   target(_component_mode, target_name) {
146     forward_variables_from(invoker, "*")
147   }
148 }
149
150 # Default configs
151 default_configs = [
152   "//gn:default",
153   "//gn:no_exceptions",
154   "//gn:no_rtti",
155   "//gn:warnings",
156   "//gn:warnings_except_public_headers",
157 ]
158 if (!is_debug) {
159   default_configs += [ "//gn:release" ]
160 }
161 if (!is_official_build) {
162   default_configs += [ "//gn:debug_symbols" ]
163 }
164 default_configs += [ "//gn:extra_flags" ]
165
166 set_defaults("executable") {
167   configs = [ "//gn:executable" ] + default_configs
168 }
169
170 set_defaults("source_set") {
171   configs = default_configs
172 }
173
174 set_defaults("static_library") {
175   configs = default_configs
176 }
177
178 set_defaults("shared_library") {
179   configs = default_configs
180 }
181
182 set_defaults("component") {
183   configs = default_configs
184   if (!is_component_build) {
185     complete_static_lib = true
186   }
187 }
188
189 if (is_win) {
190   # Windows tool chain
191   set_default_toolchain("//gn:msvc")
192 } else {
193   # GCC-like toolchains, including Clang.
194   set_default_toolchain("//gn:gcc_like")
195 }