Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 1 | # Copyright (C) 2017 The Android Open Source Project |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | declare_args() { |
| 16 | is_debug = true |
| 17 | is_clang = true |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 18 | } |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 19 | |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 20 | declare_args() { |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 21 | ar = "ar" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | # Platform detection |
| 25 | if (target_os == "") { |
| 26 | target_os = host_os |
| 27 | } |
| 28 | if (current_os == "") { |
| 29 | current_os = target_os |
| 30 | } |
| 31 | |
| 32 | is_android = current_os == "android" |
| 33 | is_linux = current_os == "linux" |
Primiano Tucci | fffb124 | 2017-11-27 09:41:36 +0000 | [diff] [blame] | 34 | is_linux_host = host_os == "linux" |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 35 | is_mac = current_os == "mac" |
Bruce Dawson | 2af6ef7 | 2018-05-01 15:28:39 +0100 | [diff] [blame^] | 36 | # Building with Windows is currently only supported in the Chromium tree so |
| 37 | # always set this to false. |
| 38 | is_win = false |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 39 | |
| 40 | if (target_cpu == "") { |
| 41 | target_cpu = host_cpu |
| 42 | if (is_android) { |
| 43 | target_cpu = "arm" |
| 44 | } |
| 45 | } |
| 46 | if (current_cpu == "") { |
| 47 | current_cpu = target_cpu |
| 48 | } |
| 49 | |
| 50 | default_configs = [ |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 51 | "//gn/standalone:debug_symbols", |
| 52 | "//gn/standalone:default", |
| 53 | "//gn/standalone:extra_warnings", |
| 54 | "//gn/standalone:no_exceptions", |
| 55 | "//gn/standalone:no_rtti", |
Primiano Tucci | 5aab758 | 2017-12-07 12:22:03 +0000 | [diff] [blame] | 56 | "//gn/standalone:visibility_hidden", |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 57 | "//gn/standalone/libc++:config", |
| 58 | "//gn/standalone/sanitizers:sanitizers_cflags", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 59 | ] |
| 60 | |
| 61 | if (!is_debug) { |
Primiano Tucci | bc8318e | 2017-12-19 09:29:37 +0100 | [diff] [blame] | 62 | default_configs -= [ "//gn/standalone:debug_symbols" ] |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 63 | default_configs += [ "//gn/standalone:release" ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | set_defaults("source_set") { |
| 67 | configs = default_configs |
| 68 | } |
| 69 | |
| 70 | set_defaults("static_library") { |
| 71 | configs = default_configs |
| 72 | } |
| 73 | |
Primiano Tucci | 7278dea | 2017-10-31 11:50:32 +0000 | [diff] [blame] | 74 | # Realistically the only shared_library that we build right now is libc++.so |
| 75 | # when use_custom_libcxx=true (on Linux). Hence don't add a dependency on |
| 76 | # libc++ itself on these targets. |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 77 | set_defaults("shared_library") { |
| 78 | configs = default_configs |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 79 | configs += [ "//gn/standalone:shared_library" ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | set_defaults("executable") { |
| 83 | configs = default_configs |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 84 | configs += [ "//gn/standalone:executable" ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 85 | } |
| 86 | |
Primiano Tucci | 7a40e4d | 2017-12-06 09:51:09 +0000 | [diff] [blame] | 87 | set_default_toolchain("//gn/standalone/toolchain:gcc_like") |
| 88 | host_toolchain = "//gn/standalone/toolchain:gcc_like_host" |