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