blob: ca37675b267400daf693777d420710712c3a220f [file] [log] [blame]
Primiano Tucciae2879e2017-09-27 11:02:09 +09001# 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
15declare_args() {
16 is_debug = true
17 is_clang = true
Primiano Tucci0825bc82017-09-28 18:50:23 +010018}
Primiano Tucciae2879e2017-09-27 11:02:09 +090019
Primiano Tucci0825bc82017-09-28 18:50:23 +010020declare_args() {
Primiano Tucciae2879e2017-09-27 11:02:09 +090021 ar = "ar"
Primiano Tucciae2879e2017-09-27 11:02:09 +090022}
23
24# Platform detection
25if (target_os == "") {
26 target_os = host_os
27}
28if (current_os == "") {
29 current_os = target_os
30}
31
32is_android = current_os == "android"
33is_linux = current_os == "linux"
Primiano Tuccifffb1242017-11-27 09:41:36 +000034is_linux_host = host_os == "linux"
Primiano Tucciae2879e2017-09-27 11:02:09 +090035is_mac = current_os == "mac"
36
37if (target_cpu == "") {
38 target_cpu = host_cpu
39 if (is_android) {
40 target_cpu = "arm"
41 }
42}
43if (current_cpu == "") {
44 current_cpu = target_cpu
45}
46
47default_configs = [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000048 "//gn/standalone:debug_symbols",
49 "//gn/standalone:default",
50 "//gn/standalone:extra_warnings",
51 "//gn/standalone:no_exceptions",
52 "//gn/standalone:no_rtti",
Primiano Tucci5aab7582017-12-07 12:22:03 +000053 "//gn/standalone:visibility_hidden",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000054 "//gn/standalone/libc++:config",
55 "//gn/standalone/sanitizers:sanitizers_cflags",
Primiano Tucciae2879e2017-09-27 11:02:09 +090056]
57
58if (!is_debug) {
Primiano Tuccibc8318e2017-12-19 09:29:37 +010059 default_configs -= [ "//gn/standalone:debug_symbols" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000060 default_configs += [ "//gn/standalone:release" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090061}
62
63set_defaults("source_set") {
64 configs = default_configs
65}
66
67set_defaults("static_library") {
68 configs = default_configs
69}
70
Primiano Tucci7278dea2017-10-31 11:50:32 +000071# 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 Tucciae2879e2017-09-27 11:02:09 +090074set_defaults("shared_library") {
75 configs = default_configs
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000076 configs += [ "//gn/standalone:shared_library" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090077}
78
79set_defaults("executable") {
80 configs = default_configs
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000081 configs += [ "//gn/standalone:executable" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090082}
83
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000084set_default_toolchain("//gn/standalone/toolchain:gcc_like")
85host_toolchain = "//gn/standalone/toolchain:gcc_like_host"