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 18config("cj_ability_public_config") { 19 visibility = [ 20 ":*", 21 "../../../test/unittest/*", 22 ] 23 include_dirs = [ "application_context/include" ] 24} 25 26ohos_shared_library("cj_ability_ffi") { 27 defines = [ 28 "AMS_LOG_TAG = \"CJ_ABILITY_FFI\"", 29 "AMS_LOG_DOMAIN = 0xD001150", 30 ] 31 32 branch_protector_ret = "pac_ret" 33 34 sanitize = { 35 cfi = true 36 cfi_cross_dso = true 37 debug = false 38 } 39 include_dirs = [ 40 "${ability_runtime_napi_path}/ability_auto_startup_callback", 41 "${ability_runtime_path}/interfaces/inner_api/runtime/include", 42 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_delegator/", 43 "${ability_runtime_path}/interfaces/kits/native/ability/native", 44 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", 45 "${ability_runtime_path}/tools/aa/include", 46 "${ability_runtime_path}/frameworks/cj/ffi", 47 "${ability_runtime_path}/frameworks/cj/ffi/context", 48 "${ability_runtime_services_path}/common/include", 49 ] 50 51 public_configs = [ ":cj_ability_public_config" ] 52 53 deps = [ 54 "${ability_runtime_innerkits_path}/app_manager:app_manager", 55 "${ability_runtime_innerkits_path}/runtime:runtime", 56 "${ability_runtime_native_path}/ability/native:auto_startup_callback", 57 "${ability_runtime_native_path}/appkit:app_context", 58 "${ability_runtime_native_path}/appkit:app_context_utils", 59 "${ability_runtime_native_path}/appkit:appkit_delegator", 60 ] 61 62 external_deps = [ 63 "ability_base:want", 64 "bundle_framework:appexecfwk_core", 65 "c_utils:utils", 66 "eventhandler:libeventhandler", 67 "hilog:libhilog", 68 "ipc:ipc_core", 69 "napi:ace_napi", 70 "napi:cj_bind_ffi", 71 "napi:cj_bind_native", 72 ] 73 74 sources = [ 75 "application_context/src/cj_ability_lifecycle_callback_impl.cpp", 76 "application_context/src/cj_application_context.cpp", 77 "application_context/src/cj_application_state_change_callback.cpp", 78 "application_context/src/cj_environment_callback.cpp", 79 "application_context/src/cj_utils_ffi.cpp", 80 "cj_application_context_ffi.cpp", 81 "cj_element_name_ffi.cpp", 82 "cj_want_ffi.cpp", 83 ] 84 85 if (cj_frontend) { 86 sources += [ 87 "cj_ability_delegator.cpp", 88 "cj_ability_delegator_args.cpp", 89 "cj_ability_monitor.cpp", 90 "cj_ability_monitor_object.cpp", 91 ] 92 93 defines += [ "CJ_FRONTEND" ] 94 } 95 96 cflags = [ 97 "-O2", 98 "-D_FORTIFY_SOURCE=2", 99 ] 100 101 cflags_cc = cflags 102 103 subsystem_name = "ability" 104 part_name = "ability_runtime" 105} 106