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 18 } 19 20 declare_args() { 21 ar = "ar" 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" 34 is_linux_host = host_os == "linux" 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 = [ 48 "//gn/standalone:debug_symbols", 49 "//gn/standalone:default", 50 "//gn/standalone:extra_warnings", 51 "//gn/standalone:no_exceptions", 52 "//gn/standalone:no_rtti", 53 "//gn/standalone:visibility_hidden", 54 "//gn/standalone/libc++:config", 55 "//gn/standalone/sanitizers:sanitizers_cflags", 56 ] 57 58 if (!is_debug) { 59 default_configs -= [ "//gn/standalone:debug_symbols" ] 60 default_configs += [ "//gn/standalone:release" ] 61 } 62 63 set_defaults("source_set") { 64 configs = default_configs 65 } 66 67 set_defaults("static_library") { 68 configs = default_configs 69 } 70 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. 74 set_defaults("shared_library") { 75 configs = default_configs 76 configs += [ "//gn/standalone:shared_library" ] 77 } 78 79 set_defaults("executable") { 80 configs = default_configs 81 configs += [ "//gn/standalone:executable" ] 82 } 83 84 set_default_toolchain("//gn/standalone/toolchain:gcc_like") 85 host_toolchain = "//gn/standalone/toolchain:gcc_like_host" 86