aboutsummaryrefslogtreecommitdiff
path: root/Android.bp
blob: 9db5db396e11afaf6e5b0005fde79fc381b0d002 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cc_defaults {
    name: "fmtlib-non-test-defaults",
    cflags: [
        "-fno-exceptions",
        // If built without exceptions, libfmt uses assert.
        // The tests *require* exceptions, so we can't win here.
        // (This is also why we have two cc_defaults in this file.)
        // Unless proven to be a bad idea, let's at least have some run-time
        // checking.
        "-UNDEBUG",
    ],
    srcs: ["src/format.cc"],
    local_include_dirs: ["include"],
    export_include_dirs: ["include"],
    visibility: ["//system/libbase"],
    min_sdk_version: "29",
}

// This is built into libbase.  If you want to use this library, link to libbase instead.
cc_library_static {
    name: "fmtlib",
    defaults: ["fmtlib-non-test-defaults"],

    vendor_available: true,
    product_available: true,
    ramdisk_available: true,
    vendor_ramdisk_available: true,
    recovery_available: true,
    host_supported: true,
    native_bridge_supported: true,
    target: {
        linux_bionic: {
            enabled: true,
        },
        windows: {
            enabled: true,
        },
    },
    apex_available: [
        "//apex_available:anyapex",
        "//apex_available:platform",
    ],
}

cc_library_static {
    name: "fmtlib_ndk",
    defaults: ["fmtlib-non-test-defaults"],
    sdk_version: "current",
    stl: "c++_static",
}

cc_defaults {
    name: "fmtlib-test-defaults",
    srcs: [
        "src/format.cc",
        "src/os.cc",
        "test/gtest-extra.cc",
        "test/util.cc",
    ],
    local_include_dirs: ["include"],
    host_supported: true,
    test_suites: ["general-tests"],
    // The tests require exceptions and RTTI.
    cflags: ["-fexceptions"],
    rtti: true,
    // The usual "gtest *and* gmock, please" dance...
    gtest: false,
    include_dirs: [
        "external/googletest/googlemock/include/gmock",
        "external/googletest/googletest/include/gtest",
    ],
    static_libs: [
        "libgmock",
        "libgtest",
        "libgtest_main",
    ],
}

// Most of the fmtlib tests.
cc_test {
    name: "fmtlib_test",
    defaults: ["fmtlib-test-defaults"],
    srcs: [
        "test/chrono-test.cc",
        "test/color-test.cc",
        "test/core-test.cc",
        "test/format-test.cc",
        // Some of the os-test tests deliberately try to do bad things with
        // file descriptors, but Android's fdsan won't let them.
        // "test/os-test.cc",
        "test/printf-test.cc",
        "test/ranges-test.cc",
        "test/scan-test.cc",
    ],
}

// This one needs to be separate because some of the test names overlap with
// other tests.
cc_test {
    name: "fmtlib_ostream_test",
    defaults: ["fmtlib-test-defaults"],
    srcs: ["test/ostream-test.cc"],
}