Improve MSVC C++ modules compatibility for nlohmann_json (#4952)

* Improve MSVC C++ modules compatibility for nlohmann_json

- Keep complete module interface with all exports
- Export all standard types: json, basic_json, adl_serializer, json_pointer, ordered_json, ordered_map
- Export detail namespace symbols for advanced usage
- Ensure compatibility with MSVC C++20/23 modules
- Maintain full functionality without breaking changes

Signed-off-by: yudaichen <250074249@qq.com>

* Add C++20 module Windows CI test and fix file ending

- Add ci_module_cpp20 job to Windows workflow to verify module support with MSVC

- Add missing newline at end of json.cppm file

Signed-off-by: yudaichen <250074249@qq.com>

---------

Signed-off-by: yudaichen <250074249@qq.com>
This commit is contained in:
Bander
2025-10-24 17:34:11 +08:00
committed by GitHub
parent 54be9b04f0
commit 11cc676142
2 changed files with 28 additions and 0 deletions

View File

@@ -112,3 +112,13 @@ jobs:
run: cmake --build build --config Debug --parallel 10
- name: Test
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
ci_module_cpp20:
runs-on: windows-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run CMake (Debug)
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_CI=ON -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
- name: Build
run: cmake --build build --config Debug --target ci_module_cpp20