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("../../build/ts.gni") 16config("hiperf_config") { 17 cflags = [ 18 "-D ALWAYSTRUE", 19 "-D is_mingw=${is_mingw}", 20 ] 21} 22config("hiperf_public_config") { 23 include_dirs = [ 24 "linux", 25 "include", 26 "include/nonlinux", 27 "include/nonlinux/linux", 28 "${SRC}/", 29 "${SRC}/base", 30 "${SRC}/include", 31 "${SRC}/trace_streamer", 32 "${THIRD_PARTY}/bounds_checking_function/include", 33 "${THIRD_PARTY}/perf_include/libbpf", 34 "${COMMON_LIBRARY}/base/include", 35 ] 36 if (is_mingw) { 37 cflags = [ "-includeMingW64Fix.h" ] 38 } 39} 40ohos_source_set("hiperf_src") { 41 subsystem_name = "thirdparty" 42 part_name = "hiperf" 43 sources = [ 44 "src/callstack.cpp", 45 "src/dwarf_encoding.cpp", 46 "src/option.cpp", 47 "src/perf_event_record.cpp", 48 "src/perf_file_format.cpp", 49 "src/perf_file_reader.cpp", 50 "src/register.cpp", 51 "src/report.cpp", 52 "src/subcommand.cpp", 53 "src/symbols_file.cpp", 54 "src/unique_stack_table.cpp", 55 "src/utilities.cpp", 56 "src/virtual_runtime.cpp", 57 "src/virtual_thread.cpp", 58 ] 59 configs -= [ trace_cfg_path ] 60 configs += [ "../../gn:hiperf_trace_cfg" ] 61 configs += [ ":hiperf_config" ] 62 public_configs = [ ":hiperf_public_config" ] 63 public_deps = [ 64 "${THIRD_PARTY}/zlib:libz", 65 "//third_party/perf_include/hiviewdfx:libfaultloggerd", 66 ] 67 if (!use_wasm && !is_win && !is_mingw && !is_mac && !is_test) { 68 if (!is_independent_compile) { 69 if (target_cpu == "arm64") { 70 public_deps += [ "//third_party/libunwind:unwind_source_arm64_opt" ] 71 } else { 72 public_deps += [ "//third_party/libunwind:unwind_source_${target_cpu}" ] 73 } 74 } else { 75 public_deps += [ "${THIRD_PARTY}/libunwind:libunwind" ] 76 } 77 } 78} 79