• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2020-2021 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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16} else {
17  import("//build/ohos.gni")
18}
19
20global_sources = []
21if (defined(ohos_lite) && ohos_kernel_type == "liteos_a") {
22  global_sources += [
23    "src/global.cpp",
24    "src/hap_manager.cpp",
25    "src/hap_resource.cpp",
26    "src/locale_matcher.cpp",
27    "src/lock.cpp",
28    "src/res_config_impl.cpp",
29    "src/res_desc.cpp",
30    "src/res_locale.cpp",
31    "src/resource_manager_impl.cpp",
32    "src/utils/hap_parser.cpp",
33    "src/utils/string_utils.cpp",
34    "src/utils/utils.cpp",
35  ]
36} else {
37  global_sources += [
38    "src/global.c",
39    "src/global_utils.c",
40  ]
41}
42
43config("global_resmgr_config") {
44  include_dirs = [
45    "include",
46    "//base/global/resource_management_lite/interfaces/inner_api/include",
47    "//commonlibrary/utils_lite/include",
48    "//third_party/bounds_checking_function/include",
49  ]
50
51  if (defined(ohos_lite) && ohos_kernel_type == "liteos_a") {
52    include_dirs += [
53      "//third_party/zlib",
54      "//third_party/zlib/contrib/minizip",
55      "//commonlibrary/utils_lite/memory",
56      "//base/global/i18n_lite/interfaces/kits/i18n/include/",
57    ]
58  }
59}
60
61config("global_public_config") {
62  include_dirs = [
63    "//base/global/resource_management_lite/frameworks/resmgr_lite/include",
64    "//base/global/resource_management_lite/interfaces/inner_api/include",
65  ]
66}
67
68config("global_resmgr_mingw_config") {
69  cflags = [
70    "-D_INC_STRING_S",
71    "-D_INC_WCHAR_S",
72    "-D_SECIMP=//",
73    "-D_STDIO_S_DEFINED",
74    "-D_INC_STDIO_S",
75    "-D_INC_STDLIB_S",
76    "-D_INC_MEMORY_S",
77  ]
78}
79
80if (defined(ohos_lite)) {
81  if (ohos_kernel_type == "liteos_m") {
82    static_library("global_resmgr") {
83      sources = global_sources
84      public_configs = [ ":global_resmgr_config" ]
85      deps = [ "//third_party/bounds_checking_function:libsec_static" ]
86    }
87  } else {
88    shared_library("global_resmgr") {
89      sources = global_sources
90      configs += [ ":global_resmgr_config" ]
91      deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
92      if (ohos_kernel_type == "liteos_a") {
93        public_deps = [
94          "//base/global/i18n_lite/frameworks/i18n:global_i18n",
95          "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
96          "//build/lite/config/component/zlib:zlib_shared",
97        ]
98      }
99    }
100  }
101
102  lite_component("global_manager_lite") {
103    features = [ ":global_resmgr" ]
104  }
105} else {
106  ohos_static_library("global_resmgr_simulator") {
107    sources = global_sources
108    public_configs = [ ":global_public_config" ]
109    deps = [ "//third_party/bounds_checking_function:libsec_static" ]
110    configs = [ ":global_resmgr_mingw_config" ]
111  }
112}
113