• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2025 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    "${os_account_dfx_path}/data_dfx",
29    "utils/include",
30    "${innerkits_common}/include",
31    "${innerkits_path}/include",
32    "json_utils/include",
33    "${os_account_path}/interfaces/innerkits/osaccount/native/include",
34    "${domain_account_interfaces_native_path}/include",
35    "${app_account_innerkits_native_path}/include",
36  ]
37}
38
39ohos_shared_library("libaccount_common") {
40  branch_protector_ret = "pac_ret"
41
42  sanitize = {
43    cfi = true
44    cfi_cross_dso = true
45    debug = false
46  }
47
48  sources = [
49    "${app_account_innerkits_native_path}/src/app_account_info.cpp",
50    "${innerkits_native_path}/src/distributed_account_subscribe_callback.cpp",
51    "${os_account_dfx_path}/data_dfx/data_size_report_adapter.cpp",
52    "${os_account_dfx_path}/hisysevent_adapter/account_hisysevent_adapter.cpp",
53    "account_error/src/account_error_no.cpp",
54    "file_operator/src/account_file_operator.cpp",
55    "json_utils/src/app_account_info_json_parser.cpp",
56    "json_utils/src/json_utils.cpp",
57    "json_utils/src/os_account_info_json_parser.cpp",
58    "log/src/account_log_wrapper.cpp",
59    "perf_stat/src/perf_stat.cpp",
60    "utils/src/account_permission_manager.cpp",
61    "utils/src/account_timeout_task.cpp",
62    "utils/src/memory_guard.cpp",
63  ]
64
65  cflags = [ "-pipe" ]
66  cflags_cc = [
67    "-Wdate-time",
68    "-Wformat=2",
69    "-Wfloat-equal",
70    "-Wshadow",
71  ]
72
73  defines = [
74    "ACCOUNT_LOG_TAG = \"AccountCommonFwk\"",
75    "LOG_DOMAIN = 0xD001B00",
76  ]
77
78  if (use_musl) {
79    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
80      defines += [ "CONFIG_USE_JEMALLOC_DFX_INTF" ]
81    }
82  }
83
84  public_configs = [ ":account_common_config" ]
85
86  external_deps = [
87    "ability_base:want",
88    "access_token:libaccesstoken_sdk",
89    "access_token:libtokenid_sdk",
90    "cJSON:cjson",
91    "c_utils:utils",
92    "hilog:libhilog",
93    "ipc:ipc_single",
94  ]
95
96  if (hicollie_enable == true) {
97    sources += [ "utils/src/account_timer.cpp" ]
98    external_deps += [ "hicollie:libhicollie" ]
99    cflags_cc += [ "-DHICOLLIE_ENABLE" ]
100  }
101
102  if (os_account_distributed_feature) {
103    cflags_cc += [ "-DENABLE_FILE_WATCHER" ]
104  }
105
106  if (has_hiviewdfx_hitrace_part) {
107    cflags_cc += [ "-DHAS_HISYSEVENT_PART" ]
108    external_deps += [ "hisysevent:libhisysevent" ]
109  }
110
111  subsystem_name = "account"
112  innerapi_tags = [ "platformsdk" ]
113  part_name = "os_account"
114}
115