1# Copyright (c) 2021-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 17config("resmgr_config") { 18 include_dirs = [ 19 "include", 20 "../../interfaces/inner_api/include", 21 ] 22} 23 24manager_sources = [ 25 "src/hap_manager.cpp", 26 "src/hap_parser_v1.cpp", 27 "src/hap_parser_v2.cpp", 28 "src/hap_parser.cpp", 29 "src/hap_resource_manager.cpp", 30 "src/hap_resource_v1.cpp", 31 "src/hap_resource_v2.cpp", 32 "src/hap_resource.cpp", 33 "src/locale_matcher.cpp", 34 "src/mmap_file.cpp", 35 "src/res_config_impl.cpp", 36 "src/res_desc.cpp", 37 "src/res_locale.cpp", 38 "src/resource_manager.cpp", 39 "src/resource_manager_ext_mgr.cpp", 40 "src/resource_manager_impl.cpp", 41 "src/system_resource_manager.cpp", 42 "src/theme_pack_config.cpp", 43 "src/theme_pack_manager.cpp", 44 "src/theme_pack_resource.cpp", 45 "src/utils/psue_manager.cpp", 46 "src/utils/string_utils.cpp", 47 "src/utils/utils.cpp", 48] 49 50config("resmgr_public_config") { 51 visibility = [ ":*" ] 52 53 include_dirs = [ "../../interfaces/inner_api/include" ] 54 55 if (resource_management_support_icu) { 56 defines = [ "SUPPORT_GRAPHICS" ] 57 } 58} 59 60config("global_resmgr_all_deps_config") { 61 include_dirs = [ "../../interfaces/inner_api/include" ] 62} 63 64config("rawfile_public_config") { 65 include_dirs = [ 66 "./include", 67 "../../interfaces/native/resource/include", 68 ] 69} 70 71ohos_shared_library("global_resmgr") { 72 sources = manager_sources 73 74 sources += [ "../../dfx/hisysevent_adapter/hisysevent_adapter.cpp" ] 75 76 defines = [ "CONFIG_HILOG" ] 77 78 if (is_asan) { 79 defines += ["SUPPORT_ASAN"] 80 } 81 82 configs = [ ":resmgr_config" ] 83 84 version_script = "libresmgr.versionscript" 85 86 include_dirs = [ "../../dfx/hisysevent_adapter" ] 87 88 public_configs = [ 89 ":resmgr_public_config", 90 ":global_resmgr_all_deps_config", 91 ] 92 93 external_deps = [ 94 "ability_base:extractortool", 95 "bounds_checking_function:libsec_shared", 96 "cJSON:cjson", 97 "hilog:libhilog", 98 "hisysevent:libhisysevent", 99 "hitrace:hitrace_meter", 100 "init:libbegetutil", 101 "zlib:shared_libz", 102 ] 103 104 if (resource_management_support_icu) { 105 external_deps += [ "icu:shared_icui18n" ] 106 public_external_deps = [ "icu:shared_icuuc" ] 107 } 108 109 branch_protector_ret = "pac_ret" 110 sanitize = { 111 boundary_sanitize = true 112 cfi = true 113 cfi_cross_dso = true 114 debug = false 115 integer_overflow = true 116 ubsan = true 117 } 118 subsystem_name = "global" 119 innerapi_tags = [ 120 "platformsdk_indirect", 121 "sasdk", 122 ] 123 part_name = "resource_management" 124} 125 126ohos_shared_library("global_resmgr_win") { 127 if (resource_management_support_icu) { 128 defines = [ 129 "__WINNT__", 130 "__EXPORT_MGR__", 131 "__IDE_PREVIEW__", 132 ] 133 cflags = [ 134 "-std=c++17", 135 "-Wno-ignored-attributes", 136 ] 137 138 sources = manager_sources 139 140 configs = [ ":resmgr_config" ] 141 142 public_configs = [ ":resmgr_public_config" ] 143 144 external_deps = [ 145 "bounds_checking_function:libsec_shared", 146 "cJSON:cjson_static", 147 "icu:static_icui18n", 148 "zlib:libz", 149 ] 150 public_external_deps = [ "icu:static_icuuc" ] 151 152 libs = [ "shlwapi" ] 153 } 154 subsystem_name = "global" 155 part_name = "resource_management" 156} 157 158group("win_resmgr") { 159 if (is_mingw && resource_management_support_icu) { 160 public_deps = [ ":global_resmgr_win" ] 161 } 162} 163 164ohos_shared_library("global_resmgr_mac") { 165 if (resource_management_support_icu) { 166 defines = [ "__IDE_PREVIEW__" ] 167 cflags = [ 168 "-std=c++17", 169 "-Wno-ignored-attributes", 170 ] 171 172 sources = manager_sources 173 174 configs = [ ":resmgr_config" ] 175 176 public_configs = [ ":resmgr_public_config" ] 177 178 if (host_os == "mac") { 179 external_deps = [ 180 "bounds_checking_function:libsec_static", 181 "cJSON:cjson_static", 182 "icu:static_icui18n", 183 "zlib:libz", 184 ] 185 public_external_deps = [ "icu:static_icuuc" ] 186 } 187 } 188 subsystem_name = "global" 189 part_name = "resource_management" 190} 191 192group("mac_resmgr") { 193 if (is_mac && resource_management_support_icu) { 194 public_deps = [ ":global_resmgr_mac" ] 195 } 196} 197 198ohos_shared_library("global_resmgr_linux") { 199 if (resource_management_support_icu) { 200 defines = [ 201 "__IDE_PREVIEW__", 202 "__LINUX__", 203 ] 204 cflags = [ 205 "-std=c++17", 206 "-Wno-ignored-attributes", 207 ] 208 209 sources = manager_sources 210 211 configs = [ ":resmgr_config" ] 212 213 public_configs = [ ":resmgr_public_config" ] 214 215 external_deps = [ 216 "bounds_checking_function:libsec_shared", 217 "cJSON:cjson_static", 218 "icu:shared_icui18n", 219 "zlib:shared_libz", 220 ] 221 public_external_deps = [ "icu:shared_icuuc" ] 222 } 223 subsystem_name = "global" 224 part_name = "resource_management" 225} 226 227group("linux_resmgr") { 228 if (is_linux && resource_management_support_icu) { 229 deps = [ ":global_resmgr_linux" ] 230 } 231} 232 233ohos_shared_library("librawfile") { 234 output_name = "rawfile" 235 public_configs = [ ":rawfile_public_config" ] 236 sources = [ "src/raw_file_manager.cpp" ] 237 238 defines = [ "CONFIG_HILOG" ] 239 240 version_script = "librawfile.versionscript" 241 242 include_dirs = [ 243 "./include", 244 "../../interfaces/native/resource/include", 245 "../../interfaces/inner_api/include", 246 "../../interfaces/js/innerkits/core/include", 247 ] 248 249 cflags = [ "-Wno-error=inconsistent-missing-override" ] 250 251 deps = [ ":global_resmgr" ] 252 253 external_deps = [ 254 "ability_base:configuration", 255 "ability_runtime:app_context", 256 "bundle_framework:appexecfwk_base", 257 "cJSON:cjson_static", 258 "c_utils:utils", 259 "hilog:libhilog", 260 "ipc:ipc_single", 261 "napi:ace_napi", 262 ] 263 264 if (resource_management_support_icu) { 265 external_deps += [ "icu:shared_icuuc" ] 266 } 267 268 stack_protector_ret = true 269 sanitize = { 270 boundary_sanitize = true 271 cfi = true 272 cfi_cross_dso = true 273 debug = false 274 integer_overflow = true 275 ubsan = true 276 } 277 subsystem_name = "global" 278 part_name = "resource_management" 279} 280 281ohos_shared_library("ohresmgr") { 282 public_configs = [ ":rawfile_public_config" ] 283 sources = [ "src/native_resource_manager.cpp" ] 284 output_extension = "so" 285 output_name = "ohresmgr" 286 287 defines = [ "CONFIG_HILOG" ] 288 289 include_dirs = [ 290 "./include", 291 "../../interfaces/native/resource/include", 292 "../../interfaces/inner_api/include", 293 "../../interfaces/js/innerkits/core/include", 294 ] 295 296 cflags = [ "-Wno-error=inconsistent-missing-override" ] 297 298 deps = [ ":global_resmgr" ] 299 300 external_deps = [ 301 "ability_base:configuration", 302 "ace_engine:ace_ndk", 303 "ace_engine:drawable_descriptor", 304 "bundle_framework:appexecfwk_base", 305 "cJSON:cjson_static", 306 "c_utils:utils", 307 "hilog:libhilog", 308 "napi:ace_napi", 309 ] 310 311 stack_protector_ret = true 312 sanitize = { 313 boundary_sanitize = true 314 cfi = true 315 cfi_cross_dso = true 316 debug = false 317 integer_overflow = true 318 ubsan = true 319 } 320 innerapi_tags = [ "ndk" ] 321 subsystem_name = "global" 322 part_name = "resource_management" 323} 324