1# Copyright 2019 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load(
16    "//pw_build:pigweed.bzl",
17    "pw_cc_binary",
18)
19
20package(default_visibility = ["//visibility:public"])
21
22licenses(["notice"])  # Apache License 2.0
23
24pw_cc_binary(
25    name = "single_write_snprintf",
26    srcs = ["format_single.cc"],
27    copts = ["-DUSE_FORMAT=0"],
28    deps = [
29        "//pw_bloat:bloat_this_binary",
30        "//pw_string",
31    ],
32)
33
34pw_cc_binary(
35    name = "single_write_format",
36    srcs = ["format_single.cc"],
37    copts = ["-DUSE_FORMAT=1"],
38    deps = [
39        "//pw_bloat:bloat_this_binary",
40        "//pw_string",
41    ],
42)
43
44pw_cc_binary(
45    name = "multiple_writes_snprintf",
46    srcs = ["format_multiple.cc"],
47    copts = ["-DUSE_FORMAT=0"],
48    deps = [
49        "//pw_bloat:bloat_this_binary",
50        "//pw_string",
51    ],
52)
53
54pw_cc_binary(
55    name = "multiple_writes_format",
56    srcs = ["format_multiple.cc"],
57    copts = ["-DUSE_FORMAT=1"],
58    deps = [
59        "//pw_bloat:bloat_this_binary",
60        "//pw_string",
61    ],
62)
63
64pw_cc_binary(
65    name = "many_writes_snprintf",
66    srcs = ["format_many_without_error_handling.cc"],
67    copts = ["-DUSE_FORMAT=0"],
68    deps = [
69        "//pw_bloat:bloat_this_binary",
70        "//pw_string",
71    ],
72)
73
74pw_cc_binary(
75    name = "many_writes_format",
76    srcs = ["format_many_without_error_handling.cc"],
77    copts = ["-DUSE_FORMAT=1"],
78    deps = [
79        "//pw_bloat:bloat_this_binary",
80        "//pw_string",
81    ],
82)
83
84pw_cc_binary(
85    name = "build_string_with_snprintf_no_base_snprintf",
86    srcs = ["string_builder_size_report.cc"],
87    copts = [
88        "-DUSE_STRING_BUILDER=0",
89        "-DPROVIDE_BASE_SNPRINTF=0",
90    ],
91    deps = [
92        "//pw_bloat:bloat_this_binary",
93        "//pw_string",
94    ],
95)
96
97pw_cc_binary(
98    name = "build_string_with_string_builder_no_base_snprintf",
99    srcs = ["string_builder_size_report.cc"],
100    copts = [
101        "-DUSE_STRING_BUILDER=1",
102        "-DPROVIDE_BASE_SNPRINTF=0",
103    ],
104    deps = [
105        "//pw_bloat:bloat_this_binary",
106        "//pw_string",
107    ],
108)
109
110pw_cc_binary(
111    name = "build_string_with_snprintf",
112    srcs = ["string_builder_size_report.cc"],
113    copts = [
114        "-DUSE_STRING_BUILDER=0",
115        "-DPROVIDE_BASE_SNPRINTF=1",
116    ],
117    deps = [
118        "//pw_bloat:bloat_this_binary",
119        "//pw_string",
120    ],
121)
122
123pw_cc_binary(
124    name = "build_string_with_string_builder",
125    srcs = ["string_builder_size_report.cc"],
126    copts = [
127        "-DUSE_STRING_BUILDER=1",
128        "-DPROVIDE_BASE_SNPRINTF=1",
129    ],
130    deps = [
131        "//pw_bloat:bloat_this_binary",
132        "//pw_string",
133    ],
134)
135
136pw_cc_binary(
137    name = "build_string_incremental_with_snprintf",
138    srcs = ["string_builder_size_report_incremental.cc"],
139    copts = ["-DUSE_STRING_BUILDER=0"],
140    deps = [
141        "//pw_bloat:bloat_this_binary",
142        "//pw_string",
143    ],
144)
145
146pw_cc_binary(
147    name = "build_string_incremental_with_string_builder",
148    srcs = ["string_builder_size_report_incremental.cc"],
149    copts = ["-DUSE_STRING_BUILDER=1"],
150    deps = [
151        "//pw_bloat:bloat_this_binary",
152        "//pw_string",
153    ],
154)
155