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" |
| 36 | |
| 37 | if (target_cpu == "") { |
| 38 | target_cpu = host_cpu |
| 39 | if (is_android) { |
| 40 | target_cpu = "arm" |
| 41 | } |
| 42 | } |
| 43 | if (current_cpu == "") { |
| 44 | current_cpu = target_cpu |
| 45 | } |
| 46 | |
| 47 | default_configs = [ |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 48 | "//build:debug_symbols", |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 49 | "//build:default", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 50 | "//build:extra_warnings", |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 51 | "//build:no_exceptions", |
| 52 | "//build:no_rtti", |
Primiano Tucci | 7278dea | 2017-10-31 11:50:32 +0000 | [diff] [blame] | 53 | "//build/libc++:config", |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 54 | "//build/sanitizers:sanitizers_cflags", |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 55 | ] |
| 56 | |
| 57 | if (!is_debug) { |
| 58 | default_configs += [ "//build:release" ] |
| 59 | } |
| 60 | |
| 61 | set_defaults("source_set") { |
| 62 | configs = default_configs |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 63 | deps = [] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | set_defaults("static_library") { |
| 67 | configs = default_configs |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 68 | deps = [] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 69 | } |
| 70 | |
Primiano Tucci | 7278dea | 2017-10-31 11:50:32 +0000 | [diff] [blame] | 71 | # Realistically the only shared_library that we build right now is libc++.so |
| 72 | # when use_custom_libcxx=true (on Linux). Hence don't add a dependency on |
| 73 | # libc++ itself on these targets. |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 74 | set_defaults("shared_library") { |
| 75 | configs = default_configs |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 76 | configs += [ "//build:shared_library" ] |
| 77 | deps = [ |
Primiano Tucci | 7278dea | 2017-10-31 11:50:32 +0000 | [diff] [blame] | 78 | "//build/sanitizers:deps", |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 79 | ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | set_defaults("executable") { |
| 83 | configs = default_configs |
| 84 | configs += [ "//build:executable" ] |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 85 | deps = [ |
Primiano Tucci | 7278dea | 2017-10-31 11:50:32 +0000 | [diff] [blame] | 86 | "//build/libc++:deps", |
| 87 | "//build/sanitizers:deps", |
Primiano Tucci | 0825bc8 | 2017-09-28 18:50:23 +0100 | [diff] [blame] | 88 | ] |
Primiano Tucci | ae2879e | 2017-09-27 11:02:09 +0900 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | set_default_toolchain("//build/toolchain:gcc_like") |
| 92 | host_toolchain = "//build/toolchain:gcc_like_host" |