# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/ohos.gni") import("../protos.gni") ####################################################### proto_out_dir = "$root_gen_dir/cpp/" + rebase_path(".", "//") proto_rel_out_dir = rebase_path(proto_out_dir, root_build_dir) config("public_configs") { include_dirs = [ "$proto_out_dir" ] } ####################################################### all_type_proto = [ "./common_types.proto", "./profiler_service_types.proto", "./plugin_service_types.proto", ] all_type_codegen = [] all_type_codegen_standard = [] all_type_codegen_reader = [] all_type_codegen_all = [] foreach(proto, all_type_proto) { name = get_path_info(proto, "name") all_type_codegen += [ "$proto_out_dir/$name.pb.h", "$proto_out_dir/$name.pb.cc", ] all_type_codegen_reader += [ "$proto_out_dir/$name.pbreader.h" ] } all_type_codegen_all += all_type_codegen all_type_codegen_all += all_type_codegen_standard all_type_codegen_all += all_type_codegen_reader action("ts_all_type_gen") { script = "${OHOS_TRACE_STREAMER_DIR_PROTOC}" sources = all_type_proto outputs = all_type_codegen_all args = [ "$libc_dir_proto", "$root_output_dir_proto", "$proto_rel_out_dir", # standard proto file destination path "--cpp_out", "$proto_rel_out_dir", "--proto_path", rebase_path(".", root_build_dir), ] args += rebase_path(sources, root_build_dir) if (!use_wasm && !is_test && !is_fuzz) { deps = [ "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protoc(${host_toolchain})", "${SRC}/proto_reader/protoc_plugin:protoreader_plugin(${host_toolchain})", ] } } ohos_source_set("ts_all_type_cpp_standard") { deps = [ ":ts_all_type_gen" ] public_deps = [ "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protobuf_lite_static", "${OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR}:protobuf_static", ] include_dirs = [ "$proto_out_dir" ] public_configs = [ ":public_configs" ] sources = all_type_codegen_standard subsystem_name = "developtools" part_name = "smartperf_host" }