mirror of
https://github.com/nlohmann/json.git
synced 2026-08-29 20:47:14 +00:00
Test the simdutf backend in CI
JSON_USE_SIMDUTF was documented and shipped but never compiled by anything in the repository, so nothing held the backend to the behavior the docs promise. Add JSON_TestSimdutf (OFF by default), which fetches simdutf and defines JSON_USE_SIMDUTF for every test target, and a ci_test_simdutf target that runs the whole suite in that configuration. Because simdutf needs C++17, the suite is built at C++11 as well, so one job covers both the scalar fallback with the macro defined and simdutf itself. The dependency hangs off test_main, whose usage requirements every test target inherits. The library target and the installed CMake package are deliberately untouched: making nlohmann_json link simdutf would put a find_dependency() in the exported package, which is a separate decision. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MXDi7NTMKAmoArUZSKMc4T Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -212,6 +212,24 @@ add_custom_target(ci_test_legacycomparison
|
||||
COMMENT "Compile and test with legacy discarded value comparison enabled"
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Validate UTF-8 with simdutf.
|
||||
###############################################################################
|
||||
|
||||
add_custom_target(ci_test_simdutf
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DCMAKE_BUILD_TYPE=Debug -GNinja
|
||||
-DJSON_BuildTests=ON -DJSON_TestSimdutf=ON
|
||||
# simdutf needs C++17, so the library falls back to its scalar validator
|
||||
# below that: build the suite at C++11 to cover the fallback with the macro
|
||||
# defined, and at C++17 to run every test against simdutf itself
|
||||
"-DJSON_TestStandards=11\;17"
|
||||
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_simdutf
|
||||
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_simdutf
|
||||
COMMAND cd ${PROJECT_BINARY_DIR}/build_simdutf && ${CMAKE_CTEST_COMMAND} --parallel ${N} --output-on-failure
|
||||
COMMENT "Compile and test with simdutf UTF-8 validation enabled"
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Enable brace-init copy semantics.
|
||||
###############################################################################
|
||||
|
||||
Reference in New Issue
Block a user