jsoncpp/BUILD.bazel
bcsgh 1ecfc091f7 Expose JSON_USE_EXCEPTION and JSON_HAS_INT64 as Bazel config flags with defaults that match the existing Bazel build.
Switch //:jsoncpp from using copts ro defines for JSON_USE_EXCEPTION and JSON_HAS_INT64 so that rules that depend on it get the same config.
Make src/test_lib_json/fuzz.cpp respect JSON_USE_EXCEPTION.
2025-03-18 17:08:12 -07:00

63 lines
1.5 KiB
Python

licenses(["unencumbered"]) # Public Domain or MIT
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
exports_files(["LICENSE"])
bool_flag(
name = "use_exception",
build_setting_default = False,
)
config_setting(
name = "use_exception_cfg",
flag_values = {":use_exception": "true"},
)
bool_flag(
name = "has_int64",
build_setting_default = True,
)
config_setting(
name = "has_int64_cfg",
flag_values = {":has_int64": "true"},
)
cc_library(
name = "jsoncpp",
srcs = [
"src/lib_json/json_reader.cpp",
"src/lib_json/json_tool.h",
"src/lib_json/json_value.cpp",
"src/lib_json/json_writer.cpp",
],
hdrs = [
"include/json/allocator.h",
"include/json/assertions.h",
"include/json/config.h",
"include/json/json_features.h",
"include/json/forwards.h",
"include/json/json.h",
"include/json/reader.h",
"include/json/value.h",
"include/json/version.h",
"include/json/writer.h",
],
defines = select({
":use_exception_cfg": ["JSON_USE_EXCEPTION=1"],
"//conditions:default": ["JSON_USE_EXCEPTION=0"],
}) + select({
":has_int64_cfg": ["JSON_HAS_INT64"],
"//conditions:default": [],
}),
includes = ["include"],
visibility = ["//visibility:public"],
deps = [":private"],
)
cc_library(
name = "private",
textual_hdrs = ["src/lib_json/json_valueiterator.inl"],
)