• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13is_win = false
14is_linux = false
15is_macx = false
16is_protoc = false
17with_ebpf_help_table = false
18is_mingw = false
19with_libunwind = false
20is_sdkdemo = false
21is_dubai_sdk = false
22is_sdkdemo_test = false
23is_spb = false
24target_cpu = "x64"
25declare_args() {
26  ar = "ar"
27  is_debug = true
28  use_wasm = false
29  is_test = false
30  is_sdkdemo = false
31  is_dubai_sdk = false
32  is_sdkdemo_test = false
33  testonly = false
34  is_fuzz = false
35  is_macx = false
36  is_spb = false
37  target = "trace_streamer"
38}
39if (target_os == "linux") {
40  is_linux = true
41} else if (target_os == "macx") {
42  is_macx = true
43} else if (target_os == "windows") {
44  is_win = true
45  is_mingw = true
46} else {
47  print("unknown platform " + target_os)
48  exit(-1)
49}
50
51if (target == "wasm") {
52  use_wasm = true
53} else if (target == "test") {
54  is_test = true
55  testonly = true
56} else if (target == "fuzz") {
57  is_fuzz = true
58  testonly = true
59} else if (target == "protoc") {
60  is_protoc = true
61} else if (target == "sdkdemo") {
62  is_sdkdemo = true
63  use_wasm = true
64} else if (target == "dubaisdk") {
65  is_dubai_sdk = true
66  use_wasm = true
67} else if (target == "sdkdemotest") {
68  is_sdkdemo_test = true
69  testonly = true
70} else if (target == "trace_streamer" || target == "streamer") {
71  print("build " + target)
72} else if (target == "spb") {
73  is_linux = true
74  is_spb = true
75} else {
76  print("unknown target " + target_os)
77  exit(-1)
78}
79
80trace_cfg_path = "//gn:trace_cfg"
81print("platform " + target_os)
82default_configs = [
83  "//gn:symbols",
84  "//gn:default",
85  trace_cfg_path,
86]
87hiperf_default_configs = [
88  "//gn:symbols",
89  "//gn:default",
90  "//gn:hiperf_trace_cfg",
91]
92
93set_defaults("static_library") {
94  configs = default_configs
95}
96if (!is_debug) {
97  default_configs -= [ "//gn:symbols" ]
98  default_configs += [ "//gn:release" ]
99  hiperf_default_configs -= [ "//gn:symbols" ]
100  hiperf_default_configs += [ "//gn:release" ]
101}
102if (is_debug) {
103  with_ebpf_help_table = true
104}
105
106set_defaults("ohos_source_set") {
107  configs = default_configs
108}
109
110# set_defaults("ohos_source_hiperf") {
111#   configs = hiperf_default_configs
112# }
113set_defaults("ohos_shared_library") {
114  configs = default_configs
115}
116set_defaults("executable") {
117  configs = default_configs
118  configs += [ "//gn:executable" ]
119}
120if (use_wasm) {
121  set_default_toolchain("//gn/toolchain:wasm")
122} else {
123  print(use_wasm)
124  set_default_toolchain("//gn/toolchain:gcc_like")
125}
126