blob: 4ef59cfcb32eb14ee53893c2ae514541ae1e1c7b [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"
Bruce Dawson2af6ef72018-05-01 15:28:39 +010036# Building with Windows is currently only supported in the Chromium tree so
37# always set this to false.
38is_win = false
Primiano Tucciae2879e2017-09-27 11:02:09 +090039
40if (target_cpu == "") {
41 target_cpu = host_cpu
42 if (is_android) {
43 target_cpu = "arm"
44 }
45}
46if (current_cpu == "") {
47 current_cpu = target_cpu
48}
49
50default_configs = [
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000051 "//gn/standalone:debug_symbols",
52 "//gn/standalone:default",
53 "//gn/standalone:extra_warnings",
54 "//gn/standalone:no_exceptions",
55 "//gn/standalone:no_rtti",
Primiano Tucci5aab7582017-12-07 12:22:03 +000056 "//gn/standalone:visibility_hidden",
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000057 "//gn/standalone/libc++:config",
58 "//gn/standalone/sanitizers:sanitizers_cflags",
Primiano Tucciae2879e2017-09-27 11:02:09 +090059]
60
61if (!is_debug) {
Primiano Tuccibc8318e2017-12-19 09:29:37 +010062 default_configs -= [ "//gn/standalone:debug_symbols" ]
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000063 default_configs += [ "//gn/standalone:release" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090064}
65
66set_defaults("source_set") {
67 configs = default_configs
68}
69
70set_defaults("static_library") {
71 configs = default_configs
72}
73
Primiano Tucci7278dea2017-10-31 11:50:32 +000074# 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 Tucciae2879e2017-09-27 11:02:09 +090077set_defaults("shared_library") {
78 configs = default_configs
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000079 configs += [ "//gn/standalone:shared_library" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090080}
81
82set_defaults("executable") {
83 configs = default_configs
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000084 configs += [ "//gn/standalone:executable" ]
Primiano Tucciae2879e2017-09-27 11:02:09 +090085}
86
Primiano Tucci7a40e4d2017-12-06 09:51:09 +000087set_default_toolchain("//gn/standalone/toolchain:gcc_like")
88host_toolchain = "//gn/standalone/toolchain:gcc_like_host"