1# Copyright (C) 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 14import("//build/ohos.gni") 15 16SUBSYSTEM_DIR = "//foundation/communication/ipc" 17 18rust_cxx("ipc_cxx_gen") { 19 sources = [ 20 "src/parcel/wrapper.rs", 21 "src/remote/wrapper.rs", 22 "src/skeleton.rs", 23 ] 24} 25 26config("libipc_c_private_config") { 27 cflags_cc = [ 28 "-DCONFIG_IPC_SINGLE", 29 "-O2", 30 ] 31} 32 33ohos_static_library("ipc_rust_cxx") { 34 branch_protector_ret = "pac_ret" 35 sources = [ 36 "src/cxx/parcel_wrapper.cpp", 37 "src/cxx/remote_object_wrapper.cpp", 38 "src/cxx/skeleton_wrapper.cpp", 39 ] 40 sources += get_target_outputs(":ipc_cxx_gen") 41 42 include_dirs = [ 43 "include", 44 "${target_gen_dir}/src", 45 ] 46 47 configs = [ ":libipc_c_private_config" ] 48 49 deps = [ 50 ":ipc_cxx_gen", 51 "$SUBSYSTEM_DIR/interfaces/innerkits/ipc_single:ipc_single", 52 "//third_party/rust/crates/cxx:cxx_cppdeps", 53 ] 54 55 external_deps = [ 56 "c_utils:utils", 57 "hilog:libhilog", 58 ] 59 60 subsystem_name = "communication" 61 part_name = "ipc" 62} 63 64ohos_rust_shared_library("ipc_rust") { 65 crate_name = "ipc" 66 edition = "2021" 67 68 sources = [ "src/lib.rs" ] 69 70 rustflags = [ "-Zstack-protector=all" ] 71 72 deps = [ 73 ":ipc_rust_cxx", 74 "//third_party/rust/crates/cxx:lib", 75 ] 76 77 external_deps = [ 78 "hilog:hilog_rust", 79 "ylong_runtime:ylong_runtime", 80 ] 81 82 install_images = [ system_base_dir ] 83 subsystem_name = "communication" 84 part_name = "ipc" 85} 86 87group("rust_ipc_component") { 88 deps = [ ":ipc_rust" ] 89} 90