# 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("../../base/config.gni") config("cflags_config") { cflags = [ "-O3" ] } config("hook_config") { defines = [ "is_ohos=1" ] defines += [ "HAVE_LIBUNWIND=1", "HIPERF_DEBUG", "CONFIG_NO_HILOG", "NATIVEDAEMON_USE_CALLSTACK", ] defines += [ "target_cpu_${target_cpu}" ] } ohos_prebuilt_etc("hiprofiler_daemon.cfg") { source = "../../etc/hiprofiler_daemon.cfg" relative_install_dir = "init" part_name = "${OHOS_PROFILER_PART_NAME}" subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" } ohos_executable("native_daemon") { output_name = "native_daemon" sources = [ "../api/src/buffer_writer.cpp", "../api/src/command_poller.cpp", "src/call_stack.cpp", "src/debug_logger.cpp", "src/dwarf_encoding.cpp", "src/elf_file.cpp", "src/elf_header.cpp", "src/elf_symbol.cpp", "src/get_thread_id.cpp", "src/hook_manager.cpp", "src/hook_service.cpp", "src/hook_standalone.cpp", "src/main.cpp", "src/program_header.cpp", "src/register.cpp", "src/section_header.cpp", "src/stack_data_repeater.cpp", "src/stack_preprocess.cpp", "src/symbols_file.cpp", "src/utilities.cpp", "src/virtual_runtime.cpp", "src/virtual_thread.cpp", ] include_dirs = [ "./include", "./src", "../../base/include", "../api/include", "../api/src", "${OHOS_PROFILER_DIR}/interfaces/kits", "${OHOS_PROFILER_DIR}/device/services/ipc/include", "${OHOS_PROFILER_DIR}/device/services/shared_memory/include", "//base/startup/init/services/include/param", "//third_party/bounds_checking_function/include", "//third_party/googletest/googletest/include", ] deps = [ ":hiprofiler_daemon.cfg", "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory", "${OHOS_PROFILER_DIR}/protos/services:plugin_service_proto", "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp", "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp_standard", "../../base:hiprofiler_base", "//third_party/bounds_checking_function:libsec_static", "//third_party/libunwind:unwind_source_${target_cpu}", "//third_party/zlib:libz", ] configs = [ ":cflags_config" ] public_configs = [ ":hook_config", "${OHOS_PROFILER_DIR}/device/base:hiprofiler_test_config", ] external_deps = [ "init:libbegetutil" ] if (current_toolchain != host_toolchain) { defines = [ "HAVE_HILOG" ] external_deps += [ "hilog:libhilog" ] } use_exceptions = true install_enable = true subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" part_name = "${OHOS_PROFILER_PART_NAME}" }