1# Copyright (C) 2022-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("//foundation/distributeddatamgr/pasteboard/pasteboard.gni")
16
17ohos_shared_library("cj_pasteboard_ffi") {
18  include_dirs = [
19    "${pasteboard_innerkits_path}/include",
20    "${pasteboard_root_path}/framework/tlv",
21    "${pasteboard_root_path}/framework/uri",
22    "${pasteboard_utils_path}/native/include",
23    "include",
24  ]
25
26  sanitize = {
27    ubsan = true
28    boundary_sanitize = true
29    cfi = true
30    cfi_cross_dso = true
31    cfi_vcall_icall_only = true
32    debug = false
33  }
34
35  cflags = [
36    "-fPIC",
37    "-g3",
38  ]
39
40  cflags_cc = [
41    "-fstack-protector",
42    "-D_FORTIFY_SOURCE=2",
43    "-O2",
44  ]
45
46  if (!defined(defines)) {
47    defines = []
48  }
49
50  if (product_name != "ohos-sdk") {
51    deps = [ "${pasteboard_innerkits_path}:pasteboard_client" ]
52    external_deps = [
53      "ability_base:want",
54      "ability_base:zuri",
55      "ability_runtime:napi_common",
56      "c_utils:utils",
57      "hilog:libhilog",
58      "image_framework:cj_image_ffi",
59      "image_framework:image_native",
60      "ipc:ipc_core",
61      "napi:ace_napi",
62      "napi:cj_bind_ffi",
63      "napi:cj_bind_native",
64    ]
65    sources = [
66      "src/paste_data_impl.cpp",
67      "src/paste_data_record_impl.cpp",
68      "src/pasteboard_ffi.cpp",
69      "src/system_pasteboard_impl.cpp",
70    ]
71  } else {
72    defines += [ "PREVIEWER" ]
73    sources = [ "src/pasteboard_mock.cpp" ]
74  }
75
76  if (current_os == "ohos") {
77    defines += [ "OHOS_PLATFORM" ]
78  }
79
80  if (current_os == "mingw") {
81    defines += [ "WINDOWS_PLATFORM" ]
82  }
83
84  innerapi_tags = [ "platformsdk" ]
85
86  subsystem_name = "distributeddatamgr"
87  part_name = "pasteboard"
88}
89