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_context_ffi_public_config") { 19 visibility = [ 20 ":*", 21 "${ability_runtime_native_path}/ability/*", 22 ] 23 include_dirs = [ "${ability_runtime_path}/frameworks/cj/ffi/context" ] 24} 25 26ohos_shared_library("cj_context_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_path}/interfaces/kits/native/ability/native", 41 "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context", 42 "${ability_runtime_path}/frameworks/cj/ffi", 43 "${ability_runtime_path}/frameworks/cj/ffi/context", 44 "${ability_runtime_path}/frameworks/cj/ffi/application_context/include", 45 "${ability_runtime_services_path}/common/include", 46 ] 47 48 public_configs = [ ":cj_context_ffi_public_config" ] 49 50 deps = [ 51 "${ability_runtime_innerkits_path}/ability_manager:ability_manager", 52 "${ability_runtime_native_path}/appkit:app_context", 53 "${ability_runtime_native_path}/appkit:app_context_utils", 54 "${ability_runtime_path}/frameworks/cj/ffi:cj_ability_ffi", 55 ] 56 57 external_deps = [ 58 "bundle_framework:appexecfwk_base", 59 "bundle_framework:cj_bundle_manager_ffi", 60 "c_utils:utils", 61 "eventhandler:libeventhandler", 62 "hilog:libhilog", 63 "ipc:ipc_core", 64 "ipc:ipc_napi", 65 "napi:ace_napi", 66 "napi:cj_bind_ffi", 67 "napi:cj_bind_native", 68 ] 69 70 sources = [ "cj_context.cpp" ] 71 72 cflags = [ 73 "-O2", 74 "-D_FORTIFY_SOURCE=2", 75 ] 76 77 cflags_cc = cflags 78 79 innerapi_tags = [ "platformsdk" ] 80 subsystem_name = "ability" 81 part_name = "ability_runtime" 82} 83