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