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 "//third_party/zlib/contrib/minizip", 31 "../../interfaces/inner_api/include", 32 "//third_party/bounds_checking_function/include", 33 ] 34 35 if (resource_management_support_icu) { 36 include_dirs += [ 37 "//third_party/icu/icu4c/source", 38 "//third_party/icu/icu4c/source/common", 39 "//third_party/icu/icu4c/source/i18n", 40 ] 41 } 42} 43 44manager_sources = [ 45 "src/hap_manager.cpp", 46 "src/hap_resource.cpp", 47 "src/locale_matcher.cpp", 48 "src/lock.cpp", 49 "src/res_config_impl.cpp", 50 "src/res_desc.cpp", 51 "src/res_locale.cpp", 52 "src/resource_manager.cpp", 53 "src/resource_manager_ext_mgr.cpp", 54 "src/resource_manager_impl.cpp", 55 "src/system_resource_manager.cpp", 56 "src/utils/hap_parser.cpp", 57 "src/utils/psue_manager.cpp", 58 "src/utils/string_utils.cpp", 59 "src/utils/utils.cpp", 60] 61 62config("resmgr_public_config") { 63 visibility = [ ":*" ] 64 65 include_dirs = [ "../../interfaces/inner_api/include" ] 66 67 if (resource_management_support_icu) { 68 include_dirs += [ "//third_party/icu/icu4c/source/common" ] 69 defines = [ "SUPPORT_GRAPHICS" ] 70 } 71} 72 73config("global_resmgr_all_deps_config") { 74 include_dirs = [ "../../interfaces/inner_api/include" ] 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 = [ ":resmgr_public_config" ] 91 92 all_dependent_configs = [ ":global_resmgr_all_deps_config" ] 93 94 deps = [ 95 "//third_party/bounds_checking_function:libsec_shared", 96 "//third_party/zlib:shared_libz", 97 ] 98 99 if (resource_management_support_icu) { 100 deps += [ 101 "//third_party/icu/icu4c:shared_icui18n", 102 "//third_party/icu/icu4c:shared_icuuc", 103 ] 104 } 105 106 external_deps = [ 107 "ability_base:extractortool", 108 "hilog:libhilog", 109 "hisysevent:libhisysevent", 110 "hitrace:hitrace_meter", 111 ] 112 113 subsystem_name = "global" 114 innerapi_tags = [ "platformsdk_indirect" ] 115 part_name = "resource_management" 116} 117 118ohos_shared_library("global_resmgr_win") { 119 if (resource_management_support_icu) { 120 defines = [ 121 "__WINNT__", 122 "__EXPORT_MGR__", 123 "__IDE_PREVIEW__", 124 ] 125 cflags = [ 126 "-std=c++17", 127 "-Wno-ignored-attributes", 128 ] 129 130 sources = manager_sources 131 132 configs = [ ":resmgr_config" ] 133 134 public_configs = [ ":resmgr_public_config" ] 135 136 deps = [ 137 "//third_party/icu/icu4c:static_icui18n", 138 "//third_party/icu/icu4c:static_icuuc", 139 "//third_party/zlib:libz", 140 ] 141 142 libs = [ "shlwapi" ] 143 } 144 subsystem_name = "global" 145 part_name = "resource_management" 146} 147 148group("win_resmgr") { 149 if (resource_management_support_icu && is_win) { 150 deps = [ ":global_resmgr_win" ] 151 } 152} 153 154ohos_shared_library("global_resmgr_mac") { 155 if (resource_management_support_icu) { 156 defines = [ "__IDE_PREVIEW__" ] 157 cflags = [ 158 "-std=c++17", 159 "-Wno-ignored-attributes", 160 ] 161 162 sources = manager_sources 163 164 configs = [ ":resmgr_config" ] 165 166 public_configs = [ ":resmgr_public_config" ] 167 168 if (host_os == "mac") { 169 deps = [ 170 "//third_party/bounds_checking_function:libsec_static", 171 "//third_party/icu/icu4c:static_icui18n", 172 "//third_party/icu/icu4c:static_icuuc", 173 "//third_party/zlib:libz", 174 ] 175 } 176 } 177 subsystem_name = "global" 178 part_name = "resource_management" 179} 180 181group("mac_resmgr") { 182 if (resource_management_support_icu && is_mac) { 183 deps = [ ":global_resmgr_mac" ] 184 } 185} 186 187ohos_shared_library("global_resmgr_linux") { 188 if (resource_management_support_icu) { 189 defines = [ 190 "__IDE_PREVIEW__", 191 "__LINUX__", 192 ] 193 cflags = [ 194 "-std=c++17", 195 "-Wno-ignored-attributes", 196 ] 197 198 sources = manager_sources 199 200 configs = [ ":resmgr_config" ] 201 202 public_configs = [ ":resmgr_public_config" ] 203 204 deps = [ 205 "//third_party/bounds_checking_function:libsec_shared", 206 "//third_party/icu/icu4c:shared_icui18n", 207 "//third_party/icu/icu4c:shared_icuuc", 208 "//third_party/zlib:shared_libz", 209 ] 210 } 211 subsystem_name = "global" 212 part_name = "resource_management" 213} 214 215group("linux_resmgr") { 216 if (resource_management_support_icu && is_linux) { 217 deps = [ ":global_resmgr_linux" ] 218 } 219} 220 221ohos_shared_library("librawfile") { 222 output_name = "rawfile" 223 sources = [ "src/raw_file_manager.cpp" ] 224 225 include_dirs = [ 226 "./include", 227 "../../interfaces/native/resource/include", 228 "../../interfaces/inner_api/include", 229 "../../interfaces/js/innerkits/core/include", 230 ] 231 232 if (resource_management_support_icu) { 233 include_dirs += [ "//third_party/icu/icu4c/source/i18n" ] 234 } 235 236 cflags = [ "-Wno-error=inconsistent-missing-override" ] 237 238 deps = [ 239 ":global_resmgr", 240 "../../interfaces/native/resource:librawfile_ndk", 241 ] 242 243 external_deps = [ 244 "ability_base:configuration", 245 "bundle_framework:appexecfwk_base", 246 "c_utils:utils", 247 "hilog:libhilog", 248 "napi:ace_napi", 249 ] 250 251 version_script = 252 get_label_info("../../interfaces/native/resource:librawfile_ndk", 253 "target_gen_dir") + "/" + 254 get_label_info("../../interfaces/native/resource:librawfile_ndk", 255 "name") + version_script_suffix 256 257 subsystem_name = "global" 258 part_name = "resource_management" 259} 260