1bc03f14fSopenharmony_ci# Copyright (C) 2022-2023 Huawei Device Co., Ltd.
2bc03f14fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3bc03f14fSopenharmony_ci# you may not use this file except in compliance with the License.
4bc03f14fSopenharmony_ci# You may obtain a copy of the License at
5bc03f14fSopenharmony_ci#
6bc03f14fSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7bc03f14fSopenharmony_ci#
8bc03f14fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9bc03f14fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10bc03f14fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11bc03f14fSopenharmony_ci# See the License for the specific language governing permissions and
12bc03f14fSopenharmony_ci# limitations under the License.
13bc03f14fSopenharmony_ci
14bc03f14fSopenharmony_ciimport("//build/ohos.gni")
15bc03f14fSopenharmony_ciimport("//foundation/distributeddatamgr/pasteboard/pasteboard.gni")
16bc03f14fSopenharmony_ci
17bc03f14fSopenharmony_ciohos_shared_library("cj_pasteboard_ffi") {
18bc03f14fSopenharmony_ci  include_dirs = [
19bc03f14fSopenharmony_ci    "${pasteboard_innerkits_path}/include",
20bc03f14fSopenharmony_ci    "${pasteboard_root_path}/framework/tlv",
21bc03f14fSopenharmony_ci    "${pasteboard_root_path}/framework/uri",
22bc03f14fSopenharmony_ci    "${pasteboard_utils_path}/native/include",
23bc03f14fSopenharmony_ci    "include",
24bc03f14fSopenharmony_ci  ]
25bc03f14fSopenharmony_ci
26bc03f14fSopenharmony_ci  sanitize = {
27bc03f14fSopenharmony_ci    ubsan = true
28bc03f14fSopenharmony_ci    boundary_sanitize = true
29bc03f14fSopenharmony_ci    cfi = true
30bc03f14fSopenharmony_ci    cfi_cross_dso = true
31bc03f14fSopenharmony_ci    cfi_vcall_icall_only = true
32bc03f14fSopenharmony_ci    debug = false
33bc03f14fSopenharmony_ci  }
34bc03f14fSopenharmony_ci
35bc03f14fSopenharmony_ci  cflags = [
36bc03f14fSopenharmony_ci    "-fPIC",
37bc03f14fSopenharmony_ci    "-g3",
38bc03f14fSopenharmony_ci  ]
39bc03f14fSopenharmony_ci
40bc03f14fSopenharmony_ci  cflags_cc = [
41bc03f14fSopenharmony_ci    "-fstack-protector",
42bc03f14fSopenharmony_ci    "-D_FORTIFY_SOURCE=2",
43bc03f14fSopenharmony_ci    "-O2",
44bc03f14fSopenharmony_ci  ]
45bc03f14fSopenharmony_ci
46bc03f14fSopenharmony_ci  if (!defined(defines)) {
47bc03f14fSopenharmony_ci    defines = []
48bc03f14fSopenharmony_ci  }
49bc03f14fSopenharmony_ci
50bc03f14fSopenharmony_ci  if (product_name != "ohos-sdk") {
51bc03f14fSopenharmony_ci    deps = [ "${pasteboard_innerkits_path}:pasteboard_client" ]
52bc03f14fSopenharmony_ci    external_deps = [
53bc03f14fSopenharmony_ci      "ability_base:want",
54bc03f14fSopenharmony_ci      "ability_base:zuri",
55bc03f14fSopenharmony_ci      "ability_runtime:napi_common",
56bc03f14fSopenharmony_ci      "c_utils:utils",
57bc03f14fSopenharmony_ci      "hilog:libhilog",
58bc03f14fSopenharmony_ci      "image_framework:cj_image_ffi",
59bc03f14fSopenharmony_ci      "image_framework:image_native",
60bc03f14fSopenharmony_ci      "ipc:ipc_core",
61bc03f14fSopenharmony_ci      "napi:ace_napi",
62bc03f14fSopenharmony_ci      "napi:cj_bind_ffi",
63bc03f14fSopenharmony_ci      "napi:cj_bind_native",
64bc03f14fSopenharmony_ci    ]
65bc03f14fSopenharmony_ci    sources = [
66bc03f14fSopenharmony_ci      "src/paste_data_impl.cpp",
67bc03f14fSopenharmony_ci      "src/paste_data_record_impl.cpp",
68bc03f14fSopenharmony_ci      "src/pasteboard_ffi.cpp",
69bc03f14fSopenharmony_ci      "src/system_pasteboard_impl.cpp",
70bc03f14fSopenharmony_ci    ]
71bc03f14fSopenharmony_ci  } else {
72bc03f14fSopenharmony_ci    defines += [ "PREVIEWER" ]
73bc03f14fSopenharmony_ci    sources = [ "src/pasteboard_mock.cpp" ]
74bc03f14fSopenharmony_ci  }
75bc03f14fSopenharmony_ci
76bc03f14fSopenharmony_ci  if (current_os == "ohos") {
77bc03f14fSopenharmony_ci    defines += [ "OHOS_PLATFORM" ]
78bc03f14fSopenharmony_ci  }
79bc03f14fSopenharmony_ci
80bc03f14fSopenharmony_ci  if (current_os == "mingw") {
81bc03f14fSopenharmony_ci    defines += [ "WINDOWS_PLATFORM" ]
82bc03f14fSopenharmony_ci  }
83bc03f14fSopenharmony_ci
84bc03f14fSopenharmony_ci  innerapi_tags = [ "platformsdk" ]
85bc03f14fSopenharmony_ci
86bc03f14fSopenharmony_ci  subsystem_name = "distributeddatamgr"
87bc03f14fSopenharmony_ci  part_name = "pasteboard"
88bc03f14fSopenharmony_ci}
89