• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 = [ "-std=c++17" ]
20  ldflags = []
21
22  if (enable_coverage) {
23    # clang coverage options:
24    if (is_ohos) {
25      cflags += [
26        "-fprofile-arcs",
27        "-ftest-coverage",
28      ]
29      ldflags += [ "--coverage" ]
30    }
31    cflags += [
32      "-mllvm",
33      "-limited-coverage-experimental=true",
34      "-fno-use-cxa-atexit",
35    ]
36  }
37}
38
39config("hiprofiler_base_config") {
40  include_dirs = [
41    "include",
42    "//utils/native/base/include",
43  ]
44}
45
46ohos_source_set("hiprofiler_base") {
47  part_name = "profiler"
48  sources = [
49    "src/epoll_event_poller.cpp",
50    "src/event_notifier.cpp",
51    "src/i_semaphore.cpp",
52    "src/posix_semaphore.cpp",
53    "src/pthread_semaphore.cpp",
54    "src/schedule_task_manager.cpp",
55    "src/std_semaphore.cpp",
56  ]
57
58  public_configs = [
59    ":hiprofiler_test_config",
60    ":hiprofiler_base_config",
61  ]
62  public_deps = [ "//utils/native/base:utilsecurec" ]
63  if (current_toolchain != host_toolchain) {
64    defines = [ "HAVE_HILOG" ]
65    if (build_l2) {
66      external_deps = [ "shared_library:libhilog" ]
67    } else {
68      external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
69    }
70  }
71}
72