Skip to content

Detect used C++ standard library - #4793

Merged
nlohmann merged 8 commits into
developfrom
detect-used-libcxx
May 23, 2025
Merged

nlohmann merged 8 commits into
developfrom
detect-used-libcxx

Conversation

@nlohmann

Copy link
Copy Markdown
Owner

To debug PRs like #4498, it is good to not only know the used compiler, but also the version of the used C++ standard library.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@coveralls

coveralls commented May 23, 2025 •

Copy link
Copy Markdown

Coverage Status

coverage: 99.19%. remained the same
when pulling bd0000c on detect-used-libcxx
into 7421ac3 on develop.

nlohmann added 5 commits May 23, 2025 08:58
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@github-actions github-actions Bot added the tests label May 23, 2025
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann added this to the Release 3.12.1 milestone May 23, 2025
@nlohmann nlohmann added the review needed It would be great if someone could review the proposed changes. label May 23, 2025
Comment thread cmake/download_test_data.cmake Outdated
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
@nlohmann nlohmann removed the review needed It would be great if someone could review the proposed changes. label May 23, 2025
@nlohmann
nlohmann merged commit 281d1e9 into develop May 23, 2025
@nlohmann
nlohmann deleted the detect-used-libcxx branch May 23, 2025 15:59
nlohmann added a commit that referenced this pull request May 25, 2025
nlohmann added a commit that referenced this pull request May 25, 2025
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
jwnimmer-tri pushed a commit to jwnimmer-tri/json that referenced this pull request Sep 21, 2026
nlohmann added a commit that referenced this pull request Sep 25, 2026
…and pin Google Benchmark (#5556)

* Document the benchmarks, and make them build and compare versions again

The benchmark project hasn't configured since #4793: download_test_data.cmake
compiles cmake/detect_libcpp_version.cpp relative to CMAKE_SOURCE_DIR, which
is tests/benchmarks when that is the top-level project, so try_run fails and
so does `make run_benchmarks`. The path is now relative to the module itself,
which is the same file for the main build.

The Dump benchmark discarded dump()'s result, which is [[nodiscard]] by now;
it warned, and left the optimizer free to shorten the loop. The result is
now kept with benchmark::DoNotOptimize.

A new cache variable, JSON_BENCHMARK_INCLUDE_DIR, names the directory holding
the nlohmann/json.hpp to benchmark (single_include by default, as before),
so the same benchmarks can be built against two versions and compared.

tests/benchmarks/README.md documents what is measured, how to build and run
the benchmarks, how to read the output, and how to compare two versions with
Google Benchmark's compare.py; it recommends doing so by hand before a
release rather than in CI.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Point ci_benchmarks at tests/benchmarks

The target has configured ${PROJECT_SOURCE_DIR}/benchmarks since it was
added in #2561, but the benchmarks live in tests/benchmarks.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Pin Google Benchmark to release 1.9.5

The benchmarks fetched Google Benchmark's main branch, so two builds on
different days could measure with different library code, and CMake 3.30
and later warn that the single-argument FetchContent_Populate() is
deprecated. Fetch the 1.9.5 release archive, verified by its SHA-256,
with FetchContent_MakeAvailable() instead. That needs CMake 3.14; Google
Benchmark itself already needed 3.13.

Its -Werror is switched off, so a newer compiler's new warnings cannot
break the pinned release, and its install rules are no longer added.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants