1# Copyright (c) 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("../../../begetd.gni")
16
17ohos_shared_library("cj_device_info_ffi") {
18  sanitize = {
19    cfi = true
20    cfi_cross_dso = true
21    debug = false
22  }
23  include_dirs = [
24    "src_deviceinfo",
25    "${init_innerkits_path}/syspara",
26  ]
27
28  if (!defined(defines)) {
29    defines = []
30  }
31
32  if (product_name != "ohos-sdk") {
33    sources = [
34      "src_deviceinfo/device_info.cpp",
35      "src_deviceinfo/device_info_ffi.cpp",
36    ]
37
38    deps = [
39      "${init_innerkits_path}:libbeget_proxy",
40      "${init_innerkits_path}:libbegetutil",
41    ]
42
43    external_deps = [
44      "bounds_checking_function:libsec_shared",
45      "hilog:libhilog",
46      "ipc:ipc_core",
47      "napi:cj_bind_ffi",
48    ]
49  } else {
50    defines += [ "PREVIEWER" ]
51    sources = [ "src_deviceinfo/device_info_mock.cpp" ]
52  }
53
54  if (current_os == "ohos") {
55    defines += [ "OHOS_PLATFORM" ]
56  }
57
58  if (current_os == "mingw") {
59    defines += [ "WINDOWS_PLATFORM" ]
60  }
61
62  innerapi_tags = [ "platformsdk" ]
63  subsystem_name = "startup"
64  part_name = "init"
65}
66
67ohos_shared_library("cj_system_parameter_enhance_ffi") {
68  include_dirs = [ "src_enhance" ]
69  sanitize = {
70    cfi = true
71    cfi_cross_dso = true
72    debug = false
73  }
74
75  symlink_target_name = [ "libsystemparameterv9.z.so" ]
76
77  if (!defined(defines)) {
78    defines = []
79  }
80
81  if (product_name != "ohos-sdk") {
82    sources = [ "src_enhance/system_parameter_ffi.cpp" ]
83
84    deps = [
85      "../../innerkits:libbeget_proxy",
86      "../../innerkits:libbegetutil",
87    ]
88
89    external_deps = [
90      "c_utils:utils",
91      "napi:cj_bind_ffi",
92    ]
93  } else {
94    defines += [ "PREVIEWER" ]
95    sources = [ "src_enhance/system_parameter_mock.cpp" ]
96  }
97
98  if (current_os == "ohos") {
99    defines += [ "OHOS_PLATFORM" ]
100  }
101
102  if (current_os == "mingw") {
103    defines += [ "WINDOWS_PLATFORM" ]
104  }
105
106  innerapi_tags = [ "platformsdk" ]
107  subsystem_name = "startup"
108  part_name = "init"
109}
110