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