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_pool.cpp", 41 "${preferences_native_path}/src/task_queue.cpp", 42 ] 43 44 configs = [ ":native_preferences_config" ] 45 46 if (is_mingw || is_mac) { 47 configs += [ ":adaptor_config" ] 48 cflags_cc = [ 49 "-std=c++17", 50 "-stdlib=libc++", 51 ] 52 if (is_mac) { 53 buildos = "mac" 54 defines = [ "MAC_PLATFORM" ] 55 } else { 56 buildos = "windows" 57 defines = [ "WINDOWS_PLATFORM" ] 58 ldflags = [ "-lws2_32" ] 59 } 60 deps = [ 61 "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog_${buildos}", 62 "//third_party/libxml2:static_libxml2", 63 ] 64 } else { 65 deps = [ "//third_party/libxml2:libxml2" ] 66 external_deps = [ 67 "c_utils:utils", 68 "hilog_native:libhilog", 69 "hitrace_native:hitrace_meter", 70 ] 71 } 72 73 public_configs = [ ":native_preferences_public_config" ] 74 75 subsystem_name = "distributeddatamgr" 76 part_name = "preferences" 77} 78