1# Copyright (c) 2021-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("../../../access_token.gni")
16
17config("accesstoken") {
18  visibility = [ ":*" ]
19  include_dirs = [ "include" ]
20}
21
22if (is_standard_system) {
23  ohos_shared_library("libaccesstoken_sdk") {
24    subsystem_name = "security"
25    part_name = "access_token"
26    sanitize = {
27      cfi = true
28      cfi_cross_dso = true
29      debug = false
30    }
31    branch_protector_ret = "pac_ret"
32
33    innerapi_tags = [
34      "chipsetsdk",
35      "platformsdk",
36      "sasdk",
37    ]
38    if (!use_clang_coverage) {
39      version_script = "libaccesstoken_sdk.map"
40    }
41
42    output_name = "libaccesstoken_sdk"
43
44    public_configs = [ ":accesstoken" ]
45
46    include_dirs = [
47      "${access_token_path}/frameworks/accesstoken/include",
48      "${access_token_path}/frameworks/common/include",
49      "src",
50    ]
51
52    sources = [
53      "src/accesstoken_callback_stubs.cpp",
54      "src/accesstoken_callbacks.cpp",
55      "src/accesstoken_death_recipient.cpp",
56      "src/accesstoken_kit.cpp",
57      "src/accesstoken_manager_client.cpp",
58      "src/accesstoken_manager_proxy.cpp",
59      "src/perm_state_change_callback_customize.cpp",
60    ]
61
62    deps = [
63      ":libtokenid_sdk",
64      "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx",
65      "${access_token_path}/frameworks/common:accesstoken_common_cxx",
66      "${access_token_path}/interfaces/innerkits/token_setproc:libperm_setproc",
67    ]
68
69    external_deps = [
70      "c_utils:utils",
71      "hilog:libhilog",
72      "init:libbegetutil",
73      "ipc:ipc_single",
74      "samgr:samgr_proxy",
75    ]
76
77    configs = [
78      "${access_token_path}/config:access_token_compile_flags",
79      "${access_token_path}/config:coverage_flags",
80    ]
81
82    cflags_cc = [
83      "-DHILOG_ENABLE",
84      "-DDEBUG_API_PERFORMANCE",
85    ]
86
87    if (build_variant == "user") {
88      cflags_cc += [ "-DATM_BUILD_VARIANT_USER_ENABLE" ]
89    }
90
91    if (token_sync_enable == true) {
92      cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ]
93    }
94  }
95}
96
97if (is_standard_system) {
98  ohos_shared_library("libtokenid_sdk") {
99    subsystem_name = "security"
100    part_name = "access_token"
101    sanitize = {
102      cfi = true
103      cfi_cross_dso = true
104      debug = false
105    }
106    branch_protector_ret = "pac_ret"
107    innerapi_tags = [
108      "platformsdk",
109      "sasdk",
110    ]
111
112    output_name = "libtokenid_sdk"
113    public_configs = [ ":accesstoken" ]
114
115    include_dirs = [ "${access_token_path}/frameworks/common/include" ]
116    sources = [ "src/tokenid_kit.cpp" ]
117
118    deps = []
119    external_deps = [
120      "c_utils:utils",
121      "hilog:libhilog",
122    ]
123
124    configs = [
125      "${access_token_path}/config:access_token_compile_flags",
126      "${access_token_path}/config:coverage_flags",
127    ]
128    cflags_cc = [ "-DHILOG_ENABLE" ]
129    if (security_component_enhance_enable == true) {
130      cflags_cc += [ "-DSECURITY_COMPONENT_ENHANCE_ENABLE" ]
131    }
132  }
133}
134