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