106f6ba60Sopenharmony_ci# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
206f6ba60Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
306f6ba60Sopenharmony_ci# you may not use this file except in compliance with the License.
406f6ba60Sopenharmony_ci# You may obtain a copy of the License at
506f6ba60Sopenharmony_ci#
606f6ba60Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
706f6ba60Sopenharmony_ci#
806f6ba60Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
906f6ba60Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
1006f6ba60Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1106f6ba60Sopenharmony_ci# See the License for the specific language governing permissions and
1206f6ba60Sopenharmony_ci# limitations under the License.
1306f6ba60Sopenharmony_ci
1406f6ba60Sopenharmony_ciimport("//build/ohos.gni")
1506f6ba60Sopenharmony_ciimport("../../base/config.gni")
1606f6ba60Sopenharmony_ci
1706f6ba60Sopenharmony_ciconfig("profiler_service_config") {
1806f6ba60Sopenharmony_ci  include_dirs = [
1906f6ba60Sopenharmony_ci    "../../plugins/api/include",
2006f6ba60Sopenharmony_ci    "../plugin_service/include",
2106f6ba60Sopenharmony_ci    "include",
2206f6ba60Sopenharmony_ci    "src",
2306f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/device/services/ipc/include",
2406f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/device/base/include",
2506f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/interfaces/kits",
2606f6ba60Sopenharmony_ci  ]
2706f6ba60Sopenharmony_ci  if (current_toolchain != host_toolchain) {
2806f6ba60Sopenharmony_ci    cflags = [ "-DHAVE_HILOG" ]
2906f6ba60Sopenharmony_ci  }
3006f6ba60Sopenharmony_ci}
3106f6ba60Sopenharmony_ci
3206f6ba60Sopenharmony_ciohos_source_set("profiler_service") {
3306f6ba60Sopenharmony_ci  part_name = "${OHOS_PROFILER_PART_NAME}"
3406f6ba60Sopenharmony_ci  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
3506f6ba60Sopenharmony_ci  sources = [
3606f6ba60Sopenharmony_ci    "src/profiler_capability_manager.cpp",
3706f6ba60Sopenharmony_ci    "src/profiler_data_repeater.cpp",
3806f6ba60Sopenharmony_ci    "src/profiler_service.cpp",
3906f6ba60Sopenharmony_ci    "src/trace_file_helper.cpp",
4006f6ba60Sopenharmony_ci    "src/trace_file_reader.cpp",
4106f6ba60Sopenharmony_ci    "src/trace_file_writer.cpp",
4206f6ba60Sopenharmony_ci  ]
4306f6ba60Sopenharmony_ci  public_deps = [
4406f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source",
4506f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/services:profiler_service_proto",
4606f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/hiperf_data:hiperf_data_cpp",
4706f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp",
4806f6ba60Sopenharmony_ci  ]
4906f6ba60Sopenharmony_ci  public_configs = [
5006f6ba60Sopenharmony_ci    ":profiler_service_config",
5106f6ba60Sopenharmony_ci    "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config",
5206f6ba60Sopenharmony_ci  ]
5306f6ba60Sopenharmony_ci  external_deps = [
5406f6ba60Sopenharmony_ci    "bounds_checking_function:libsec_shared",
5506f6ba60Sopenharmony_ci    "grpc:grpc",
5606f6ba60Sopenharmony_ci    "grpc:grpcxx",
5706f6ba60Sopenharmony_ci    "openssl:libcrypto_shared",
5806f6ba60Sopenharmony_ci    "protobuf:protobuf",
5906f6ba60Sopenharmony_ci    "protobuf:protobuf_lite",
6006f6ba60Sopenharmony_ci  ]
6106f6ba60Sopenharmony_ci  if (current_toolchain != host_toolchain) {
6206f6ba60Sopenharmony_ci    external_deps += [ "hilog:libhilog_base" ]
6306f6ba60Sopenharmony_ci  }
6406f6ba60Sopenharmony_ci  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
6506f6ba60Sopenharmony_ci}
6606f6ba60Sopenharmony_ci
6706f6ba60Sopenharmony_ciohos_prebuilt_etc("hiprofilerd.cfg") {
6806f6ba60Sopenharmony_ci  source = "../../etc/hiprofilerd.cfg"
6906f6ba60Sopenharmony_ci  relative_install_dir = "init"
7006f6ba60Sopenharmony_ci  part_name = "${OHOS_PROFILER_PART_NAME}"
7106f6ba60Sopenharmony_ci  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
7206f6ba60Sopenharmony_ci}
7306f6ba60Sopenharmony_ci
7406f6ba60Sopenharmony_ciohos_prebuilt_etc("hiprofiler.para") {
7506f6ba60Sopenharmony_ci  source = "../../etc/hiprofiler.para"
7606f6ba60Sopenharmony_ci  relative_install_dir = "param"
7706f6ba60Sopenharmony_ci  part_name = "${OHOS_PROFILER_PART_NAME}"
7806f6ba60Sopenharmony_ci  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
7906f6ba60Sopenharmony_ci}
8006f6ba60Sopenharmony_ci
8106f6ba60Sopenharmony_ciohos_prebuilt_etc("hiprofiler.para.dac") {
8206f6ba60Sopenharmony_ci  source = "../../etc/hiprofiler.para.dac"
8306f6ba60Sopenharmony_ci  relative_install_dir = "param"
8406f6ba60Sopenharmony_ci  part_name = "${OHOS_PROFILER_PART_NAME}"
8506f6ba60Sopenharmony_ci  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
8606f6ba60Sopenharmony_ci}
8706f6ba60Sopenharmony_ci
8806f6ba60Sopenharmony_ciohos_executable("hiprofilerd") {
8906f6ba60Sopenharmony_ci  sources = [ "src/main.cpp" ]
9006f6ba60Sopenharmony_ci  deps = [
9106f6ba60Sopenharmony_ci    ":hiprofiler.para",
9206f6ba60Sopenharmony_ci    ":hiprofiler.para.dac",
9306f6ba60Sopenharmony_ci    ":hiprofilerd.cfg",
9406f6ba60Sopenharmony_ci    ":profiler_service",
9506f6ba60Sopenharmony_ci    "../../base:hiprofiler_base",
9606f6ba60Sopenharmony_ci    "../plugin_service:hiprofiler_plugin_service",
9706f6ba60Sopenharmony_ci  ]
9806f6ba60Sopenharmony_ci  if (current_toolchain != host_toolchain) {
9906f6ba60Sopenharmony_ci    external_deps = [
10006f6ba60Sopenharmony_ci      "abseil-cpp:absl_sync",
10106f6ba60Sopenharmony_ci      "bounds_checking_function:libsec_shared",
10206f6ba60Sopenharmony_ci      "grpc:gpr",
10306f6ba60Sopenharmony_ci      "grpc:grpc",
10406f6ba60Sopenharmony_ci      "grpc:grpcxx",
10506f6ba60Sopenharmony_ci      "hilog:libhilog_base",
10606f6ba60Sopenharmony_ci      "openssl:libcrypto_shared",
10706f6ba60Sopenharmony_ci      "protobuf:protobuf_lite",
10806f6ba60Sopenharmony_ci    ]
10906f6ba60Sopenharmony_ci  }
11006f6ba60Sopenharmony_ci  install_enable = true
11106f6ba60Sopenharmony_ci  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
11206f6ba60Sopenharmony_ci  part_name = "${OHOS_PROFILER_PART_NAME}"
11306f6ba60Sopenharmony_ci}
114