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