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_sdk_builtin") { 21 subsystem_name = "trace_streamer" 22 part_name = "trace_streamer_sdk_builtin" 23 sources = [] 24 include_dirs = [] 25 deps = [] 26 } 27} 28ohos_source_set("lib") { 29 subsystem_name = "trace_streamer" 30 part_name = "lib" 31 sources = [ 32 "main.cpp", 33 "version.cpp", 34 ] 35 deps = [ 36 ":trace_streamer_sdk", 37 "${THIRD_PARTY}/protobuf:protobuf_lite_static", 38 "${THIRD_PARTY}/protobuf:protobuf_static", 39 ] 40 include_dirs = [ 41 "${SRC}/base", 42 "..", 43 "trace_streamer", 44 "table", 45 "trace_data", 46 "include", 47 "plugin", 48 "rpc", 49 "./", 50 "cfg", 51 "${THIRD_PARTY}/sqlite/include", 52 "${THIRD_PARTY}/protobuf/src", 53 ] 54 public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ] 55} 56ohos_source_set("trace_streamer_sdk") { 57 subsystem_name = "trace_streamer" 58 part_name = "trace_streamer_sdk" 59 sources = [ 60 "rpc/demo_rpc_server.cpp", 61 "rpc/demo_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/demo_meta_table.cpp", 67 "table/demo_meta_table.h", 68 "table/demo_table_base.cpp", 69 "table/gpu_counter_object_table.cpp", 70 "table/gpu_counter_object_table.h", 71 "table/gpu_counter_table.cpp", 72 "table/gpu_counter_table.h", 73 "table/slice_object_table.cpp", 74 "table/slice_object_table.h", 75 "table/slice_table.cpp", 76 "table/slice_table.h", 77 "trace_data/demo_trace_data_cache_reader.cpp", 78 "trace_data/demo_trace_data_cache_reader.h", 79 "trace_data/demo_trace_data_cache_writer.cpp", 80 "trace_data/demo_trace_data_cache_writer.h", 81 "trace_data/demo_trace_data_db.cpp", 82 "trace_data/demo_trace_data_db.h", 83 "trace_data/trace_data_cache.cpp", 84 "trace_data/trace_data_cache.h", 85 "trace_data/trace_data_cache_base.cpp", 86 "trace_data/trace_data_cache_base.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 "${THIRD_PARTY}/bounds_checking_function/include", 109 ] 110 if (!use_wasm) { 111 include_dirs += [ 112 "${THIRD_PARTY}/libunwind/include", 113 "${THIRD_PARTY}/libunwind/src", 114 ] 115 } 116 deps = [ 117 "${SRC}/base:base", 118 "${THIRD_PARTY}/bounds_checking_function:libsec_static", 119 "${THIRD_PARTY}/sqlite:sqlite", 120 "plugin:sdk_plugin", 121 ] 122 public_deps = [ "protos/types/plugins/mock_data:mock_data_cpp" ] 123 124 if (use_wasm || enable_ts_utest) { 125 sources += [ 126 "sdk/wasm_func.cpp", 127 "sdk/wasm_func.h", 128 ] 129 } 130 cflags = [ "-std=c++17" ] 131 if (enable_ts_utest && !use_wasm) { 132 cflags = [ 133 "-fprofile-arcs", 134 "-ftest-coverage", 135 "-std=c++17", 136 ] 137 ldflags = [ 138 "-fprofile-arcs", 139 "-ftest-coverage", 140 "--coverage", 141 ] 142 } 143} 144if (use_wasm) { 145 wasm_lib("trace_streamer_sdk_builtin_wasm") { 146 name = "trace_streamer_sdk_builtin" 147 deps = [ ":lib" ] 148 } 149} else { 150 if (!is_test && !is_fuzz) { 151 executable("trace_streamer111") { 152 deps = [ ":lib" ] 153 } 154 } 155} 156