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/memory_guard.cpp",
50  ]
51
52  cflags = [ "-pipe" ]
53  cflags_cc = [
54    "-Wdate-time",
55    "-Wformat=2",
56    "-Wfloat-equal",
57    "-Wshadow",
58  ]
59
60  defines = [
61    "ACCOUNT_LOG_TAG = \"AccountCommonFwk\"",
62    "LOG_DOMAIN = 0xD001B00",
63  ]
64
65  if (use_musl) {
66    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
67      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
68    }
69  }
70
71  public_configs = [ ":account_common_config" ]
72
73  external_deps = [
74    "access_token:libaccesstoken_sdk",
75    "access_token:libtokenid_sdk",
76    "c_utils:utils",
77    "hilog:libhilog",
78    "ipc:ipc_single",
79  ]
80
81  public_external_deps = [ "json:nlohmann_json_static" ]
82
83  if (build_selinux) {
84    external_deps += [ "selinux_adapter:librestorecon" ]
85    cflags += [ "-DWITH_SELINUX" ]
86  }
87
88  if (hicollie_enable == true) {
89    sources += [ "utils/src/account_timer.cpp" ]
90    external_deps += [ "hicollie:libhicollie" ]
91    cflags_cc += [ "-DHICOLLIE_ENABLE" ]
92  }
93
94  subsystem_name = "account"
95  innerapi_tags = [ "platformsdk" ]
96  part_name = "os_account"
97}
98