blob: e2719c196e184e5ce315bfaad179fb2f00168ac4 [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
halcanary19a97202016-08-03 15:08:04 -070043default_configs = [
44 "//gn:default",
45 "//gn:no_rtti",
46]
mtklein7fbfbbe2016-07-21 12:25:45 -070047if (!is_debug) {
halcanary19a97202016-08-03 15:08:04 -070048 default_configs += [ "//gn:release" ]
mtklein7fbfbbe2016-07-21 12:25:45 -070049}
50
51set_defaults("executable") {
halcanary19a97202016-08-03 15:08:04 -070052 configs = default_configs + [ "//gn:executable" ]
mtklein7fbfbbe2016-07-21 12:25:45 -070053}
54
55set_defaults("source_set") {
halcanary19a97202016-08-03 15:08:04 -070056 configs = default_configs
mtklein7fbfbbe2016-07-21 12:25:45 -070057}
58
59set_defaults("static_library") {
halcanary19a97202016-08-03 15:08:04 -070060 configs = default_configs
mtklein7fbfbbe2016-07-21 12:25:45 -070061}
62
63set_defaults("shared_library") {
halcanary19a97202016-08-03 15:08:04 -070064 configs = default_configs
mtklein7fbfbbe2016-07-21 12:25:45 -070065}
66
67set_defaults("component") {
halcanary19a97202016-08-03 15:08:04 -070068 configs = default_configs
mtklein7fbfbbe2016-07-21 12:25:45 -070069}
70
71# For now, we support GCC-like toolchains, including Clang.
72set_default_toolchain("//gn:gcc_like")