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