• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16} else {
17  import("//build/ohos.gni")
18}
19import("//base/security/deviceauth/deps_adapter/deviceauth_hals.gni")
20import("deviceauth.gni")
21
22config("deviceauth_config") {
23  include_dirs = [ "//base/security/deviceauth/interfaces/innerkits" ]
24}
25include_dirs = inc_path + hals_inc_path
26if (defined(ohos_lite)) {
27  static_library("deviceauth") {
28    public_configs = [ ":deviceauth_config" ]
29    include_dirs += [
30      "//third_party/cJSON",
31      "//utils/native/lite/include",
32      "//third_party/bounds_checking_function/include",
33      "//foundation/communication/dsoftbus/interfaces/kits/common",
34      "//foundation/communication/dsoftbus/interfaces/kits/transport",
35      "//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
36    ]
37    sources = deviceauth_files
38    deps = [
39      "${deps_adapter_path}:${hal_module_name}",
40      "//build/lite/config/component/cJSON:cjson_shared",
41      "//foundation/communication/dsoftbus/sdk:softbus_client",
42      "//utils/native/lite:utils",
43    ]
44
45    defines = [ "HILOG_ENABLE" ]
46    defines += deviceauth_defines
47    cflags = build_flags
48    cflags += [
49      "-DHICHAIN_THREAD_STACK_SIZE = ${deviceauth_hichain_thread_stack_size}",
50    ]
51    if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
52      include_dirs +=
53          [ "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog" ]
54      deps += [
55        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
56        "//third_party/bounds_checking_function:libsec_shared",
57      ]
58    } else {
59      include_dirs +=
60          [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ]
61      deps += [ "//base/hiviewdfx/hilog_lite/frameworks/mini:hilog_lite" ]
62    }
63  }
64
65  if (ohos_kernel_type == "linux" || ohos_kernel_type == "liteos_a") {
66    executable("deviceauth_service") {
67      include_dirs += [
68        "//third_party/cJSON",
69        "//utils/native/lite/include",
70        "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
71        "//third_party/bounds_checking_function/include",
72        "${frameworks_path}/inc/lite",
73        "//foundation/communication/ipc_lite/interfaces/kits",
74        "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
75      ]
76
77      sources = deviceauth_ipc_files
78      sources += [
79        "${frameworks_path}/src/ipc_service.c",
80        "${frameworks_path}/src/lite/ipc_service_init.c",
81      ]
82
83      defines = [ "HILOG_ENABLE" ]
84      if (ohos_kernel_type == "linux") {
85        defines += [ "__LINUX__" ]
86      }
87      ldflags = [ "-pthread" ]
88
89      deps = [
90        ":deviceauth",
91        "${deps_adapter_path}:${hal_module_name}",
92        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
93        "//build/lite/config/component/cJSON:cjson_shared",
94        "//foundation/communication/ipc_lite:liteipc_adapter",
95        "//foundation/distributedschedule/samgr_lite/samgr:samgr",
96        "//third_party/bounds_checking_function:libsec_shared",
97        "//utils/native/lite:utils",
98      ]
99    }
100
101    shared_library("deviceauth_sdk") {
102      public_configs = [ ":deviceauth_config" ]
103      include_dirs += [
104        "//third_party/cJSON",
105        "//utils/native/lite/include",
106        "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog",
107        "//third_party/bounds_checking_function/include",
108        "${frameworks_path}/inc/lite",
109        "//foundation/communication/ipc_lite/interfaces/kits",
110        "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
111      ]
112
113      sources = deviceauth_ipc_files
114      sources += [ "${frameworks_path}/src/ipc_sdk.c" ]
115
116      defines = [ "HILOG_ENABLE" ]
117      if (ohos_kernel_type == "linux") {
118        defines += [ "__LINUX__" ]
119      }
120      cflags = build_flags
121      cflags += [ "-fPIC" ]
122
123      deps = [
124        "${deps_adapter_path}:${hal_module_name}",
125        "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
126        "//foundation/communication/ipc_lite:liteipc_adapter",
127        "//foundation/distributedschedule/samgr_lite/samgr:samgr",
128        "//third_party/bounds_checking_function:libsec_shared",
129        "//utils/native/lite:utils",
130      ]
131    }
132  }
133} else {
134  ohos_static_library("deviceauth") {
135    subsystem_name = "security"
136    part_name = "deviceauth_standard"
137    include_dirs += [
138      "//third_party/cJSON",
139      "//utils/native/base/include",
140      "${frameworks_path}/inc/standard",
141      "//foundation/communication/dsoftbus/interfaces/kits/common",
142      "//foundation/communication/dsoftbus/interfaces/kits/transport",
143      "//foundation/communication/dsoftbus/interfaces/inner_kits/transport",
144      "//third_party/json/include",
145    ]
146
147    sources = deviceauth_files
148    cflags = [ "-DHILOG_ENABLE" ]
149    defines = deviceauth_defines
150    cflags += build_flags
151    if (target_cpu == "arm") {
152      cflags += [ "-DBINDER_IPC_32BIT" ]
153    }
154    if (support_jsapi) {
155      defines += [ "SUPPORT_OS_ACCOUNT" ]
156    }
157
158    deps = [
159      "${deps_adapter_path}:${hal_module_name}",
160      "//third_party/cJSON:cjson_static",
161      "//utils/native/base:utils",
162    ]
163
164    external_deps = [
165      "dsoftbus_standard:softbus_client",
166      "hiviewdfx_hilog_native:libhilog",
167    ]
168    if (support_jsapi) {
169      external_deps += [ "os_account_standard:os_account_innerkits" ]
170    }
171  }
172
173  ohos_prebuilt_etc("auth_service.rc") {
174    source = "${frameworks_path}/src/standard/deviceauth_service.cfg"
175    relative_install_dir = "init"
176    subsystem_name = "security"
177    part_name = "deviceauth_standard"
178  }
179
180  group("etc") {
181    deps = [ ":auth_service.rc" ]
182  }
183
184  ohos_executable("deviceauth_service") {
185    subsystem_name = "security"
186    part_name = "deviceauth_standard"
187    install_enable = true
188
189    include_dirs += [
190      "//third_party/cJSON",
191      "//utils/native/base/include",
192      "${frameworks_path}/inc/standard",
193      "${dev_frameworks_path}/inc/permission_adapter",
194      "//utils/system/safwk/native/include",
195    ]
196
197    sources = deviceauth_ipc_files
198    sources += permission_adapter_files
199    sources += [ "${frameworks_path}/src/ipc_service.c" ]
200
201    cflags = [ "-DHILOG_ENABLE" ]
202    if (target_cpu == "arm") {
203      cflags += [ "-DBINDER_IPC_32BIT" ]
204    }
205
206    deps = [
207      ":auth_service.rc",
208      ":deviceauth",
209      "${deps_adapter_path}:${hal_module_name}",
210      "//third_party/cJSON:cjson_static",
211      "//utils/native/base:utils",
212    ]
213
214    external_deps = [
215      "access_token:libaccesstoken_sdk",
216      "hiviewdfx_hilog_native:libhilog",
217      "ipc:ipc_core",
218      "safwk:system_ability_fwk",
219      "samgr_standard:samgr_proxy",
220    ]
221  }
222
223  ohos_shared_library("deviceauth_sdk") {
224    subsystem_name = "security"
225    part_name = "deviceauth_standard"
226    public_configs = [ ":deviceauth_config" ]
227
228    include_dirs += [
229      "//third_party/cJSON",
230      "//utils/native/base/include",
231      "${frameworks_path}/inc/standard",
232      "${dev_frameworks_path}/inc/permission_adapter",
233      "//utils/system/safwk/native/include",
234      "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include",
235      "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy/include",
236    ]
237
238    sources = deviceauth_ipc_files
239    sources += permission_adapter_files
240    sources += [ "${frameworks_path}/src/ipc_sdk.c" ]
241
242    defines = [
243      "__LINUX__",
244      "HILOG_ENABLE",
245    ]
246    cflags = [ "-fPIC" ]
247    cflags += build_flags
248    if (target_cpu == "arm") {
249      cflags += [ "-DBINDER_IPC_32BIT" ]
250    }
251
252    deps = [
253      "${deps_adapter_path}:${hal_module_name}",
254      "//third_party/cJSON:cjson_static",
255      "//utils/native/base:utils",
256    ]
257
258    external_deps = [
259      "access_token:libaccesstoken_sdk",
260      "hiviewdfx_hilog_native:libhilog",
261      "ipc:ipc_core",
262      "samgr_standard:samgr_proxy",
263    ]
264  }
265}
266