1# Copyright (C) 2021 Huawei Device Co., Ltd. 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 = [ "-fvisibility-inlines-hidden" ] 25 26 ldflags = [] 27 28 if (enable_coverage) { 29 # clang coverage options: 30 if (is_ohos) { 31 cflags += [ 32 "-fprofile-arcs", 33 "-ftest-coverage", 34 ] 35 ldflags += [ "--coverage" ] 36 } 37 cflags += [ 38 "-mllvm", 39 "-limited-coverage-experimental=true", 40 "-fno-use-cxa-atexit", 41 ] 42 } 43} 44 45config("hiprofiler_base_config") { 46 defines = [] 47 if (use_musl && !is_asan) { 48 defines += [ "HOOK_ENABLE" ] 49 } 50 include_dirs = [ 51 "include", 52 "//third_party/bounds_checking_function/include", 53 "//commonlibrary/c_utils/base/include", 54 ] 55} 56 57ohos_source_set("hiprofiler_base") { 58 part_name = "profiler" 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/pthread_semaphore.cpp", 66 "src/schedule_task_manager.cpp", 67 "src/std_semaphore.cpp", 68 ] 69 70 public_configs = [ 71 ":hiprofiler_test_config", 72 ":hiprofiler_base_config", 73 ] 74 75 external_deps = [ 76 "bundle_framework:appexecfwk_base", 77 "bundle_framework:appexecfwk_core", 78 "c_utils:utils", 79 "ipc:ipc_core", 80 "samgr:samgr_proxy", 81 ] 82 83 public_deps = [ "//third_party/bounds_checking_function:libsec_static" ] 84 if (current_toolchain != host_toolchain) { 85 defines = [ "HAVE_HILOG" ] 86 if (build_l2) { 87 external_deps += [ "shared_library:libhilog" ] 88 } else { 89 external_deps += [ "hiviewdfx_hilog_native:libhilog" ] 90 } 91 } 92} 93