• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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.
13import("//build/ohos.gni")
14import("//foundation/distributeddatamgr/preferences/preferences.gni")
15config("native_preferences_config") {
16  visibility = [ ":*" ]
17  include_dirs = [
18    "include",
19    "${preferences_native_path}/include",
20  ]
21}
22
23config("native_preferences_public_config") {
24  visibility = [ "//foundation/distributeddatamgr/preferences:*" ]
25  include_dirs = [ "include" ]
26}
27
28config("adaptor_config") {
29  include_dirs = [ "//commonlibrary/c_utils/base/include" ]
30}
31
32ohos_shared_library("native_preferences") {
33  all_dependent_configs = [ ":native_preferences_public_config" ]
34  sources = [
35    "${preferences_native_path}/src/preferences_helper.cpp",
36    "${preferences_native_path}/src/preferences_impl.cpp",
37    "${preferences_native_path}/src/preferences_observer.cpp",
38    "${preferences_native_path}/src/preferences_value.cpp",
39    "${preferences_native_path}/src/preferences_xml_utils.cpp",
40    "${preferences_native_path}/src/task_executor.cpp",
41  ]
42
43  configs = [ ":native_preferences_config" ]
44
45  if (is_mingw || is_mac) {
46    configs += [ ":adaptor_config" ]
47    cflags_cc = [
48      "-std=c++17",
49      "-stdlib=libc++",
50    ]
51    if (is_mac) {
52      buildos = "mac"
53      defines = [ "MAC_PLATFORM" ]
54    } else {
55      buildos = "windows"
56      defines = [ "WINDOWS_PLATFORM" ]
57      ldflags = [ "-lws2_32" ]
58    }
59    deps = [
60      "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}",
61      "//third_party/libxml2:static_libxml2",
62    ]
63  } else {
64    deps = [ "//third_party/libxml2:libxml2" ]
65    external_deps = [
66      "c_utils:utils",
67      "hilog_native:libhilog",
68      "hitrace_native:hitrace_meter",
69    ]
70  }
71
72  public_configs = [ ":native_preferences_public_config" ]
73
74  subsystem_name = "distributeddatamgr"
75  part_name = "preferences"
76}
77