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_sdkdemo_test = false 23target_cpu = "x64" 24declare_args() { 25 ar = "ar" 26 is_debug = true 27 use_wasm = false 28 is_test = false 29 is_sdkdemo = false 30 is_sdkdemo_test = false 31 testonly = false 32 is_fuzz = false 33 is_macx = false 34 target = "trace_streamer" 35} 36if (target_os == "linux") { 37 is_linux = true 38} else if (target_os == "macx") { 39 is_macx = true 40} else if (target_os == "windows") { 41 is_win = true 42 is_mingw = true 43} else { 44 print("unknown platform " + target_os) 45 exit(-1) 46} 47 48if (target == "wasm") { 49 use_wasm = true 50} else if (target == "test") { 51 is_test = true 52 testonly = true 53} else if (target == "fuzz") { 54 is_fuzz = true 55 testonly = true 56} else if (target == "protoc") { 57 is_protoc = true 58} else if (target == "sdkdemo") { 59 is_sdkdemo = true 60 use_wasm = true 61} else if (target == "sdkdemotest") { 62 is_sdkdemo_test = true 63 testonly = true 64} else if (target == "trace_streamer" || target == "streamer") { 65 print("build " + target) 66} else { 67 print("unknown target " + target_os) 68 exit(-1) 69} 70 71print("platform " + target_os) 72default_configs = [ 73 "//gn:symbols", 74 "//gn:default", 75 "//gn:trace_cfg", 76] 77 78set_defaults("static_library") { 79 configs = default_configs 80} 81if (!is_debug) { 82 default_configs -= [ "//gn:symbols" ] 83 default_configs += [ "//gn:release" ] 84} 85if (is_debug) { 86 with_ebpf_help_table = true 87} 88 89set_defaults("ohos_source_set") { 90 configs = default_configs 91} 92set_defaults("ohos_shared_library") { 93 configs = default_configs 94} 95set_defaults("executable") { 96 configs = default_configs 97 configs += [ "//gn:executable" ] 98} 99if (use_wasm) { 100 set_default_toolchain("//gn/toolchain:wasm") 101} else { 102 print(use_wasm) 103 set_default_toolchain("//gn/toolchain:gcc_like") 104} 105