Files
json/tools/generate_natvis
Niels Lohmann 6a28560c87 Clean up CI, CMake, Makefile, and Bazel files
- CMakeLists.txt: avoid VERSION_GREATER_EQUAL, which CMake < 3.7 lacks
- ci.cmake: test JSON_DisableTupleReferenceConversion in ci_cmake_flags,
  remove unused variables and unreachable per-compiler targets, look up
  Clang tools consistently, forward CMAKE_CXX_FLAGS to ci_module_cpp20,
  format json_literals.hpp and remove backups in ci_test_amalgamation
- BUILD.bazel: add json_literals.hpp to the single-header target
- workflows: format json_literals.hpp before copying it, drop the obsolete
  natvis --version plumbing, name natvis and macro_builder in failure
  messages, drop the duplicate amalgamation job, install Valgrind only
  where needed, republish docs on version bumps, fix stale names
- Makefile: complete .PHONY and help, check-amalgamation always restores
  the checked-in files, natvis uses its own venv, macro_builder_check
  installs astyle, clean removes the fuzzer binaries
- remove tools/amalgamate/config_json_view.json (json_view.hpp is not on
  develop yet)

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-10 13:27:26 +02:00
..

generate_natvis.py

Generate the Natvis debugger visualization file for all supported namespace combinations.

The ABI tag list and the library version are parsed from include/nlohmann/detail/abi_macros.hpp, so this script must be re-run (via make natvis) whenever an NLOHMANN_JSON_ABI_TAG_* macro is added to that file or the library version is bumped — otherwise the committed nlohmann_json.natvis drifts from the header it visualizes, and make check-amalgamation fails.

Usage

make natvis

make natvis sets up a virtual environment tools/generate_natvis/venv with the dependencies from requirements.txt (Jinja2) and runs the script with it. Alternatively, install the requirements yourself and run:

./generate_natvis.py [--version X.Y.Z] [repository_root/]

--version and the output/repository-root directory both default to values derived from this script's own location, so they only need to be given explicitly when generating a Natvis file for a different checkout or a version other than the one in abi_macros.hpp.