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