1# Copyright (c) Huawei Technologies Co., Ltd. 2021. 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.
13
14import("//build/ohos.gni")
15import("../base/config.gni")
16import("../plugins/ftrace_plugin/ftrace.gni")
17
18ohos_source_set("command_line") {
19  part_name = "${OHOS_PROFILER_PART_NAME}"
20  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
21  sources = [
22    "src/command_line.cpp",
23    "src/command_param.cpp",
24    "src/command_param_switch.cpp",
25    "src/command_param_text.cpp",
26  ]
27  include_dirs = [ "include" ]
28}
29ohos_executable("hiprofiler_cmd") {
30  sources = [
31    "src/main.cpp",
32    "src/parse_plugin_config.cpp",
33  ]
34  include_dirs = [ "include" ]
35  deps = [
36    ":command_line",
37    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_base",
38    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_proto",
39    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_type_source",
40    "${OHOS_PROFILER_DIR}/protos/types/plugins/cpu_data:cpu_plugin_config_cpp_standard",
41    "${OHOS_PROFILER_DIR}/protos/types/plugins/diskio_data:diskio_plugin_config_cpp_standard",
42    "${OHOS_PROFILER_DIR}/protos/types/plugins/ffrt_profiler:ffrt_profiler_cpp_standard",
43    "${OHOS_PROFILER_DIR}/protos/types/plugins/ftrace_data/${device_kernel_version}:ftrace_plugin_config_cpp_standard",
44    "${OHOS_PROFILER_DIR}/protos/types/plugins/gpu_data:gpu_plugin_config_cpp_standard",
45    "${OHOS_PROFILER_DIR}/protos/types/plugins/hidump_data:hidump_plugin_config_cpp_standard",
46    "${OHOS_PROFILER_DIR}/protos/types/plugins/hiebpf_data:hiebpf_data_cpp_standard",
47    "${OHOS_PROFILER_DIR}/protos/types/plugins/hilog_data:hilog_plugin_config_cpp_standard",
48    "${OHOS_PROFILER_DIR}/protos/types/plugins/hiperf_data:hiperf_data_cpp_standard",
49    "${OHOS_PROFILER_DIR}/protos/types/plugins/hisysevent_data:hisysevent_plugin_config_cpp_standard",
50    "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_plugin_config_cpp_standard",
51    "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_plugin_config_cpp_standard",
52    "${OHOS_PROFILER_DIR}/protos/types/plugins/network_data:network_plugin_config_cpp_standard",
53    "${OHOS_PROFILER_DIR}/protos/types/plugins/network_profiler:network_profiler_cpp_standard",
54    "${OHOS_PROFILER_DIR}/protos/types/plugins/process_data:process_plugin_config_cpp_standard",
55    "${OHOS_PROFILER_DIR}/protos/types/plugins/xpower_data:xpower_plugin_config_cpp_standard",
56  ]
57  external_deps = [
58    "abseil-cpp:absl_sync",
59    "grpc:grpc",
60    "grpc:grpcxx",
61    "init:libbegetutil",
62    "protobuf:protobuf_lite",
63  ]
64  if (current_toolchain != host_toolchain) {
65    defines = [ "HAVE_HILOG" ]
66    external_deps += [ "hilog:libhilog_base" ]
67  }
68  install_enable = true
69  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
70  part_name = "${OHOS_PROFILER_PART_NAME}"
71}
72