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. 13 14import("//build/ohos.gni") 15import("../../build/ts.gni") 16if (use_wasm) { 17 import("../../gn/wasm.gni") 18} 19if (use_wasm) { 20 ohos_source_set("trace_streamer_dubai_builtin") { 21 subsystem_name = "trace_streamer" 22 part_name = "trace_streamer_dubai_builtin" 23 sources = [] 24 include_dirs = [] 25 deps = [] 26 public_deps = [] 27 } 28} 29ohos_source_set("lib") { 30 subsystem_name = "trace_streamer" 31 part_name = "lib" 32 sources = [ 33 "main.cpp", 34 "version.cpp", 35 ] 36 deps = [ 37 ":trace_streamer_sdk", 38 "${THIRD_PARTY}/protobuf:protobuf_lite_static", 39 "${THIRD_PARTY}/protobuf:protobuf_static", 40 ] 41 include_dirs = [ 42 "${SRC}/base", 43 "..", 44 "trace_streamer", 45 "table", 46 "trace_data", 47 "include", 48 "plugin", 49 "rpc", 50 "./", 51 "cfg", 52 "${THIRD_PARTY}/sqlite/include", 53 "${THIRD_PARTY}/protobuf/src", 54 ] 55 public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ] 56} 57source_set("trace_streamer_sdk") { 58 sources = [ 59 "rpc/http_socket.cpp", 60 "rpc/rpc_server.cpp", 61 "rpc/rpc_server.h", 62 "sdk/sdk_data_parser.cpp", 63 "sdk/sdk_data_parser.h", 64 "sdk/ts_sdk_api.cpp", 65 "sdk/ts_sdk_api.h", 66 "table/gpu_counter_object_table.cpp", 67 "table/gpu_counter_object_table.h", 68 "table/gpu_counter_table.cpp", 69 "table/gpu_counter_table.h", 70 "table/meta_table.cpp", 71 "table/meta_table.h", 72 "table/slice_object_table.cpp", 73 "table/slice_object_table.h", 74 "table/slice_table.cpp", 75 "table/slice_table.h", 76 "table/table_base.cpp", 77 "trace_data/trace_data_cache.cpp", 78 "trace_data/trace_data_cache.h", 79 "trace_data/trace_data_cache_base.cpp", 80 "trace_data/trace_data_cache_base.h", 81 "trace_data/trace_data_cache_reader.cpp", 82 "trace_data/trace_data_cache_reader.h", 83 "trace_data/trace_data_cache_writer.cpp", 84 "trace_data/trace_data_cache_writer.h", 85 "trace_data/trace_data_db.cpp", 86 "trace_data/trace_data_db.h", 87 "trace_data/trace_stdtype.cpp", 88 "trace_data/trace_stdtype.h", 89 "trace_streamer/trace_streamer_selector.cpp", 90 "trace_streamer/trace_streamer_selector.h", 91 ] 92 include_dirs = [ 93 "${SRC}/base", 94 "..", 95 "trace_streamer", 96 "filter", 97 "table", 98 "trace_data", 99 "include", 100 "plugin", 101 "rpc", 102 "sdk", 103 "./", 104 "cfg", 105 "${THIRD_PARTY}/sqlite/include", 106 "${THIRD_PARTY}/protobuf/src", 107 "${THIRD_PARTY}/json/single_include/nlohmann", 108 ] 109 if (!use_wasm) { 110 include_dirs += [ 111 "${THIRD_PARTY}/libunwind/include", 112 "${THIRD_PARTY}/libunwind/src", 113 ] 114 } 115 deps = [ 116 "${SRC}/base:base", 117 "${THIRD_PARTY}/bounds_checking_function:libsec_static", 118 "${THIRD_PARTY}/sqlite:sqlite", 119 "plugin:sdk_plugin", 120 ] 121 122 if (use_wasm || enable_ts_utest) { 123 sources += [ 124 "sdk/wasm_func.cpp", 125 "sdk/wasm_func.h", 126 ] 127 } 128 cflags = [ "-std=c++17" ] 129 if (enable_ts_utest && !use_wasm) { 130 cflags = [ 131 "-fprofile-arcs", 132 "-ftest-coverage", 133 ] 134 ldflags = [ 135 "-fprofile-arcs", 136 "-ftest-coverage", 137 "--coverage", 138 ] 139 } 140 public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ] 141} 142if (use_wasm) { 143 wasm_lib("trace_streamer_dubai_builtin_wasm") { 144 name = "trace_streamer_dubai_builtin" 145 deps = [ ":lib" ] 146 } 147} else { 148 if (!is_test && !is_fuzz) { 149 executable("trace_streamer") { 150 deps = [ ":lib" ] 151 } 152 } 153} 154