1# Copyright (c) 2022 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("//base/security/device_security_level/common/dslm.gni")
15import("//build/ohos.gni")
16
17# messenger_static lib
18config("messenger_static_config") {
19  include_dirs = [ "include" ]
20}
21
22ohos_static_library("messenger_static") {
23  include_dirs = [
24    "include",
25    "src/common",
26    "src/utils",
27  ]
28
29  sources = [
30    "src/common/messenger.c",
31    "src/utils/messenger_utils.c",
32  ]
33
34  deps = [ "../utils:utils_static" ]
35
36  if (defined(ohos_lite)) {
37    sources += [
38      "src/lite/messenger_device_session_manager.c",
39      "src/lite/messenger_device_status_manager.c",
40      "src/lite/messenger_impl.c",
41    ]
42    if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
43      deps += [
44        "$dslm_dsoftbus_path/sdk:softbus_client",
45        "$dslm_hilog_path/featured:hilog_shared",
46      ]
47    } else if (ohos_kernel_type == "liteos_m") {
48      deps += [
49        "$dslm_dsoftbus_path/sdk:softbus_client",
50        "$dslm_hilog_path/featured:hilog_static",
51      ]
52    }
53  } else {
54    sources += [
55      "src/standard/messenger_device_socket_manager.c",
56      "src/standard/messenger_device_status_manager.cpp",
57      "src/standard/messenger_impl.c",
58    ]
59    sanitize = {
60      integer_overflow = true
61      ubsan = true
62      boundary_sanitize = true
63      cfi = true
64      cfi_cross_dso = true
65      blocklist = "../../cfi_blocklist.txt"
66    }
67    branch_protector_ret = "pac_ret"
68
69    external_deps = [
70      "c_utils:utils",
71      "device_manager:devicemanagersdk",
72      "dsoftbus:softbus_client",
73      "hilog:libhilog",
74    ]
75  }
76
77  configs = [
78    "../../common:common_configs",
79    "../../common:common_lite_configs",
80  ]
81
82  public_configs = [ ":messenger_static_config" ]
83  part_name = "device_security_level"
84  subsystem_name = "security"
85}
86