1# Copyright (c) 2022-2024 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
17openssl_dir = "//third_party/openssl"
18config("avsession_utils_config") {
19  include_dirs = [ "include" ]
20}
21
22ohos_shared_library("avsession_utils") {
23  install_enable = true
24  sanitize = {
25    cfi = true
26    cfi_cross_dso = true
27    debug = false
28  }
29  sources = [
30    "src/avsession_dynamic_loader.cpp",
31    "src/avsession_event_handler.cpp",
32    "src/avsession_radar.cpp",
33    "src/avsession_sysevent.cpp",
34    "src/hash_calculator.cpp",
35    "src/permission_checker.cpp",
36  ]
37
38  include_dirs = [
39    "./../interfaces/inner_api/native/session/include",
40    "$openssl_dir/include/",
41  ]
42
43  public_configs = [ ":avsession_utils_config" ]
44
45  deps = [ "//third_party/openssl:libcrypto_shared" ]
46
47  external_deps = [
48    "access_token:libaccesstoken_sdk",
49    "access_token:libtokenid_sdk",
50    "access_token:libtokensetproc_shared",
51    "bundle_framework:appexecfwk_base",
52    "bundle_framework:appexecfwk_core",
53    "c_utils:utils",
54    "device_manager:devicemanagersdk",
55    "eventhandler:libeventhandler",
56    "hilog:libhilog",
57    "ipc:ipc_single",
58    "samgr:samgr_proxy",
59  ]
60
61  cflags = []
62
63  if (multimedia_av_session_enable_trace_control) {
64    cflags += [ "-DENBABLE_AVSESSION_TRACE_CONTROL" ]
65    external_deps += [ "hitrace:hitrace_meter" ]
66  }
67  if (multimedia_av_session_enable_sysevent_control) {
68    cflags += [ "-DENABLE_AVSESSION_SYSEVENT_CONTROL" ]
69    external_deps += [ "hisysevent:libhisysevent" ]
70  }
71
72  subsystem_name = "multimedia"
73  innerapi_tags = [ "platformsdk" ]
74  part_name = "av_session"
75  defines = [ "OPENSSL_SUPPRESS_DEPRECATED" ]
76  if (use_libfuzzer || use_clang_coverage) {
77    defines += [ "TEST_COVERAGE" ]
78  }
79}
80