From c94431700229e0101161f509d418fc55a983fa71 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 2 Jul 2026 17:13:49 +0200 Subject: [PATCH] Add more compilers (#5220) * :construction_worker: add ipcx and nvc++ Signed-off-by: Niels Lohmann * :bug: fix nvc++ build Signed-off-by: Niels Lohmann * :bug: fix nvc++ build Signed-off-by: Niels Lohmann * :construction_worker: add more MSVC images Signed-off-by: Niels Lohmann * :construction_worker: add more MSVC images Signed-off-by: Niels Lohmann --------- Signed-off-by: Niels Lohmann --- .github/workflows/ubuntu.yml | 24 +++++++ .github/workflows/windows.yml | 62 +++++++++++++++++++ cmake/ci.cmake | 42 +++++++++++++ .../docs/community/quality_assurance.md | 5 ++ 4 files changed, 133 insertions(+) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9e2a1f7b2..afd181d04 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -288,6 +288,30 @@ jobs: . /opt/intel/oneapi/setvars.sh cmake --build build --target ci_icpc + ci_icpx: + runs-on: ubuntu-latest + container: intel/oneapi-hpckit:latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Get latest CMake and ninja + uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4 + - name: Run CMake + run: cmake -S . -B build -DJSON_CI=On + - name: Build + run: cmake --build build --target ci_icpx + + ci_nvhpc: + runs-on: ubuntu-latest + container: nvcr.io/nvidia/nvhpc:25.5-devel-cuda12.9-ubuntu22.04 + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Get latest CMake and ninja + uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4 + - name: Run CMake + run: cmake -S . -B build -DJSON_CI=On + - name: Build + run: cmake --build build --target ci_nvhpc + ci_emscripten: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 01f7a8f43..bc5e1b32f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -74,6 +74,68 @@ jobs: - name: Test run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure + # Visual Studio 2026 (v145 toolset) on the windows-2025 image. The "Visual Studio + # 18 2026" generator requires CMake 4.2+, so a recent CMake is fetched explicitly. + msvc-vs2026: + strategy: + matrix: + build_type: [Debug, Release] + architecture: [Win32, x64] + std_version: [default, latest] + + runs-on: windows-2025 + + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Get latest CMake and ninja + uses: lukka/get-cmake@f5b8fbb4d77cec1acc5a5f9f0df4beffaf5d98d9 # v4.3.4 + - name: Set extra CXX_FLAGS for latest std_version + # /wd5285 silences C5285 emitted by the bundled third-party doctest.h, which + # specializes std::tuple (newly diagnosed by the VS2026 v145 toolset) + run: | + if [ "${{ matrix.std_version }}" = "latest" ]; then + echo "flags=/permissive- /std:c++latest /utf-8 /W4 /WX /wd5285" >> $GITHUB_ENV + else + echo "flags=/W4 /WX /wd5285" >> $GITHUB_ENV + fi + shell: bash + - name: Run CMake (Release) + run: cmake -S . -B build -G "Visual Studio 18 2026" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="$env:flags" + if: matrix.build_type == 'Release' + shell: pwsh + - name: Run CMake (Debug) + run: cmake -S . -B build -G "Visual Studio 18 2026" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="$env:flags" + if: matrix.build_type == 'Debug' + shell: pwsh + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure + + # Native ARM64 Windows runner with the MSVC ARM64 toolset. The windows-11-arm + # label is only available for public repositories. + msvc-arm64: + strategy: + matrix: + build_type: [Debug, Release] + + runs-on: windows-11-arm + + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + - name: Run CMake (Release) + run: cmake -S . -B build -G "Visual Studio 17 2022" -A ARM64 -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX" + if: matrix.build_type == 'Release' + shell: pwsh + - name: Run CMake (Debug) + run: cmake -S . -B build -G "Visual Studio 17 2022" -A ARM64 -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX" + if: matrix.build_type == 'Debug' + shell: pwsh + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} --parallel 10 + - name: Test + run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure + clang: runs-on: windows-2022 strategy: diff --git a/cmake/ci.cmake b/cmake/ci.cmake index 559ce8f55..834687f57 100644 --- a/cmake/ci.cmake +++ b/cmake/ci.cmake @@ -701,6 +701,48 @@ add_custom_target(ci_icpc COMMENT "Compile and test with ICPC" ) +add_custom_target(ci_icpx + COMMAND ${CMAKE_COMMAND} + -DCMAKE_BUILD_TYPE=Debug -GNinja + -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx + -DJSON_BuildTests=ON -DJSON_FastTests=ON + -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_icpx + COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_icpx + COMMAND cd ${PROJECT_BINARY_DIR}/build_icpx && ${CMAKE_CTEST_COMMAND} --parallel ${N} --exclude-regex "test-unicode" --output-on-failure + COMMENT "Compile and test with ICPX (Intel oneAPI DPC++/C++)" +) + +############################################################################### +# NVIDIA HPC SDK C++ Compiler +############################################################################### + +# nvc++ defaults to a relaxed, non-IEEE floating-point model that flushes denormals +# to zero and does not honor NaN ordering; -Kieee restores strict IEEE 754 behavior +# (needed for the dtoa/grisu and NaN-comparison code paths). +# +# The following tests are excluded as they trigger known nvc++ 25.5 defects (not +# library bugs); see https://github.com/nlohmann/json for tracking. Only the +# affected language-standard variants are excluded so coverage is otherwise kept: +# - test-comparison_cpp20, test-comparison_legacy_cpp20 +# miscompiles cross-type/<=> comparison (e.g. `-17 <= null`) +# - test-constructor1_cpp11 +# std::initializer_list lifetime bug -> SIGSEGV +# - test-deserialization_cpp20 +# mangles the UTF-8 u8"" string literal in the char8_t (C++20) section +add_custom_target(ci_nvhpc + COMMAND ${CMAKE_COMMAND} + -DCMAKE_BUILD_TYPE=Debug -GNinja + -DCMAKE_C_COMPILER=nvc -DCMAKE_CXX_COMPILER=nvc++ + -DCMAKE_CXX_FLAGS=-Kieee + -DJSON_BuildTests=ON -DJSON_FastTests=ON + -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_nvhpc + COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR}/build_nvhpc + # the pipes are escaped so the surrounding shell passes them to ctest verbatim + # instead of treating them as shell pipe operators + COMMAND cd ${PROJECT_BINARY_DIR}/build_nvhpc && ${CMAKE_CTEST_COMMAND} --parallel ${N} --exclude-regex "test-unicode\\|test-comparison_cpp20\\|test-comparison_legacy_cpp20\\|test-constructor1_cpp11\\|test-deserialization_cpp20" --output-on-failure + COMMENT "Compile and test with NVIDIA HPC SDK (nvc++)" +) + ############################################################################### # REUSE ############################################################################### diff --git a/docs/mkdocs/docs/community/quality_assurance.md b/docs/mkdocs/docs/community/quality_assurance.md index 4282163da..31990fa83 100644 --- a/docs/mkdocs/docs/community/quality_assurance.md +++ b/docs/mkdocs/docs/community/quality_assurance.md @@ -85,11 +85,16 @@ violations will result in a failed build. | GNU 16.1.0 | x86_64 | Ubuntu 22.04.1 LTS | GitHub | | GNU 16.1.0 | arm64 | Linux 6.1.100 | Cirrus CI | | icpc (ICC) 2021.5.0 20211109 | x86_64 | Ubuntu 20.04.3 LTS | GitHub | + | icpx (Intel oneAPI DPC++/C++) 2025.3.2 | x86_64 | Ubuntu 24.04 LTS | GitHub | + | nvc++ (NVIDIA HPC SDK) 25.5-0 | x86_64 | Ubuntu 22.04 LTS | GitHub | | MSVC 19.0.24241.7 | x86 | Windows 8.1 | AppVeyor | | MSVC 19.16.27035.0 | x86 | Windows-10 (Build 14393) | AppVeyor | | MSVC 19.29.30157.0 | x86 | Windows-10 (Build 17763) | AppVeyor | + | MSVC 19.44.35207.0 | arm64 | Windows 11 (Build 26200) | GitHub | | MSVC 19.44.35214.0 | x86 | Windows Server 2022 (Build 20348) | GitHub | | MSVC 19.44.35214.0 | x86_64 | Windows Server 2022 (Build 20348) | GitHub | + | MSVC 19.51.36231.0 | x86 | Windows Server 2025 (Build 26100) | GitHub | + | MSVC 19.51.36231.0 | x86_64 | Windows Server 2025 (Build 26100) | GitHub | - [x] The library is compiled with all C++ language revisions (C++11, C++14, C++17, C++20, C++23, and C++26) to detect and fix language deprecations early.