blob: 681b15b83bad2ce2a2a783c45a3ae79a7cee0765 [file] [log] [blame]
mtklein7fbfbbe2016-07-21 12:25:45 -07001# Copyright 2016 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6# It's best to keep the names and defaults of is_foo flags consistent with Chrome.
7
8declare_args() {
9 is_debug = true
10 is_component_build = false
11}
12
13# Platform detection
14if (target_os == "") {
15 target_os = host_os
16}
17if (current_os == "") {
18 current_os = target_os
19}
20
21is_android = current_os == "android"
22is_fuchsia = current_os == "fuchsia"
23is_ios = current_os == "ios"
24is_linux = current_os == "linux"
25is_mac = current_os == "mac"
26is_win = current_os == "win"
27
28is_posix = !is_win
29
mtklein5db44aa2016-07-29 09:10:31 -070030# A component is either a static or a shared library.
mtklein7fbfbbe2016-07-21 12:25:45 -070031template("component") {
mtklein5db44aa2016-07-29 09:10:31 -070032 _component_mode = "static_library"
mtklein7fbfbbe2016-07-21 12:25:45 -070033 if (is_component_build) {
34 _component_mode = "shared_library"
35 }
36
37 target(_component_mode, target_name) {
38 forward_variables_from(invoker, "*")
39 }
40}
41
42# Default configs
43_default_configs = [ "//gn:default" ]
44if (!is_debug) {
45 _default_configs += [ "//gn:release" ]
46}
47
48set_defaults("executable") {
49 configs = _default_configs + [ "//gn:executable" ]
50}
51
52set_defaults("source_set") {
53 configs = _default_configs
54}
55
56set_defaults("static_library") {
57 configs = _default_configs
58}
59
60set_defaults("shared_library") {
61 configs = _default_configs
62}
63
64set_defaults("component") {
65 configs = _default_configs
66}
67
68# For now, we support GCC-like toolchains, including Clang.
69set_default_toolchain("//gn:gcc_like")