1eace7efcSopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd.
2eace7efcSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3eace7efcSopenharmony_ci# you may not use this file except in compliance with the License.
4eace7efcSopenharmony_ci# You may obtain a copy of the License at
5eace7efcSopenharmony_ci#
6eace7efcSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7eace7efcSopenharmony_ci#
8eace7efcSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9eace7efcSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10eace7efcSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11eace7efcSopenharmony_ci# See the License for the specific language governing permissions and
12eace7efcSopenharmony_ci# limitations under the License.
13eace7efcSopenharmony_ci
14eace7efcSopenharmony_ciimport("//build/ohos.gni")
15eace7efcSopenharmony_ciimport("//foundation/ability/ability_runtime/ability_runtime.gni")
16eace7efcSopenharmony_ciimport("//foundation/ability/ability_runtime/cj_environment/cj_environment.gni")
17eace7efcSopenharmony_ci
18eace7efcSopenharmony_ciohos_shared_library("cj_ability_ffi") {
19eace7efcSopenharmony_ci  defines = [
20eace7efcSopenharmony_ci    "AMS_LOG_TAG = \"CJ_ABILITY_FFI\"",
21eace7efcSopenharmony_ci    "AMS_LOG_DOMAIN = 0xD001150",
22eace7efcSopenharmony_ci  ]
23eace7efcSopenharmony_ci  sanitize = {
24eace7efcSopenharmony_ci    cfi = true
25eace7efcSopenharmony_ci    cfi_cross_dso = true
26eace7efcSopenharmony_ci    debug = false
27eace7efcSopenharmony_ci  }
28eace7efcSopenharmony_ci  include_dirs = [
29eace7efcSopenharmony_ci    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_delegator/",
30eace7efcSopenharmony_ci    "${ability_runtime_path}/interfaces/kits/native/ability/native",
31eace7efcSopenharmony_ci    "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
32eace7efcSopenharmony_ci    "${ability_runtime_path}/tools/aa/include",
33eace7efcSopenharmony_ci    "${ability_runtime_path}/frameworks/cj/ffi",
34eace7efcSopenharmony_ci    "${ability_runtime_services_path}/common/include",
35eace7efcSopenharmony_ci  ]
36eace7efcSopenharmony_ci
37eace7efcSopenharmony_ci  deps = [
38eace7efcSopenharmony_ci    "${ability_runtime_native_path}/appkit:app_context",
39eace7efcSopenharmony_ci    "${ability_runtime_native_path}/appkit:appkit_delegator",
40eace7efcSopenharmony_ci  ]
41eace7efcSopenharmony_ci
42eace7efcSopenharmony_ci  external_deps = [
43eace7efcSopenharmony_ci    "ability_base:want",
44eace7efcSopenharmony_ci    "bundle_framework:appexecfwk_core",
45eace7efcSopenharmony_ci    "c_utils:utils",
46eace7efcSopenharmony_ci    "hilog:libhilog",
47eace7efcSopenharmony_ci    "napi:cj_bind_ffi",
48eace7efcSopenharmony_ci    "napi:cj_bind_native",
49eace7efcSopenharmony_ci  ]
50eace7efcSopenharmony_ci
51eace7efcSopenharmony_ci  sources = [
52eace7efcSopenharmony_ci    "cj_ability_delegator.cpp",
53eace7efcSopenharmony_ci    "cj_ability_delegator_args.cpp",
54eace7efcSopenharmony_ci    "cj_ability_lifecycle_callback.cpp",
55eace7efcSopenharmony_ci    "cj_application_context.cpp",
56eace7efcSopenharmony_ci    "cj_application_state_change_callback.cpp",
57eace7efcSopenharmony_ci    "cj_element_name_ffi.cpp",
58eace7efcSopenharmony_ci    "cj_environment_callback.cpp",
59eace7efcSopenharmony_ci    "cj_utils_ffi.cpp",
60eace7efcSopenharmony_ci    "cj_want_ffi.cpp",
61eace7efcSopenharmony_ci  ]
62eace7efcSopenharmony_ci
63eace7efcSopenharmony_ci  cflags = [
64eace7efcSopenharmony_ci    "-fstack-protector-all",
65eace7efcSopenharmony_ci    "-fstack-protector-strong",
66eace7efcSopenharmony_ci    "-O2",
67eace7efcSopenharmony_ci    "-D_FORTIFY_SOURCE=2",
68eace7efcSopenharmony_ci  ]
69eace7efcSopenharmony_ci
70eace7efcSopenharmony_ci  cflags_cc = cflags
71eace7efcSopenharmony_ci
72eace7efcSopenharmony_ci  subsystem_name = "ability"
73eace7efcSopenharmony_ci  part_name = "ability_runtime"
74eace7efcSopenharmony_ci}
75