| 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 ndk = "" |
| 12 ndk_api = 0 # 0 == picked automatically for target_cpu. |
| 12 sanitize = "" | 13 sanitize = "" |
| 13 } | 14 } |
| 14 | 15 |
| 15 # Platform detection | 16 # Platform detection |
| 16 if (target_os == "") { | 17 if (target_os == "") { |
| 17 target_os = host_os | 18 target_os = host_os |
| 18 if (ndk != "") { | 19 if (ndk != "") { |
| 19 target_os = "android" | 20 target_os = "android" |
| 20 } | 21 } |
| 21 } | 22 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 } | 39 } |
| 39 if (current_cpu == "") { | 40 if (current_cpu == "") { |
| 40 current_cpu = target_cpu | 41 current_cpu = target_cpu |
| 41 } | 42 } |
| 42 | 43 |
| 43 if (is_android) { | 44 if (is_android) { |
| 44 ndk_host = "" | 45 ndk_host = "" |
| 45 ndk_target = "" | 46 ndk_target = "" |
| 46 ndk_platform = "" | 47 ndk_platform = "" |
| 47 ndk_stdlib = "" | 48 ndk_stdlib = "" |
| 48 nkd_gccdir = "" | 49 ndk_gccdir = "" |
| 50 |
| 51 if (ndk_api == 0) { |
| 52 ndk_api = 18 |
| 53 if (target_cpu == "arm64" || target_cpu == "mips64el" || |
| 54 target_cpu == "x64") { |
| 55 ndk_api = 21 |
| 56 } |
| 57 } |
| 49 | 58 |
| 50 if (host_os == "linux") { | 59 if (host_os == "linux") { |
| 51 ndk_host = "linux-x86_64" | 60 ndk_host = "linux-x86_64" |
| 52 } else if (host_os == "mac") { | 61 } else if (host_os == "mac") { |
| 53 ndk_host = "darwin-x86_64" | 62 ndk_host = "darwin-x86_64" |
| 54 } | 63 } |
| 55 | 64 |
| 56 if (target_cpu == "arm64") { | 65 if (target_cpu == "arm64") { |
| 57 ndk_target = "aarch64-linux-android" | 66 ndk_target = "aarch64-linux-android" |
| 58 ndk_platform = "android-21/arch-arm64" | 67 ndk_platform = "android-${ndk_api}/arch-arm64" |
| 59 ndk_stdlib = "arm64-v8a" | 68 ndk_stdlib = "arm64-v8a" |
| 60 ndk_gccdir = ndk_target | 69 ndk_gccdir = ndk_target |
| 61 } else if (target_cpu == "arm") { | 70 } else if (target_cpu == "arm") { |
| 62 ndk_target = "arm-linux-androideabi" | 71 ndk_target = "arm-linux-androideabi" |
| 63 ndk_platform = "android-18/arch-arm" | 72 ndk_platform = "android-${ndk_api}/arch-arm" |
| 64 ndk_stdlib = "armeabi-v7a" | 73 ndk_stdlib = "armeabi-v7a" |
| 65 ndk_gccdir = ndk_target | 74 ndk_gccdir = ndk_target |
| 66 } else if (target_cpu == "mips64el") { | 75 } else if (target_cpu == "mips64el") { |
| 67 ndk_target = "mips64el-linux-android" | 76 ndk_target = "mips64el-linux-android" |
| 68 ndk_platform = "android-21/arch-mips64" | 77 ndk_platform = "android-${ndk_api}/arch-mips64" |
| 69 ndk_stdlib = "mips64" | 78 ndk_stdlib = "mips64" |
| 70 ndk_gccdir = ndk_target | 79 ndk_gccdir = ndk_target |
| 71 } else if (target_cpu == "mipsel") { | 80 } else if (target_cpu == "mipsel") { |
| 72 ndk_target = "mipsel-linux-android" | 81 ndk_target = "mipsel-linux-android" |
| 73 ndk_platform = "android-18/arch-mips" | 82 ndk_platform = "android-${ndk_api}/arch-mips" |
| 74 ndk_stdlib = "mips" | 83 ndk_stdlib = "mips" |
| 75 ndk_gccdir = ndk_target | 84 ndk_gccdir = ndk_target |
| 76 } else if (target_cpu == "x64") { | 85 } else if (target_cpu == "x64") { |
| 77 ndk_target = "x86_64-linux-android" | 86 ndk_target = "x86_64-linux-android" |
| 78 ndk_platform = "android-21/arch-x86_64" | 87 ndk_platform = "android-${ndk_api}/arch-x86_64" |
| 79 ndk_stdlib = "x86_64" | 88 ndk_stdlib = "x86_64" |
| 80 ndk_gccdir = ndk_stdlib | 89 ndk_gccdir = ndk_stdlib |
| 81 } else if (target_cpu == "x86") { | 90 } else if (target_cpu == "x86") { |
| 82 ndk_target = "i686-linux-android" | 91 ndk_target = "i686-linux-android" |
| 83 ndk_platform = "android-18/arch-x86" | 92 ndk_platform = "android-${ndk_api}/arch-x86" |
| 84 ndk_stdlib = "x86" | 93 ndk_stdlib = "x86" |
| 85 ndk_gccdir = ndk_stdlib | 94 ndk_gccdir = ndk_stdlib |
| 86 } | 95 } |
| 87 } | 96 } |
| 88 | 97 |
| 89 # A component is either a static or a shared library. | 98 # A component is either a static or a shared library. |
| 90 template("component") { | 99 template("component") { |
| 91 _component_mode = "static_library" | 100 _component_mode = "static_library" |
| 92 if (is_component_build) { | 101 if (is_component_build) { |
| 93 _component_mode = "shared_library" | 102 _component_mode = "shared_library" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 134 |
| 126 set_defaults("component") { | 135 set_defaults("component") { |
| 127 configs = default_configs | 136 configs = default_configs |
| 128 if (!is_component_build) { | 137 if (!is_component_build) { |
| 129 complete_static_lib = true | 138 complete_static_lib = true |
| 130 } | 139 } |
| 131 } | 140 } |
| 132 | 141 |
| 133 # For now, we support GCC-like toolchains, including Clang. | 142 # For now, we support GCC-like toolchains, including Clang. |
| 134 set_default_toolchain("//gn:gcc_like") | 143 set_default_toolchain("//gn:gcc_like") |
| OLD | NEW |