mirror of
https://fuchsia.googlesource.com/third_party/pigweed.googlesource.com/pigweed/pigweed
synced 2024-09-21 14:16:26 +00:00
2119240da1
- Override built-in targets, which gives more flexibility than set_defaults. - Provide the default C++ in the toolchain, which can be overridden by explicitly specifying a config on a target. - Remove the C++17 default flags from public configs, since it is no longer needed. Change-Id: If211bada971c46cef83909bf15811a4f2c1eb7fd
158 lines
3.5 KiB
Plaintext
158 lines
3.5 KiB
Plaintext
# Copyright 2019 The Pigweed Authors
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
# use this file except in compliance with the License. You may obtain a copy of
|
|
# the License at
|
|
#
|
|
# https://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations under
|
|
# the License.
|
|
|
|
import("$dir_pw_bloat/bloat.gni")
|
|
import("$dir_pw_docgen/docs.gni")
|
|
import("$dir_pw_unit_test/test.gni")
|
|
|
|
config("default_config") {
|
|
include_dirs = [ "public" ]
|
|
}
|
|
|
|
source_set("pw_string") {
|
|
public_configs = [ ":default_config" ]
|
|
public = [
|
|
"public/pw_string/format.h",
|
|
"public/pw_string/string_builder.h",
|
|
"public/pw_string/to_string.h",
|
|
"public/pw_string/type_to_string.h",
|
|
"public/pw_string/util.h",
|
|
]
|
|
sources = [
|
|
"format.cc",
|
|
"string_builder.cc",
|
|
"type_to_string.cc",
|
|
]
|
|
sources += public
|
|
public_deps = [
|
|
"$dir_pw_preprocessor",
|
|
"$dir_pw_span",
|
|
"$dir_pw_status",
|
|
]
|
|
}
|
|
|
|
pw_test_group("tests") {
|
|
tests = [
|
|
":format_test",
|
|
":string_builder_test",
|
|
":to_string_test",
|
|
":type_to_string_test",
|
|
":util_test",
|
|
]
|
|
group_deps = [
|
|
"$dir_pw_preprocessor:tests",
|
|
"$dir_pw_span:tests",
|
|
"$dir_pw_status:tests",
|
|
]
|
|
}
|
|
|
|
pw_test("format_test") {
|
|
deps = [
|
|
":pw_string",
|
|
]
|
|
sources = [
|
|
"format_test.cc",
|
|
]
|
|
}
|
|
|
|
pw_test("string_builder_test") {
|
|
deps = [
|
|
":pw_string",
|
|
]
|
|
sources = [
|
|
"string_builder_test.cc",
|
|
]
|
|
}
|
|
|
|
pw_test("to_string_test") {
|
|
deps = [
|
|
":pw_string",
|
|
]
|
|
sources = [
|
|
"to_string_test.cc",
|
|
]
|
|
}
|
|
|
|
pw_test("type_to_string_test") {
|
|
deps = [
|
|
":pw_string",
|
|
]
|
|
sources = [
|
|
"type_to_string_test.cc",
|
|
]
|
|
}
|
|
|
|
pw_test("util_test") {
|
|
deps = [
|
|
":pw_string",
|
|
]
|
|
sources = [
|
|
"util_test.cc",
|
|
]
|
|
}
|
|
|
|
pw_doc_group("docs") {
|
|
sources = [
|
|
"docs.rst",
|
|
]
|
|
report_deps = [
|
|
":format_size_report",
|
|
":string_builder_size_report",
|
|
]
|
|
}
|
|
|
|
pw_size_report("format_size_report") {
|
|
title = "Using pw::string::Format instead of snprintf"
|
|
|
|
binaries = [
|
|
{
|
|
target = "size_report:single_write_format"
|
|
base = "size_report:single_write_snprintf"
|
|
label = "Format instead of snprintf once, return size"
|
|
},
|
|
{
|
|
target = "size_report:multiple_writes_format"
|
|
base = "size_report:multiple_writes_snprintf"
|
|
label = "Format instead of snprintf 10 times, handle errors"
|
|
},
|
|
{
|
|
target = "size_report:many_writes_format"
|
|
base = "size_report:many_writes_snprintf"
|
|
label = "Format instead of snprintf 50 times, no error handling"
|
|
},
|
|
]
|
|
}
|
|
|
|
pw_size_report("string_builder_size_report") {
|
|
title = "Using pw::StringBuilder instead of snprintf"
|
|
|
|
binaries = [
|
|
{
|
|
target = "size_report:build_string_with_string_builder"
|
|
base = "size_report:build_string_with_snprintf"
|
|
label = "Total StringBuilder cost when used alongside snprintf"
|
|
},
|
|
{
|
|
target = "size_report:build_string_with_string_builder_no_base_snprintf"
|
|
base = "size_report:build_string_with_snprintf_no_base_snprintf"
|
|
label = "StringBuilder cost when completely replacing snprintf"
|
|
},
|
|
{
|
|
target = "size_report:build_string_incremental_with_string_builder"
|
|
base = "size_report:build_string_incremental_with_snprintf"
|
|
label = "Incremental cost relative to snprintf for 10 strings"
|
|
},
|
|
]
|
|
}
|