blob: cde6822719be91714016bdf0f9675754f4446de4 [file] [log] [blame]
Bob Badour10017462021-02-12 18:20:34 -08001package {
2 default_applicable_licenses: ["external_fmtlib_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18//
19// large-scale-change included anything that looked like it might be a license
20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
21//
22// Please consider removing redundant or irrelevant files from 'license_text:'.
23// See: http://go/android-license-faq
24license {
25 name: "external_fmtlib_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-BSD",
29 "SPDX-license-identifier-CC0-1.0",
30 "SPDX-license-identifier-MIT",
31 "SPDX-license-identifier-PSF-2.0",
32 "legacy_unencumbered",
33 ],
34 license_text: [
35 "LICENSE.rst",
36 "NOTICE",
37 ],
38}
39
Jiyong Park990e7f42019-06-12 16:25:51 +090040cc_defaults {
Elliott Hughesc2c29c42020-11-03 12:18:33 -080041 name: "fmtlib-non-test-defaults",
Jiyong Park9a4ce482019-06-12 01:15:08 +090042 cflags: [
43 "-fno-exceptions",
Jiyong Park9a4ce482019-06-12 01:15:08 +090044 // If built without exceptions, libfmt uses assert.
Elliott Hughesc2c29c42020-11-03 12:18:33 -080045 // The tests *require* exceptions, so we can't win here.
46 // (This is also why we have two cc_defaults in this file.)
47 // Unless proven to be a bad idea, let's at least have some run-time
48 // checking.
Jiyong Park9a4ce482019-06-12 01:15:08 +090049 "-UNDEBUG",
50 ],
Elliott Hughesc2c29c42020-11-03 12:18:33 -080051 srcs: ["src/format.cc"],
Jiyong Parkb3dda442019-06-12 01:20:18 +090052 local_include_dirs: ["include"],
53 export_include_dirs: ["include"],
Elliott Hughesc2c29c42020-11-03 12:18:33 -080054 visibility: ["//system/libbase"],
Nikita Ioffe1a2a7fe2020-10-28 00:47:14 +000055 min_sdk_version: "29",
Jiyong Park9a4ce482019-06-12 01:15:08 +090056}
Jiyong Park990e7f42019-06-12 16:25:51 +090057
Jiyong Parke6b01132021-12-14 22:26:48 +090058cc_library_headers {
59 name: "fmtlib_headers",
60 export_include_dirs: ["include"],
61
62 vendor_available: true,
63 product_available: true,
64 ramdisk_available: true,
65 vendor_ramdisk_available: true,
66 recovery_available: true,
67 host_supported: true,
68 native_bridge_supported: true,
69 target: {
70 linux_bionic: {
71 enabled: true,
72 },
73 windows: {
74 enabled: true,
75 },
76 },
77 visibility: ["//system/libbase"],
78 min_sdk_version: "29",
79 apex_available: [
80 "//apex_available:anyapex",
81 "//apex_available:platform",
82 ],
83}
84
Tom Cherry17b3fc82019-06-14 11:14:42 -070085// This is built into libbase. If you want to use this library, link to libbase instead.
86cc_library_static {
Jiyong Park990e7f42019-06-12 16:25:51 +090087 name: "fmtlib",
Elliott Hughesc2c29c42020-11-03 12:18:33 -080088 defaults: ["fmtlib-non-test-defaults"],
89
Jiyong Park990e7f42019-06-12 16:25:51 +090090 vendor_available: true,
Justin Yund6904de2020-11-11 16:18:39 +090091 product_available: true,
Yifan Hongcd5c0382020-01-21 19:31:11 -080092 ramdisk_available: true,
Yifan Hongd0f3cdc2020-10-21 18:27:43 -070093 vendor_ramdisk_available: true,
Jiyong Park990e7f42019-06-12 16:25:51 +090094 recovery_available: true,
95 host_supported: true,
96 native_bridge_supported: true,
97 target: {
98 linux_bionic: {
99 enabled: true,
100 },
101 windows: {
102 enabled: true,
103 },
104 },
Przemyslaw Szczepaniak2a2cc702020-02-10 13:32:14 +0000105 apex_available: [
Jiyong Parka9d18702020-03-07 16:37:23 +0900106 "//apex_available:anyapex",
Przemyslaw Szczepaniak2a2cc702020-02-10 13:32:14 +0000107 "//apex_available:platform",
Przemyslaw Szczepaniak2a2cc702020-02-10 13:32:14 +0000108 ],
Roopa Sattirajuff95f542021-12-22 16:04:31 -0800109 min_sdk_version: "29",
Jiyong Park990e7f42019-06-12 16:25:51 +0900110}
111
112cc_library_static {
113 name: "fmtlib_ndk",
Elliott Hughesc2c29c42020-11-03 12:18:33 -0800114 defaults: ["fmtlib-non-test-defaults"],
Jiyong Park990e7f42019-06-12 16:25:51 +0900115 sdk_version: "current",
116 stl: "c++_static",
117}
Elliott Hughesc2c29c42020-11-03 12:18:33 -0800118
119cc_defaults {
120 name: "fmtlib-test-defaults",
121 srcs: [
122 "src/format.cc",
123 "src/os.cc",
124 "test/gtest-extra.cc",
125 "test/util.cc",
126 ],
127 local_include_dirs: ["include"],
128 host_supported: true,
129 test_suites: ["general-tests"],
130 // The tests require exceptions and RTTI.
131 cflags: ["-fexceptions"],
132 rtti: true,
133 // The usual "gtest *and* gmock, please" dance...
134 gtest: false,
135 include_dirs: [
136 "external/googletest/googlemock/include/gmock",
137 "external/googletest/googletest/include/gtest",
138 ],
139 static_libs: [
140 "libgmock",
141 "libgtest",
142 "libgtest_main",
143 ],
144}
145
146// Most of the fmtlib tests.
147cc_test {
148 name: "fmtlib_test",
149 defaults: ["fmtlib-test-defaults"],
150 srcs: [
151 "test/chrono-test.cc",
152 "test/color-test.cc",
153 "test/core-test.cc",
154 "test/format-test.cc",
155 // Some of the os-test tests deliberately try to do bad things with
156 // file descriptors, but Android's fdsan won't let them.
157 // "test/os-test.cc",
158 "test/printf-test.cc",
159 "test/ranges-test.cc",
160 "test/scan-test.cc",
161 ],
162}
163
164// This one needs to be separate because some of the test names overlap with
165// other tests.
166cc_test {
167 name: "fmtlib_ostream_test",
168 defaults: ["fmtlib-test-defaults"],
169 srcs: ["test/ostream-test.cc"],
170}