1# Copyright (c) 2022-2024 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/faultloggerd/faultloggerd.gni") 15 16dfx_util_sources = [ "dfx_util.cpp" ] 17 18if (defined(ohos_lite)) { 19 static_library("dfx_util") { 20 visibility = [ "*:*" ] 21 include_dirs = [ 22 ".", 23 "$faultloggerd_interfaces_path/common", 24 "$hilog_lite_include_path", 25 ] 26 defines = [ "is_ohos_lite" ] 27 sources = dfx_util_sources 28 deps = [ 29 "$faultloggerd_path/common/dfxlog:dfx_hilog", 30 "$hilog_lite_deps_path", 31 ] 32 33 external_deps = [ "bounds_checking_function:libsec_shared" ] 34 } 35} else { 36 config("dfx_util_config") { 37 visibility = [ ":*" ] 38 include_dirs = [ 39 ".", 40 "$faultloggerd_common_path/dfxlog", 41 "$faultloggerd_interfaces_path/common", 42 ] 43 defines = [ 44 "is_ohos=${is_ohos}", 45 "is_linux=${is_linux}", 46 "is_mingw=${is_mingw}", 47 ] 48 if (is_linux || is_mingw) { 49 defines += [ "is_host" ] 50 } 51 } 52 53 ohos_static_library("dfx_util") { 54 sources = dfx_util_sources 55 public_configs = [ ":dfx_util_config" ] 56 deps = [ "$faultloggerd_path/common/dfxlog:dfx_hilog" ] 57 external_deps = [ 58 "c_utils:utils", 59 "hilog:libhilog", 60 ] 61 part_name = "faultloggerd" 62 subsystem_name = "hiviewdfx" 63 } 64 65 ohos_static_library("dfx_util_static") { 66 sources = dfx_util_sources 67 public_configs = [ ":dfx_util_config" ] 68 defines = [ "DFX_LOG_HILOG_BASE" ] 69 deps = [ "$faultloggerd_path/common/dfxlog:dfx_hilog_base_static" ] 70 external_deps = [ 71 "bounds_checking_function:libsec_static", 72 "c_utils:utilsbase", 73 "hilog:libhilog_base", 74 ] 75 part_name = "faultloggerd" 76 subsystem_name = "hiviewdfx" 77 } 78 79 ohos_static_library("dfx_util_host") { 80 sources = dfx_util_sources 81 public_configs = [ ":dfx_util_config" ] 82 defines = [ "DFX_NO_PRINT_LOG" ] 83 if (is_ohos) { 84 external_deps = [ 85 "c_utils:utils", 86 "hilog:libhilog", 87 ] 88 } 89 part_name = "faultloggerd" 90 subsystem_name = "hiviewdfx" 91 } 92} 93