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/faultloggerd/faultloggerd.gni")
15
16if (defined(ohos_lite)) {
17  executable("dumpcatcher") {
18    visibility = [ "*:*" ]
19    include_dirs = [
20      ".",
21      "$faultloggerd_interfaces_path/common",
22      "$faultloggerd_path/common/dfxlog",
23      "$faultloggerd_path/common/dfxutil",
24      "$faultloggerd_path/interfaces/innerkits/dump_catcher/include",
25      "$hilog_lite_include_path",
26    ]
27    sources = [
28      "dump_catcher.cpp",
29      "main.cpp",
30    ]
31    deps = [
32      "$faultloggerd_path/common/dfxlog:dfx_hilog",
33      "$faultloggerd_path/common/dfxutil:dfx_util",
34      "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher",
35    ]
36
37    external_deps = [
38      "bounds_checking_function:libsec_shared",
39      "hilog_lite:hilog_shared",
40    ]
41  }
42} else {
43  config("dumpcatcher_config") {
44    visibility = [ ":*" ]
45
46    include_dirs = [
47      ".",
48      "$faultloggerd_interfaces_path/common",
49      "$faultloggerd_path/interfaces/innerkits/signal_handler",
50    ]
51  }
52
53  ohos_executable("dumpcatcher") {
54    if (build_variant == "root") {
55      configs = [
56        ":dumpcatcher_config",
57        "$faultloggerd_path/common/build:coverage_flags",
58      ]
59
60      sources = [
61        "dump_catcher.cpp",
62        "main.cpp",
63      ]
64
65      cflags_cc = [ "-DDEBUG_CRASH_LOCAL_HANDLER" ]
66
67      deps = [
68        "$faultloggerd_frameworks_path/localhandler:dfx_local_handler_src",
69        "$faultloggerd_path/common/dfxlog:dfx_hilog",
70        "$faultloggerd_path/common/dfxutil:dfx_util",
71        "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher",
72      ]
73
74      external_deps = [
75        "c_utils:utils",
76        "hilog:libhilog",
77      ]
78    } else {
79      sources = [ "dummy_dumpcatcher.cpp" ]
80    }
81
82    install_images = [
83      "system",
84      "updater",
85    ]
86
87    part_name = "faultloggerd"
88    subsystem_name = "hiviewdfx"
89  }
90}
91