1# Copyright (c) 2021-2023 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("cj_ability_access_ctrl_ffi_config") {
18  include_dirs = [ "include" ]
19}
20
21ohos_shared_library("cj_ability_access_ctrl_ffi") {
22  sanitize = {
23    cfi = true
24    cfi_cross_dso = true
25    debug = false
26  }
27  branch_protector_ret = "pac_ret"
28  include_dirs = [
29    "${access_token_path}/frameworks/common/include",
30    "${access_token_path}/interfaces/innerkits/accesstoken/include",
31    "${access_token_path}/interfaces/innerkits/token_callback/include",
32    "${access_token_path}/interfaces/innerkits/token_setproc/include",
33    "../../napi/common/include",
34  ]
35
36  if (!defined(defines)) {
37    defines = []
38  }
39
40  if (!ohos_indep_compiler_enable && product_name != "ohos-sdk") {
41    sources = [
42      "src/ability_access_ctrl_ffi.cpp",
43      "src/at_manager_impl.cpp",
44    ]
45
46    deps = [
47      "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk",
48      "${access_token_path}/interfaces/innerkits/token_callback:libtoken_callback_sdk",
49      "${access_token_path}/interfaces/innerkits/token_setproc:libtokensetproc_shared",
50      "../../napi/common:libnapi_common",
51    ]
52
53    external_deps = [
54      "ability_base:want",
55      "ability_runtime:ability_context_native",
56      "ability_runtime:ability_manager",
57      "ability_runtime:abilitykit_native",
58      "ability_runtime:napi_base_context",
59      "ability_runtime:ui_extension",
60      "ace_engine:ace_uicontent",
61      "c_utils:utils",
62      "hilog:libhilog",
63      "init:libbegetutil",
64      "ipc:ipc_single",
65      "napi:ace_napi",
66      "napi:cj_bind_ffi",
67      "napi:cj_bind_native",
68    ]
69  } else {
70    defines += [ "PREVIEWER" ]
71    sources = [ "src/ability_access_ctrl_mock.cpp" ]
72    external_deps = [ "napi:cj_bind_ffi" ]
73  }
74
75  cflags_cc = [ "-DHILOG_ENABLE" ]
76  public_configs = [ ":cj_ability_access_ctrl_ffi_config" ]
77  configs = [
78    "${access_token_path}/config:access_token_compile_flags",
79    "${access_token_path}/config:coverage_flags",
80  ]
81
82  if (current_os == "ohos") {
83    defines += [ "OHOS_PLATFORM" ]
84  }
85
86  if (current_os == "mingw") {
87    defines += [ "WINDOWS_PLATFORM" ]
88  }
89  innerapi_tags = [ "platformsdk" ]
90  subsystem_name = "security"
91  part_name = "access_token"
92}
93