1# Copyright (c) 2022-2025 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("../../../../resmgr.gni") 16 17resmgr_napi_core_source = [ 18 "src/resource_manager_addon.cpp", 19 "src/resource_manager_napi_async_impl.cpp", 20 "src/resource_manager_napi_context.cpp", 21 "src/resource_manager_napi_sync_impl.cpp", 22 "src/resource_manager_napi_utils.cpp", 23] 24 25config("resmgr_napi_core_public_config_all") { 26 include_dirs = [ 27 "include", 28 "../../../../dfx/hisysevent_adapter", 29 "../../../../frameworks/resmgr/include", 30 ] 31} 32 33config("resmgr_napi_core_public_config") { 34 visibility = [ ":*" ] 35 36 include_dirs = [ 37 "include", 38 "../../../../frameworks/resmgr/include", 39 ] 40} 41 42ohos_shared_library("resmgr_napi_core") { 43 sources = resmgr_napi_core_source 44 45 sources += [ "../../../../dfx/hisysevent_adapter/hisysevent_adapter.cpp" ] 46 47 defines = [ "CONFIG_HILOG" ] 48 49 version_script = "libresmgr_napi_core.versionscript" 50 51 public_configs = [ ":resmgr_napi_core_public_config_all" ] 52 53 deps = [ "../../../../frameworks/resmgr:global_resmgr" ] 54 55 external_deps = [ 56 "ability_base:configuration", 57 "ability_runtime:app_context", 58 "ace_engine:drawable_descriptor", 59 "bounds_checking_function:libsec_shared", 60 "bundle_framework:appexecfwk_base", 61 "cJSON:cjson", 62 "c_utils:utils", 63 "hilog:libhilog", 64 "hisysevent:libhisysevent", 65 "hitrace:hitrace_meter", 66 "ipc:ipc_single", 67 "napi:ace_napi", 68 ] 69 70 if (resource_management_support_icu) { 71 defines += [ "SUPPORT_GRAPHICS" ] 72 } 73 74 branch_protector_ret = "pac_ret" 75 sanitize = { 76 boundary_sanitize = true 77 cfi = true 78 cfi_cross_dso = true 79 debug = false 80 integer_overflow = true 81 ubsan = true 82 } 83 subsystem_name = "global" 84 innerapi_tags = [ "platformsdk" ] 85 part_name = "resource_management" 86} 87 88group("resmgr_napi_core_preview") { 89 if (is_mingw || is_mac || is_linux) { 90 public_deps = [ ":resmgr_napi_core_preview_inner" ] 91 } 92} 93 94ohos_shared_library("resmgr_napi_core_preview_inner") { 95 if (is_mingw || is_mac || is_linux) { 96 output_name = "resmgr_napi_core_preview" 97 defines = [ "__IDE_PREVIEW__" ] 98 cflags = [ 99 "-std=c++17", 100 "-Wno-ignored-attributes", 101 ] 102 103 sources = resmgr_napi_core_source 104 105 public_configs = [ 106 ":resmgr_napi_core_public_config", 107 "${ability_runtime_path}/frameworks/simulator/common:ability_simulator_common_config", 108 ] 109 110 if (resource_management_support_icu) { 111 defines += [ "SUPPORT_GRAPHICS" ] 112 } 113 114 if (is_mingw) { 115 defines += [ 116 "__WINNT__", 117 "__EXPORT_MGR__", 118 ] 119 deps = [ "../../../../frameworks/resmgr:global_resmgr_win" ] 120 } else if (is_mac) { 121 deps = [ "../../../../frameworks/resmgr:global_resmgr_mac" ] 122 } else if (is_linux) { 123 defines += [ "__LINUX__" ] 124 deps = [ "../../../../frameworks/resmgr:global_resmgr_linux" ] 125 } 126 127 external_deps = [ 128 "ace_engine:drawable_descriptor", 129 "bounds_checking_function:libsec_shared", 130 "cJSON:cjson_static", 131 "graphic_2d:librender_service_client", 132 "hilog:libhilog", 133 "napi:ace_napi", 134 ] 135 } 136 subsystem_name = "global" 137 part_name = "resource_management" 138} 139