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 is_system_compiler = false 19 is_lto = false 20 21 extra_cflags = "" 22 extra_cxxflags = "" 23 extra_ldflags = "" 24 } 25 26 declare_args() { 27 ar = "ar" 28 } 29 30 # Platform detection 31 if (target_os == "") { 32 target_os = host_os 33 } 34 if (current_os == "") { 35 current_os = target_os 36 } 37 38 is_android = current_os == "android" 39 is_linux = current_os == "linux" 40 is_linux_host = host_os == "linux" 41 is_mac = current_os == "mac" 42 43 # Building with Windows/Fuchsia is currently only supported in the Chromium 44 # tree so always set this to false. 45 is_win = false 46 is_fuchsia = false 47 48 if (target_cpu == "") { 49 target_cpu = host_cpu 50 if (is_android) { 51 target_cpu = "arm" 52 } 53 } 54 if (current_cpu == "") { 55 current_cpu = target_cpu 56 } 57 58 default_configs = [ 59 "//gn/standalone:debug_symbols", 60 "//gn/standalone:default", 61 "//gn/standalone:c++11", 62 "//gn/standalone:extra_warnings", 63 "//gn/standalone:no_exceptions", 64 "//gn/standalone:no_rtti", 65 "//gn/standalone:visibility_hidden", 66 "//gn/standalone/libc++:config", 67 "//gn/standalone/sanitizers:sanitizers_cflags", 68 ] 69 70 if (!is_debug) { 71 default_configs -= [ "//gn/standalone:debug_symbols" ] 72 default_configs += [ "//gn/standalone:release" ] 73 } 74 75 set_defaults("source_set") { 76 configs = default_configs 77 } 78 79 set_defaults("static_library") { 80 configs = default_configs 81 } 82 83 # Realistically the only shared_library that we build right now is libc++.so 84 # when use_custom_libcxx=true (on Linux). Hence don't add a dependency on 85 # libc++ itself on these targets. 86 set_defaults("shared_library") { 87 configs = default_configs 88 configs += [ "//gn/standalone:shared_library" ] 89 90 # note: the following is not a nested config to be removable. 91 configs += [ "//gn/standalone:android_liblog" ] 92 } 93 94 set_defaults("executable") { 95 configs = default_configs 96 configs += [ "//gn/standalone:executable" ] 97 98 # note: the following is not a nested config to be removable. 99 configs += [ "//gn/standalone:android_liblog" ] 100 } 101 102 set_default_toolchain("//gn/standalone/toolchain:gcc_like") 103 host_toolchain = "//gn/standalone/toolchain:gcc_like_host" 104