• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//base/global/resource_management/resmgr.gni")
15import("//build/ohos.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    "//base/global/resource_management/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    defines = [ "SUPPORT_GRAPHICS" ]
42  }
43}
44
45manager_sources = [
46  "src/hap_manager.cpp",
47  "src/hap_resource.cpp",
48  "src/locale_matcher.cpp",
49  "src/lock.cpp",
50  "src/res_config_impl.cpp",
51  "src/res_desc.cpp",
52  "src/res_locale.cpp",
53  "src/resource_manager_impl.cpp",
54  "src/utils/hap_parser.cpp",
55  "src/utils/psue_manager.cpp",
56  "src/utils/string_utils.cpp",
57  "src/utils/utils.cpp",
58]
59
60config("resmgr_public_config") {
61  visibility = [ ":*" ]
62
63  include_dirs =
64      [ "//base/global/resource_management/interfaces/inner_api/include" ]
65
66  if (resource_management_support_icu) {
67    include_dirs += [ "//third_party/icu/icu4c/source/common" ]
68    defines = [ "SUPPORT_GRAPHICS" ]
69  }
70}
71
72config("global_resmgr_all_deps_config") {
73  include_dirs =
74      [ "//base/global/resource_management/interfaces/inner_api/include" ]
75}
76
77ohos_shared_library("global_resmgr") {
78  sources = manager_sources
79
80  sources += [ "//base/global/resource_management/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 = [ "//base/global/resource_management/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    defines += [ "SUPPORT_GRAPHICS" ]
105  }
106
107  external_deps = [
108    "hisysevent_native:libhisysevent",
109    "hitrace_native:hitrace_meter",
110    "hiviewdfx_hilog_native:libhilog",
111  ]
112
113  subsystem_name = "global"
114  part_name = "resource_management"
115}
116
117ohos_shared_library("global_resmgr_win") {
118  if (resource_management_support_icu) {
119    defines = [
120      "__WINNT__",
121      "__EXPORT_MGR__",
122      "__IDE_PREVIEW__",
123    ]
124    cflags = [
125      "-std=c++17",
126      "-Wno-ignored-attributes",
127    ]
128
129    sources = manager_sources
130
131    configs = [ ":resmgr_config" ]
132
133    public_configs = [ ":resmgr_public_config" ]
134
135    deps = [
136      "//third_party/icu/icu4c:static_icui18n",
137      "//third_party/icu/icu4c:static_icuuc",
138      "//third_party/zlib:libz",
139    ]
140
141    libs = [ "shlwapi" ]
142  }
143  subsystem_name = "global"
144  part_name = "resource_management"
145}
146
147group("win_resmgr") {
148  if (resource_management_support_icu && is_win) {
149    deps = [ ":global_resmgr_win" ]
150  }
151}
152
153ohos_shared_library("global_resmgr_mac") {
154  if (resource_management_support_icu) {
155    defines = [ "__IDE_PREVIEW__" ]
156    cflags = [
157      "-std=c++17",
158      "-Wno-ignored-attributes",
159    ]
160
161    sources = manager_sources
162
163    configs = [ ":resmgr_config" ]
164
165    public_configs = [ ":resmgr_public_config" ]
166
167    if (host_os == "mac") {
168      deps = [
169        "//third_party/bounds_checking_function:libsec_static",
170        "//third_party/icu/icu4c:static_icui18n",
171        "//third_party/icu/icu4c:static_icuuc",
172        "//third_party/zlib:libz",
173      ]
174    }
175  }
176  subsystem_name = "global"
177  part_name = "resource_management"
178}
179
180group("mac_resmgr") {
181  if (resource_management_support_icu && is_mac) {
182    deps = [ ":global_resmgr_mac" ]
183  }
184}
185
186ohos_shared_library("global_resmgr_linux") {
187  if (resource_management_support_icu) {
188    defines = [
189      "__IDE_PREVIEW__",
190      "__LINUX__",
191    ]
192    cflags = [
193      "-std=c++17",
194      "-Wno-ignored-attributes",
195    ]
196
197    sources = manager_sources
198
199    configs = [ ":resmgr_config" ]
200
201    public_configs = [ ":resmgr_public_config" ]
202
203    deps = [
204      "//third_party/bounds_checking_function:libsec_shared",
205      "//third_party/icu/icu4c:shared_icui18n",
206      "//third_party/icu/icu4c:shared_icuuc",
207      "//third_party/zlib:shared_libz",
208    ]
209  }
210  subsystem_name = "global"
211  part_name = "resource_management"
212}
213
214group("linux_resmgr") {
215  if (resource_management_support_icu && is_linux) {
216    deps = [ ":global_resmgr_linux" ]
217  }
218}
219
220ohos_shared_library("librawfile") {
221  output_name = "rawfile"
222  sources = [ "src/raw_file_manager.cpp" ]
223
224  include_dirs = [
225    "//base/global/resource_management/frameworks/resmgr/include",
226    "//base/global/resource_management/interfaces/native/resource/include",
227    "//base/global/resource_management/interfaces/inner_api/include",
228    "//base/global/resource_management/interfaces/js/innerkits/core/include",
229    "//third_party/node/src",
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 = [ "//base/global/resource_management/interfaces/native/resource:librawfile_ndk" ]
239
240  public_deps = [
241    "//base/global/resource_management/frameworks/resmgr:global_resmgr",
242    "//foundation/arkui/napi:ace_napi",
243  ]
244
245  external_deps = [
246    "ability_base:configuration",
247    "bundle_framework:appexecfwk_base",
248    "c_utils:utils",
249    "hiviewdfx_hilog_native:libhilog",
250  ]
251
252  version_script = get_label_info(
253                       "//base/global/resource_management/interfaces/native/resource:librawfile_ndk",
254                       "target_gen_dir") + "/" + get_label_info(
255                       "//base/global/resource_management/interfaces/native/resource:librawfile_ndk",
256                       "name") + version_script_suffix
257
258  subsystem_name = "global"
259  part_name = "resource_management"
260}
261