106f6ba60Sopenharmony_ci# Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved. 206f6ba60Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 306f6ba60Sopenharmony_ci# you may not use this file except in compliance with the License. 406f6ba60Sopenharmony_ci# You may obtain a copy of the License at 506f6ba60Sopenharmony_ci# 606f6ba60Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 706f6ba60Sopenharmony_ci# 806f6ba60Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 906f6ba60Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1006f6ba60Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1106f6ba60Sopenharmony_ci# See the License for the specific language governing permissions and 1206f6ba60Sopenharmony_ci# limitations under the License. 1306f6ba60Sopenharmony_ci 1406f6ba60Sopenharmony_ciimport("//build/ohos.gni") 1506f6ba60Sopenharmony_ciimport("config.gni") 1606f6ba60Sopenharmony_ci 1706f6ba60Sopenharmony_ci# compile options for gcov 1806f6ba60Sopenharmony_ciconfig("hiprofiler_test_config") { 1906f6ba60Sopenharmony_ci cflags = [ 2006f6ba60Sopenharmony_ci "-std=c++17", 2106f6ba60Sopenharmony_ci "-fvisibility=hidden", 2206f6ba60Sopenharmony_ci ] 2306f6ba60Sopenharmony_ci 2406f6ba60Sopenharmony_ci cflags_cc = [ 2506f6ba60Sopenharmony_ci "-fvisibility-inlines-hidden", 2606f6ba60Sopenharmony_ci "-fno-exceptions", 2706f6ba60Sopenharmony_ci ] 2806f6ba60Sopenharmony_ci 2906f6ba60Sopenharmony_ci ldflags = [] 3006f6ba60Sopenharmony_ci 3106f6ba60Sopenharmony_ci if (enable_coverage) { 3206f6ba60Sopenharmony_ci # clang coverage options: 3306f6ba60Sopenharmony_ci if (is_ohos) { 3406f6ba60Sopenharmony_ci cflags += [ 3506f6ba60Sopenharmony_ci "-fprofile-arcs", 3606f6ba60Sopenharmony_ci "-ftest-coverage", 3706f6ba60Sopenharmony_ci ] 3806f6ba60Sopenharmony_ci ldflags += [ "--coverage" ] 3906f6ba60Sopenharmony_ci } 4006f6ba60Sopenharmony_ci cflags += [ 4106f6ba60Sopenharmony_ci "-mllvm", 4206f6ba60Sopenharmony_ci "-limited-coverage-experimental=true", 4306f6ba60Sopenharmony_ci "-fno-use-cxa-atexit", 4406f6ba60Sopenharmony_ci ] 4506f6ba60Sopenharmony_ci } 4606f6ba60Sopenharmony_ci} 4706f6ba60Sopenharmony_ci 4806f6ba60Sopenharmony_ciconfig("hiprofiler_base_config") { 4906f6ba60Sopenharmony_ci defines = [] 5006f6ba60Sopenharmony_ci if (use_musl && !is_asan) { 5106f6ba60Sopenharmony_ci defines += [ "HOOK_ENABLE" ] 5206f6ba60Sopenharmony_ci } 5306f6ba60Sopenharmony_ci include_dirs = [ "include" ] 5406f6ba60Sopenharmony_ci} 5506f6ba60Sopenharmony_ci 5606f6ba60Sopenharmony_ciohos_source_set("hiprofiler_base") { 5706f6ba60Sopenharmony_ci part_name = "${OHOS_PROFILER_PART_NAME}" 5806f6ba60Sopenharmony_ci subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 5906f6ba60Sopenharmony_ci sources = [ 6006f6ba60Sopenharmony_ci "src/common.cpp", 6106f6ba60Sopenharmony_ci "src/epoll_event_poller.cpp", 6206f6ba60Sopenharmony_ci "src/event_notifier.cpp", 6306f6ba60Sopenharmony_ci "src/i_semaphore.cpp", 6406f6ba60Sopenharmony_ci "src/posix_semaphore.cpp", 6506f6ba60Sopenharmony_ci "src/schedule_task_manager.cpp", 6606f6ba60Sopenharmony_ci "src/std_semaphore.cpp", 6706f6ba60Sopenharmony_ci ] 6806f6ba60Sopenharmony_ci 6906f6ba60Sopenharmony_ci public_configs = [ 7006f6ba60Sopenharmony_ci ":hiprofiler_test_config", 7106f6ba60Sopenharmony_ci ":hiprofiler_base_config", 7206f6ba60Sopenharmony_ci ] 7306f6ba60Sopenharmony_ci 7406f6ba60Sopenharmony_ci external_deps = [ 7506f6ba60Sopenharmony_ci "bounds_checking_function:libsec_shared", 7606f6ba60Sopenharmony_ci "bundle_framework:appexecfwk_base", 7706f6ba60Sopenharmony_ci "bundle_framework:appexecfwk_core", 7806f6ba60Sopenharmony_ci "c_utils:utils", 7906f6ba60Sopenharmony_ci "init:libbegetutil", 8006f6ba60Sopenharmony_ci "ipc:ipc_core", 8106f6ba60Sopenharmony_ci "os_account:os_account_innerkits", 8206f6ba60Sopenharmony_ci "samgr:samgr_proxy", 8306f6ba60Sopenharmony_ci ] 8406f6ba60Sopenharmony_ci 8506f6ba60Sopenharmony_ci if (current_toolchain != host_toolchain) { 8606f6ba60Sopenharmony_ci defines = [ "HAVE_HILOG" ] 8706f6ba60Sopenharmony_ci external_deps += [ "hilog:libhilog_base" ] 8806f6ba60Sopenharmony_ci } 8906f6ba60Sopenharmony_ci} 90