OLD | NEW |
1 # Copyright 2016 Google Inc. | 1 # Copyright 2016 Google Inc. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # It's best to keep the names and defaults of is_foo flags consistent with Chrom
e. | 6 # It's best to keep the names and defaults of is_foo flags consistent with Chrom
e. |
7 | 7 |
8 declare_args() { | 8 declare_args() { |
9 is_debug = true | 9 is_debug = true |
10 is_component_build = false | 10 is_component_build = false |
| 11 ndk = "" |
11 } | 12 } |
12 | 13 |
13 # Platform detection | 14 # Platform detection |
14 if (target_os == "") { | 15 if (target_os == "") { |
15 target_os = host_os | 16 target_os = host_os |
| 17 if (ndk != "") { |
| 18 target_os = "android" |
| 19 } |
16 } | 20 } |
17 if (current_os == "") { | 21 if (current_os == "") { |
18 current_os = target_os | 22 current_os = target_os |
19 } | 23 } |
20 | 24 |
21 if (target_cpu == "") { | 25 if (target_cpu == "") { |
22 target_cpu = host_cpu | 26 target_cpu = host_cpu |
| 27 if (ndk != "") { |
| 28 target_cpu = "arm64" |
| 29 } |
23 } | 30 } |
24 if (current_cpu == "") { | 31 if (current_cpu == "") { |
25 current_cpu = target_cpu | 32 current_cpu = target_cpu |
26 } | 33 } |
27 | 34 |
28 is_android = current_os == "android" | 35 is_android = current_os == "android" |
29 is_fuchsia = current_os == "fuchsia" | 36 is_fuchsia = current_os == "fuchsia" |
30 is_ios = current_os == "ios" | 37 is_ios = current_os == "ios" |
31 is_linux = current_os == "linux" | 38 is_linux = current_os == "linux" |
32 is_mac = current_os == "mac" | 39 is_mac = current_os == "mac" |
33 is_win = current_os == "win" | 40 is_win = current_os == "win" |
34 | 41 |
35 is_posix = !is_win | 42 is_posix = !is_win |
36 | 43 |
| 44 if (is_android) { |
| 45 ndk_host = "" |
| 46 ndk_target = "" |
| 47 ndk_platform = "" |
| 48 ndk_stdlib = "" |
| 49 |
| 50 if (host_os == "linux" && host_cpu == "x64") { |
| 51 ndk_host = "linux-x86_64" |
| 52 } |
| 53 if (target_cpu == "arm64") { |
| 54 ndk_target = "aarch64-linux-android" |
| 55 ndk_platform = "android-21/arch-arm64" |
| 56 ndk_stdlib = "arm64-v8a" |
| 57 } |
| 58 } |
| 59 |
37 # A component is either a static or a shared library. | 60 # A component is either a static or a shared library. |
38 template("component") { | 61 template("component") { |
39 _component_mode = "static_library" | 62 _component_mode = "static_library" |
40 if (is_component_build) { | 63 if (is_component_build) { |
41 _component_mode = "shared_library" | 64 _component_mode = "shared_library" |
42 } | 65 } |
43 | 66 |
44 target(_component_mode, target_name) { | 67 target(_component_mode, target_name) { |
45 forward_variables_from(invoker, "*") | 68 forward_variables_from(invoker, "*") |
46 } | 69 } |
(...skipping 26 matching lines...) Expand all Loading... |
73 | 96 |
74 set_defaults("component") { | 97 set_defaults("component") { |
75 configs = default_configs | 98 configs = default_configs |
76 if (!is_component_build) { | 99 if (!is_component_build) { |
77 complete_static_lib = true | 100 complete_static_lib = true |
78 } | 101 } |
79 } | 102 } |
80 | 103 |
81 # For now, we support GCC-like toolchains, including Clang. | 104 # For now, we support GCC-like toolchains, including Clang. |
82 set_default_toolchain("//gn:gcc_like") | 105 set_default_toolchain("//gn:gcc_like") |
OLD | NEW |