1# Copyright (c) 2021-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("//build/ohos.gni")
15import("../../os_account.gni")
16
17group("common_target") {
18  deps = [ ":libaccount_common" ]
19}
20
21config("account_common_config") {
22  include_dirs = [
23    "include",
24    "file_operator/include",
25    "log/include",
26    "perf_stat/include",
27    "${os_account_dfx_path}/hisysevent_adapter",
28    "utils/include",
29    "${innerkits_common}/include",
30  ]
31}
32
33ohos_shared_library("libaccount_common") {
34  branch_protector_ret = "pac_ret"
35
36  sanitize = {
37    cfi = true
38    cfi_cross_dso = true
39    debug = false
40  }
41
42  sources = [
43    "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp",
44    "account_error/src/account_error_no.cpp",
45    "file_operator/src/account_file_operator.cpp",
46    "log/src/account_log_wrapper.cpp",
47    "perf_stat/src/perf_stat.cpp",
48    "utils/src/account_permission_manager.cpp",
49    "utils/src/account_timeout_task.cpp",
50    "utils/src/memory_guard.cpp",
51  ]
52
53  cflags = [ "-pipe" ]
54  cflags_cc = [
55    "-Wdate-time",
56    "-Wformat=2",
57    "-Wfloat-equal",
58    "-Wshadow",
59  ]
60
61  defines = [
62    "ACCOUNT_LOG_TAG = \"AccountCommonFwk\"",
63    "LOG_DOMAIN = 0xD001B00",
64  ]
65
66  if (use_musl) {
67    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
68      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
69    }
70  }
71
72  public_configs = [ ":account_common_config" ]
73
74  external_deps = [
75    "access_token:libaccesstoken_sdk",
76    "access_token:libtokenid_sdk",
77    "c_utils:utils",
78    "hilog:libhilog",
79    "ipc:ipc_single",
80  ]
81
82  public_external_deps = [ "json:nlohmann_json_static" ]
83
84  if (build_selinux) {
85    external_deps += [ "selinux_adapter:librestorecon" ]
86    cflags += [ "-DWITH_SELINUX" ]
87  }
88
89  if (hicollie_enable == true) {
90    sources += [ "utils/src/account_timer.cpp" ]
91    external_deps += [ "hicollie:libhicollie" ]
92    cflags_cc += [ "-DHICOLLIE_ENABLE" ]
93  }
94
95  subsystem_name = "account"
96  innerapi_tags = [ "platformsdk" ]
97  part_name = "os_account"
98}
99