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")
15import("//foundation/ability/ability_runtime/ability_runtime.gni")
16import("//foundation/ability/ability_runtime/cj_environment/cj_environment.gni")
17
18ohos_shared_library("cj_ability_ffi") {
19  defines = [
20    "AMS_LOG_TAG = \"CJ_ABILITY_FFI\"",
21    "AMS_LOG_DOMAIN = 0xD001150",
22  ]
23  sanitize = {
24    cfi = true
25    cfi_cross_dso = true
26    debug = false
27  }
28  include_dirs = [
29    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_delegator/",
30    "${ability_runtime_path}/interfaces/kits/native/ability/native",
31    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
32    "${ability_runtime_path}/tools/aa/include",
33    "${ability_runtime_path}/frameworks/cj/ffi",
34    "${ability_runtime_services_path}/common/include",
35  ]
36
37  deps = [
38    "${ability_runtime_native_path}/appkit:app_context",
39    "${ability_runtime_native_path}/appkit:appkit_delegator",
40  ]
41
42  external_deps = [
43    "ability_base:want",
44    "bundle_framework:appexecfwk_core",
45    "c_utils:utils",
46    "hilog:libhilog",
47    "napi:cj_bind_native",
48  ]
49
50  sources = [
51    "cj_ability_delegator.cpp",
52    "cj_application_context.cpp",
53    "cj_element_name_ffi.cpp",
54    "cj_utils_ffi.cpp",
55    "cj_want_ffi.cpp",
56  ]
57
58  cflags = [
59    "-fstack-protector-all",
60    "-fstack-protector-strong",
61    "-O2",
62    "-D_FORTIFY_SOURCE=2",
63  ]
64
65  cflags_cc = cflags
66
67  subsystem_name = "ability"
68  part_name = "ability_runtime"
69}
70