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. 13 14import("//base/hiviewdfx/hilog/hilog.gni") 15import("//build/ohos.gni") 16 17config("libhilog_pub_config") { 18 visibility = [ ":*" ] 19 include_dirs = [ "include" ] 20} 21if (is_mingw || is_mac || is_linux || is_ohos) { 22 ohos_shared_library("libhilog") { 23 public_configs = [ ":libhilog_pub_config" ] 24 if (is_ohos) { 25 deps = [ "../../../frameworks/libhilog:libhilog_source_ohos" ] 26 } else if (is_mingw) { 27 deps = [ "../../../frameworks/libhilog:libhilog_source_windows" ] 28 } else if (is_mac) { 29 deps = [ "../../../frameworks/libhilog:libhilog_source_mac" ] 30 } else if (is_linux) { 31 deps = [ "../../../frameworks/libhilog:libhilog_source_linux" ] 32 } 33 34 if (is_ohos) { 35 output_extension = "so" 36 version_script = "libhilog.map" 37 innerapi_tags = [ 38 "chipsetsdk", 39 "platformsdk", 40 "sasdk", 41 ] 42 install_enable = !hilog_native_feature_ohcore 43 install_images = [ 44 "system", 45 "updater", 46 ] 47 sanitize = { 48 cfi = true 49 cfi_cross_dso = true 50 debug = false 51 } 52 } 53 54 part_name = "hilog" 55 subsystem_name = "hiviewdfx" 56 } 57} 58 59template("libhilog") { 60 forward_variables_from(invoker, "*") 61 if (current_os == "android" || current_os == "ios") { 62 ohos_static_library(target_name) { 63 public_configs = [ ":libhilog_pub_config" ] 64 deps = [ "../../../platform:libhilog_platform_source_$platform" ] 65 66 part_name = "hilog" 67 subsystem_name = "hiviewdfx" 68 } 69 } else { 70 ohos_shared_library(target_name) { 71 sanitize = { 72 cfi = true 73 cfi_cross_dso = true 74 debug = false 75 } 76 public_configs = [ ":libhilog_pub_config" ] 77 deps = [ "../../../frameworks/libhilog:libhilog_source_$platform" ] 78 if (platform == "ohos") { 79 output_extension = "so" 80 version_script = "libhilog.map" 81 } 82 83 install_enable = !hilog_native_feature_ohcore 84 install_images = [ 85 "system", 86 "updater", 87 ] 88 89 if (platform == "ohos") { 90 innerapi_tags = [ 91 "chipsetsdk", 92 "platformsdk", 93 "sasdk", 94 ] 95 } 96 97 part_name = "hilog" 98 subsystem_name = "hiviewdfx" 99 } 100 } 101} 102 103foreach(item, platforms) { 104 if (item == "windows" || item == "mac" || item == "linux" || item == "ios" || 105 item == "android") { 106 libhilog("libhilog_" + item) { 107 platform = item 108 } 109 } 110} 111 112config("libhilog_base_pub_cfg") { 113 visibility = [ "*:*" ] 114 include_dirs = [ 115 "include", 116 "../../../frameworks/libhilog/include", 117 "../../../frameworks/libhilog/vsnprintf/include", 118 ] 119} 120 121ohos_static_library("libhilog_base") { 122 public_configs = [ ":libhilog_base_pub_cfg" ] 123 124 deps = [ "../../../frameworks/libhilog:libhilog_base_source" ] 125 126 subsystem_name = "hiviewdfx" 127 part_name = "hilog" 128} 129