1cc_defaults {
2    name: "libmemunreachable_defaults",
3
4    cflags: [
5        "-Wall",
6        "-Wextra",
7        "-Werror",
8    ],
9    clang: true,
10    shared_libs: [
11        "libbase",
12        "liblog",
13    ],
14}
15
16cc_library_shared {
17    name: "libmemunreachable",
18    vendor_available: true,
19    defaults: ["libmemunreachable_defaults"],
20    srcs: [
21        "Allocator.cpp",
22        "HeapWalker.cpp",
23        "LeakFolding.cpp",
24        "LeakPipe.cpp",
25        "LineBuffer.cpp",
26        "MemUnreachable.cpp",
27        "ProcessMappings.cpp",
28        "PtracerThread.cpp",
29        "ThreadCapture.cpp",
30    ],
31
32    static_libs: [
33        "libc_malloc_debug_backtrace",
34        "libc_logging",
35    ],
36    // Only need this for arm since libc++ uses its own unwind code that
37    // doesn't mix with the other default unwind code.
38    arch: {
39        arm: {
40            static_libs: ["libunwind_llvm"],
41        },
42    },
43    export_include_dirs: ["include"],
44    local_include_dirs: ["include"],
45}
46
47cc_test {
48    name: "memunreachable_test",
49    defaults: ["libmemunreachable_defaults"],
50    host_supported: true,
51    srcs: [
52        "tests/Allocator_test.cpp",
53        "tests/HeapWalker_test.cpp",
54        "tests/LeakFolding_test.cpp",
55    ],
56
57    target: {
58        android: {
59            srcs: [
60                "tests/DisableMalloc_test.cpp",
61                "tests/MemUnreachable_test.cpp",
62                "tests/ThreadCapture_test.cpp",
63            ],
64            shared_libs: [
65                "libmemunreachable",
66            ],
67        },
68        host: {
69            srcs: [
70                "Allocator.cpp",
71                "HeapWalker.cpp",
72                "LeakFolding.cpp",
73                "tests/HostMallocStub.cpp",
74            ],
75        },
76        darwin: {
77            enabled: false,
78        },
79    },
80}
81