1# Copyright (c) Huawei Technologies Co., Ltd. 2023. 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")
16
17ohos_shared_library("xpowerplugin") {
18  output_name = "xpowerplugin"
19  version_script = "libxpower_plugin.map"
20  sources = [
21    "src/power_message_queue.cpp",
22    "src/xpower_module.cpp",
23    "src/xpower_plugin.cpp",
24  ]
25  include_dirs = [
26    "include",
27    "${OHOS_PROFILER_DIR}/interfaces/kits",
28    "${OHOS_PROFILER_DIR}/device/base/include",
29  ]
30  deps = [
31    "${OHOS_PROFILER_DIR}/protos/types/plugins/xpower_data:xpower_data_cpp",
32    "../../base:hiprofiler_base",
33  ]
34  if (current_toolchain != host_toolchain) {
35    defines = [ "HAVE_HILOG" ]
36    external_deps = [
37      "bounds_checking_function:libsec_shared",
38      "hilog:libhilog_base",
39      "protobuf:protobuf_lite",
40    ]
41  }
42  public_configs = [ "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config" ]
43  install_enable = true
44  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
45  part_name = "${OHOS_PROFILER_PART_NAME}"
46}
47
48ohos_executable("xpowerdecoder") {
49  output_name = "xpowerdecoder"
50  include_dirs = [ "./include" ]
51  sources = [
52    "test/xpower_decoder.cpp",
53    "test/xpower_main.cpp",
54  ]
55  deps = [
56    "${OHOS_PROFILER_DIR}/device/services/profiler_service:profiler_service",
57    "${OHOS_PROFILER_DIR}/protos/services:proto_services_cpp",
58    "${OHOS_PROFILER_DIR}/protos/types/plugins/xpower_data:xpower_data_cpp",
59  ]
60  cflags = [
61    "-Wno-error=inline-asm",
62    "-O3",
63  ]
64  ldflags = [ "-rdynamic" ]
65  if (current_toolchain != host_toolchain) {
66    defines = [ "HAVE_HILOG" ]
67    external_deps = [
68      "bounds_checking_function:libsec_shared",
69      "cJSON:cjson_static",
70      "hilog:libhilog_base",
71      "openssl:libcrypto_shared",
72      "protobuf:protobuf_lite",
73    ]
74  }
75  install_enable = false
76  subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}"
77  part_name = "${OHOS_PROFILER_PART_NAME}"
78}
79