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("config.gni") 16 17# compile options for gcov 18config("hiprofiler_test_config") { 19 cflags = [ 20 "-std=c++17", 21 "-fvisibility=hidden", 22 ] 23 24 cflags_cc = [ 25 "-fvisibility-inlines-hidden", 26 "-fno-exceptions", 27 ] 28 29 ldflags = [] 30 31 if (enable_coverage) { 32 # clang coverage options: 33 if (is_ohos) { 34 cflags += [ 35 "-fprofile-arcs", 36 "-ftest-coverage", 37 ] 38 ldflags += [ "--coverage" ] 39 } 40 cflags += [ 41 "-mllvm", 42 "-limited-coverage-experimental=true", 43 "-fno-use-cxa-atexit", 44 ] 45 } 46} 47 48config("hiprofiler_base_config") { 49 defines = [] 50 if (use_musl && !is_asan) { 51 defines += [ "HOOK_ENABLE" ] 52 } 53 include_dirs = [ "include" ] 54} 55 56ohos_source_set("hiprofiler_base") { 57 part_name = "${OHOS_PROFILER_PART_NAME}" 58 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 59 sources = [ 60 "src/common.cpp", 61 "src/epoll_event_poller.cpp", 62 "src/event_notifier.cpp", 63 "src/i_semaphore.cpp", 64 "src/posix_semaphore.cpp", 65 "src/schedule_task_manager.cpp", 66 "src/std_semaphore.cpp", 67 ] 68 69 public_configs = [ 70 ":hiprofiler_test_config", 71 ":hiprofiler_base_config", 72 ] 73 74 external_deps = [ 75 "bounds_checking_function:libsec_shared", 76 "bundle_framework:appexecfwk_base", 77 "bundle_framework:appexecfwk_core", 78 "c_utils:utils", 79 "init:libbegetutil", 80 "ipc:ipc_core", 81 "os_account:os_account_innerkits", 82 "samgr:samgr_proxy", 83 ] 84 85 if (current_toolchain != host_toolchain) { 86 defines = [ "HAVE_HILOG" ] 87 external_deps += [ "hilog:libhilog_base" ] 88 } 89} 90