• 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_perf = true
18with_ebpf_help_table = false
19is_mingw = false
20with_libunwind = false
21is_sdkdemo = false
22is_dubai_sdk = false
23is_sdkdemo_test = false
24is_spb = false
25target_cpu = "x64"
26declare_args() {
27  ar = "ar"
28  is_debug = true
29  use_wasm = false
30  is_test = false
31  is_sdkdemo = false
32  is_dubai_sdk = false
33  is_sdkdemo_test = false
34  testonly = false
35  is_fuzz = false
36  is_macx = false
37  is_spb = false
38  target = "trace_streamer"
39}
40if (target_os == "linux") {
41  is_linux = true
42} else if (target_os == "macx") {
43  is_macx = true
44} else if (target_os == "windows") {
45  is_win = true
46  is_mingw = true
47} else {
48  print("unknown platform " + target_os)
49  exit(-1)
50}
51
52if (target == "wasm") {
53  use_wasm = true
54} else if (target == "test") {
55  is_test = true
56  testonly = true
57} else if (target == "fuzz") {
58  is_fuzz = true
59  testonly = true
60} else if (target == "protoc") {
61  is_protoc = true
62} else if (target == "sdkdemo") {
63  is_sdkdemo = true
64  use_wasm = true
65} else if (target == "dubaisdk") {
66  is_dubai_sdk = true
67  use_wasm = true
68} else if (target == "sdkdemotest") {
69  is_sdkdemo_test = true
70  testonly = true
71} else if (target == "trace_streamer" || target == "streamer") {
72  print("build " + target)
73} else if (target == "spb") {
74  is_linux = true
75  is_spb = true
76} else {
77  print("unknown target " + target_os)
78  exit(-1)
79}
80
81trace_cfg_path = "//gn:trace_cfg"
82print("platform " + target_os)
83default_configs = [
84  "//gn:symbols",
85  "//gn:default",
86  trace_cfg_path,
87]
88hiperf_default_configs = [
89  "//gn:symbols",
90  "//gn:default",
91  "//gn:hiperf_trace_cfg",
92]
93
94set_defaults("static_library") {
95  configs = default_configs
96}
97if (!is_debug) {
98  default_configs -= [ "//gn:symbols" ]
99  default_configs += [ "//gn:release" ]
100  hiperf_default_configs -= [ "//gn:symbols" ]
101  hiperf_default_configs += [ "//gn:release" ]
102}
103if (is_debug) {
104  with_ebpf_help_table = true
105}
106
107set_defaults("ohos_source_set") {
108  configs = default_configs
109}
110
111# set_defaults("ohos_source_hiperf") {
112#   configs = hiperf_default_configs
113# }
114set_defaults("ohos_shared_library") {
115  configs = default_configs
116}
117set_defaults("executable") {
118  configs = default_configs
119  configs += [ "//gn:executable" ]
120}
121if (use_wasm) {
122  set_default_toolchain("//gn/toolchain:wasm")
123} else {
124  print(use_wasm)
125  set_default_toolchain("//gn/toolchain:gcc_like")
126}
127