1# Copyright (c) 2024 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
16rust_cxx("system_ability_fwk_rust_gen") {
17  sources = [ "src/wrapper.rs" ]
18}
19
20ohos_static_library("system_ability_fwk_rust_cxx") {
21  sanitize = {
22    cfi = true
23    cfi_cross_dso = true
24    debug = false
25    cfi_no_nvcall = true
26    blocklist = "../../../../cfi_blocklist.txt"
27  }
28
29  sources = [ "src/cxx/system_ability_wrapper.cpp" ]
30  sources += get_target_outputs(":system_ability_fwk_rust_gen")
31
32  include_dirs = [
33    "${target_gen_dir}/src",
34    "include",
35  ]
36  external_deps = [
37    "hilog:libhilog",
38    "samgr:samgr_proxy",
39  ]
40  deps = [
41    ":system_ability_fwk_rust_gen",
42    "../../safwk:system_ability_fwk",
43    "//third_party/rust/crates/cxx:cxx_cppdeps",
44  ]
45
46  subsystem_name = "systemabilitymgr"
47  part_name = "safwk"
48}
49
50ohos_rust_shared_library("system_ability_fwk_rust") {
51  crate_name = "system_ability_fwk"
52
53  sources = [ "src/lib.rs" ]
54
55  rustflags = [ "-Zstack-protector=all" ]
56
57  deps = [
58    ":system_ability_fwk_rust_cxx",
59    "//third_party/rust/crates/cxx:lib",
60  ]
61
62  external_deps = [
63    "hilog:hilog_rust",
64    "ipc:ipc_rust",
65  ]
66
67  install_images = [ system_base_dir ]
68  relative_install_dir = "chipset-pub-sdk"
69
70  subsystem_name = "systemabilitymgr"
71  part_name = "safwk"
72}
73