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_ffi",
48    "napi:cj_bind_native",
49  ]
50
51  sources = [
52    "cj_ability_delegator.cpp",
53    "cj_ability_delegator_args.cpp",
54    "cj_ability_lifecycle_callback.cpp",
55    "cj_application_context.cpp",
56    "cj_application_state_change_callback.cpp",
57    "cj_element_name_ffi.cpp",
58    "cj_environment_callback.cpp",
59    "cj_utils_ffi.cpp",
60    "cj_want_ffi.cpp",
61  ]
62
63  cflags = [
64    "-fstack-protector-all",
65    "-fstack-protector-strong",
66    "-O2",
67    "-D_FORTIFY_SOURCE=2",
68  ]
69
70  cflags_cc = cflags
71
72  subsystem_name = "ability"
73  part_name = "ability_runtime"
74}
75