From a0d48e5ad6388194f847a2016931d6c21ab1d4a0 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:06:30 +0200 Subject: [PATCH 01/28] Individual pipelines for all the different formats --- .github/workflows/windows.yaml | 40 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index bc4e2306..f9108f09 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -7,6 +7,22 @@ env: jobs: windows-msvc: + strategy: + fail-fast: false + matrix: + include: + - format: JSON + - format: AVRO + - format: BSON + - format: CAPNPROTO + - format: CBOR + - format: FLEXBUFFERS + - format: MSGPACK + - format: XML + - format: TOML + - format: UBJSON + - format: YAML + name: "windows-msvc (${{ matrix.format }})" runs-on: windows-latest steps: - name: Checkout @@ -24,27 +40,13 @@ jobs: - uses: lukka/run-vcpkg@v11 - name: Compile run: | - cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release + if [[ "${{ matrix.compiler }}" == "JSON" ]]; then + cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release + else + cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release + fi cmake --build build --config Release -j4 - name: Run tests run: | ctest --test-dir build --output-on-failure - - name: Run benchmarks - run: | - echo '# Benchmarks' >> $env:GITHUB_STEP_SUMMARY - echo '## Benchmarks across different formats' >> $env:GITHUB_STEP_SUMMARY - echo '```' >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\all\Release\reflect-cpp-all-format-benchmarks.exe --benchmark_filter=canada_read >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\all\Release\reflect-cpp-all-format-benchmarks.exe --benchmark_filter=canada_write >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\all\Release\reflect-cpp-all-format-benchmarks.exe --benchmark_filter=licenses_read >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\all\Release\reflect-cpp-all-format-benchmarks.exe --benchmark_filter=licenses_write >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\all\Release\reflect-cpp-all-format-benchmarks.exe --benchmark_filter=person_read >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\all\Release\reflect-cpp-all-format-benchmarks.exe --benchmark_filter=person_write >> $env:GITHUB_STEP_SUMMARY - echo '```' >> $env:GITHUB_STEP_SUMMARY - echo '## Benchmarks for JSON' >> $env:GITHUB_STEP_SUMMARY - echo '```' >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\json\Release\reflect-cpp-json-benchmarks.exe --benchmark_filter=person_read >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\json\Release\reflect-cpp-json-benchmarks.exe --benchmark_filter=canada >> $env:GITHUB_STEP_SUMMARY - .\build\benchmarks\json\Release\reflect-cpp-json-benchmarks.exe --benchmark_filter=licenses >> $env:GITHUB_STEP_SUMMARY - echo '```' >> $env:GITHUB_STEP_SUMMARY From 9299c4ed432a9b0181216092898035dbe59e6ee9 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:07:45 +0200 Subject: [PATCH 02/28] Fixed typo --- .github/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index f9108f09..ac07fb31 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -40,7 +40,7 @@ jobs: - uses: lukka/run-vcpkg@v11 - name: Compile run: | - if [[ "${{ matrix.compiler }}" == "JSON" ]]; then + if [[ "${{ matrix.format }}" == "JSON" ]]; then cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release else cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release From dd8b00a61e4dab0747df1c357d1c10a4ffbfd808 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:11:35 +0200 Subject: [PATCH 03/28] Better solution --- .github/workflows/windows.yaml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index ac07fb31..3b0c4a1c 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -38,13 +38,15 @@ jobs: core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: ilammy/msvc-dev-cmd@v1 - uses: lukka/run-vcpkg@v11 - - name: Compile + - name: Compile tests (JSON) + if: matrix.format == 'JSON' run: | - if [[ "${{ matrix.format }}" == "JSON" ]]; then - cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release - else - cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release - fi + cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release -j4 + - name: Compile tests (Other formats) + if: matrix.format != 'JSON' + run: | + cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release -j4 - name: Run tests run: | From eefbc1bf63fc9ee01d5b6bcc84bf777f5fec8832 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:27:12 +0200 Subject: [PATCH 04/28] Split up Linux as well --- .github/workflows/linux.yaml | 55 ++++++++++------------------------ .github/workflows/windows.yaml | 1 - 2 files changed, 15 insertions(+), 41 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index c3200d9c..192f7360 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -12,34 +12,23 @@ jobs: matrix: include: - compiler: llvm - compiler-version: 16 - cxx: 20 - - compiler: llvm - compiler-version: 17 - cxx: 20 - - compiler: llvm - compiler-version: 18 - cxx: 20 + compiler-version: [16, 17, 18] + cxx: 20 + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], - compiler: gcc compiler-version: 11 additional-dep: "g++-11" cxx: 20 + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], - compiler: gcc - compiler-version: 12 + compiler-version: [12, 13, 14] cxx: 20 + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], - compiler: gcc - compiler-version: 13 - cxx: 20 - - compiler: gcc - compiler-version: 14 - cxx: 20 - - compiler: gcc - compiler-version: 13 + compiler-version: [13, 14] cxx: 23 - - compiler: gcc - compiler-version: 14 - cxx: 23 - name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }})" + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], + name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }})" runs-on: ubuntu-24.04 steps: - name: Checkout @@ -56,7 +45,7 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 with: - key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}" + key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }}" max-size: "2G" - name: Run vcpkg uses: lukka/run-vcpkg@v11 @@ -83,26 +72,12 @@ jobs: sudo ln -s $(which ccache) /usr/local/bin/$CC sudo ln -s $(which ccache) /usr/local/bin/$CXX $CXX --version - cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release + if [[ "${{ matrix.format }}" == "JSON" ]]; then + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release + elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DREFLECTCPP_${{ matrix.format }}=ON -DREFLECTCPP_JSON=OFF + fi cmake --build build - name: Run tests run: | ctest --test-dir build --output-on-failure - - name: Run benchmarks - run: | - echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY - echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 3b0c4a1c..f1a2c577 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -12,7 +12,6 @@ jobs: matrix: include: - format: JSON - - format: AVRO - format: BSON - format: CAPNPROTO - format: CBOR From b0044573afc4905897d53fcb4d114b9c6dde2b52 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:30:07 +0200 Subject: [PATCH 05/28] Fixed typo --- .github/workflows/linux.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 192f7360..0c56a33f 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -14,20 +14,20 @@ jobs: - compiler: llvm compiler-version: [16, 17, 18] cxx: 20 - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - compiler: gcc compiler-version: 11 additional-dep: "g++-11" cxx: 20 - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - compiler: gcc compiler-version: [12, 13, 14] cxx: 20 - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - compiler: gcc compiler-version: [13, 14] cxx: 23 - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"], + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }})" runs-on: ubuntu-24.04 steps: From e3c8c09aa35a12e0d8942165a3d630e3154e4039 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:34:25 +0200 Subject: [PATCH 06/28] Everything as arrays --- .github/workflows/linux.yaml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 0c56a33f..38299975 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -8,25 +8,24 @@ env: jobs: linux: strategy: - fail-fast: false matrix: include: - - compiler: llvm + - compiler: [llvm] compiler-version: [16, 17, 18] - cxx: 20 + cxx: [20] format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - - compiler: gcc - compiler-version: 11 - additional-dep: "g++-11" - cxx: 20 + - compiler: [gcc] + compiler-version: [11] + additional-dep: ["g++-11"] + cxx: [20] format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - - compiler: gcc + - compiler: [gcc] compiler-version: [12, 13, 14] - cxx: 20 + cxx: [20] format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - - compiler: gcc + - compiler: [gcc] compiler-version: [13, 14] - cxx: 23 + cxx: [23] format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }})" runs-on: ubuntu-24.04 From 10b6022015c8b6d3ab91c203de1918e1778b2b2b Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 19:40:05 +0200 Subject: [PATCH 07/28] Set up the matrix properly --- .github/workflows/linux.yaml | 46 +++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 38299975..bb634562 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -9,24 +9,36 @@ jobs: linux: strategy: matrix: + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] include: - - compiler: [llvm] - compiler-version: [16, 17, 18] - cxx: [20] - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - - compiler: [gcc] - compiler-version: [11] - additional-dep: ["g++-11"] - cxx: [20] - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - - compiler: [gcc] - compiler-version: [12, 13, 14] - cxx: [20] - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - - compiler: [gcc] - compiler-version: [13, 14] - cxx: [23] - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + - compiler: llvm + compiler-version: 16 + cxx: 20 + - compiler: llvm + compiler-version: 17 + cxx: 20 + - compiler: llvm + compiler-version: 18 + cxx: 20 + - compiler: gcc + compiler-version: 11 + additional-dep: "g++-11" + cxx: 20 + - compiler: gcc + compiler-version: 12 + cxx: 20 + - compiler: gcc + compiler-version: 13 + cxx: 20 + - compiler: gcc + compiler-version: 14 + cxx: 20 + - compiler: gcc + compiler-version: 13 + cxx: 23 + - compiler: gcc + compiler-version: 14 + cxx: 23 name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }})" runs-on: ubuntu-24.04 steps: From dfb81848f47bb46f47e273fd2f6e23cd650f4dc8 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 20:18:46 +0200 Subject: [PATCH 08/28] Separate conan --- .github/workflows/linux.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index bb634562..7267b4ce 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -9,7 +9,7 @@ jobs: linux: strategy: matrix: - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML", "conan"] include: - compiler: llvm compiler-version: 16 @@ -65,6 +65,7 @@ jobs: sudo apt update sudo apt install -y ninja-build ${{ matrix.additional-dep }} - name: Install Conan + if: matrix.format == "conan" run: | sudo apt install -y pipx pipx install conan @@ -72,6 +73,7 @@ jobs: - name: Make sure the library compiles with Conan run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True - name: Compile + if: matrix.format != "conan" run: | if [[ "${{ matrix.compiler }}" == "llvm" ]]; then export CC=clang-${{ matrix.compiler-version }} From e30f0aeba4e5e2e11659334e3ae27ea98ab88b5c Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 20:19:59 +0200 Subject: [PATCH 09/28] In single quotes --- .github/workflows/linux.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 7267b4ce..2b21cdeb 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -65,7 +65,7 @@ jobs: sudo apt update sudo apt install -y ninja-build ${{ matrix.additional-dep }} - name: Install Conan - if: matrix.format == "conan" + if: matrix.format == 'conan' run: | sudo apt install -y pipx pipx install conan @@ -73,7 +73,7 @@ jobs: - name: Make sure the library compiles with Conan run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True - name: Compile - if: matrix.format != "conan" + if: matrix.format != 'conan' run: | if [[ "${{ matrix.compiler }}" == "llvm" ]]; then export CC=clang-${{ matrix.compiler-version }} From 68e27c2f224fc0c0c6b201e35aab44d7f3d2b12a Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 20:30:41 +0200 Subject: [PATCH 10/28] Split up the package managers for linux --- .github/workflows/linux.yaml | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 2b21cdeb..5ac4e6a8 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -8,8 +8,8 @@ env: jobs: linux: strategy: + package-manager: ["vcpkg", "conan"] matrix: - format: ["JSON", "AVRO", "BSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML", "conan"] include: - compiler: llvm compiler-version: 16 @@ -39,7 +39,7 @@ jobs: - compiler: gcc compiler-version: 14 cxx: 23 - name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }})" + name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.package-manager }})" runs-on: ubuntu-24.04 steps: - name: Checkout @@ -56,7 +56,7 @@ jobs: - name: Setup ccache uses: hendrikmuhs/ccache-action@v1 with: - key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.format }}" + key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}" max-size: "2G" - name: Run vcpkg uses: lukka/run-vcpkg@v11 @@ -65,7 +65,7 @@ jobs: sudo apt update sudo apt install -y ninja-build ${{ matrix.additional-dep }} - name: Install Conan - if: matrix.format == 'conan' + if: matrix.package-manager == 'conan' run: | sudo apt install -y pipx pipx install conan @@ -73,7 +73,7 @@ jobs: - name: Make sure the library compiles with Conan run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True - name: Compile - if: matrix.format != 'conan' + if: matrix.package-manager != 'conan' run: | if [[ "${{ matrix.compiler }}" == "llvm" ]]; then export CC=clang-${{ matrix.compiler-version }} @@ -85,12 +85,28 @@ jobs: sudo ln -s $(which ccache) /usr/local/bin/$CC sudo ln -s $(which ccache) /usr/local/bin/$CXX $CXX --version - if [[ "${{ matrix.format }}" == "JSON" ]]; then - cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release - elif [[ "${{ matrix.compiler }}" == "gcc" ]]; then - cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DREFLECTCPP_${{ matrix.format }}=ON -DREFLECTCPP_JSON=OFF - fi + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release cmake --build build - name: Run tests + if: matrix.package-manager != 'conan' run: | ctest --test-dir build --output-on-failure + - name: Run benchmarks + if: matrix.package-manager != 'conan' + run: | + echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY From 47614823ee61754fefe497089d279faaf4d30553 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 20:31:54 +0200 Subject: [PATCH 11/28] Put the package-manager inside the matrix --- .github/workflows/linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 5ac4e6a8..a3f3b595 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -8,8 +8,8 @@ env: jobs: linux: strategy: - package-manager: ["vcpkg", "conan"] matrix: + package-manager: ["vcpkg", "conan"] include: - compiler: llvm compiler-version: 16 From 015e53a04024535250070e6d7c35edc2a68f7dee Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 20:34:24 +0200 Subject: [PATCH 12/28] Fixed some typos --- .github/workflows/linux.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index a3f3b595..5298a20f 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -59,6 +59,7 @@ jobs: key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}" max-size: "2G" - name: Run vcpkg + if: matrix.package-manager != 'conan' uses: lukka/run-vcpkg@v11 - name: Install dependencies run: | @@ -71,6 +72,7 @@ jobs: pipx install conan conan profile detect - name: Make sure the library compiles with Conan + if: matrix.package-manager == 'conan' run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True - name: Compile if: matrix.package-manager != 'conan' From 626e522f20bb138af4e40f6dc97585c226ec2ba6 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 21:50:20 +0200 Subject: [PATCH 13/28] Don't run all combinations --- .github/workflows/linux.yaml | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 5298a20f..7405330c 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -9,36 +9,52 @@ jobs: linux: strategy: matrix: - package-manager: ["vcpkg", "conan"] include: - compiler: llvm compiler-version: 16 - cxx: 20 + cxx: 20 + package-manager: vcpkg - compiler: llvm compiler-version: 17 cxx: 20 + package-manager: vcpkg - compiler: llvm compiler-version: 18 cxx: 20 + package-manager: vcpkg - compiler: gcc compiler-version: 11 additional-dep: "g++-11" cxx: 20 + package-manager: vcpkg - compiler: gcc compiler-version: 12 cxx: 20 + package-manager: vcpkg - compiler: gcc compiler-version: 13 cxx: 20 + package-manager: vcpkg - compiler: gcc compiler-version: 14 cxx: 20 + package-manager: vcpkg - compiler: gcc compiler-version: 13 cxx: 23 + package-manager: vcpkg + - compiler: gcc + compiler-version: 14 + cxx: 23 + package-manager: vcpkg + - compiler: gcc + compiler-version: 14 + cxx: 20 + package-manager: conan - compiler: gcc compiler-version: 14 cxx: 23 + package-manager: conan name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.package-manager }})" runs-on: ubuntu-24.04 steps: @@ -53,11 +69,6 @@ jobs: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: "${{ github.job }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}" - max-size: "2G" - name: Run vcpkg if: matrix.package-manager != 'conan' uses: lukka/run-vcpkg@v11 @@ -84,8 +95,6 @@ jobs: export CC=gcc-${{ matrix.compiler-version }} export CXX=g++-${{ matrix.compiler-version }} fi - sudo ln -s $(which ccache) /usr/local/bin/$CC - sudo ln -s $(which ccache) /usr/local/bin/$CXX $CXX --version cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release cmake --build build From e264d67660d51ff22de57e5dd2fc3b6a7c790012 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 21:51:50 +0200 Subject: [PATCH 14/28] Conan for llvm-18 --- .github/workflows/linux.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 7405330c..adacabf0 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -47,6 +47,10 @@ jobs: compiler-version: 14 cxx: 23 package-manager: vcpkg + - compiler: llvm + compiler-version: 18 + cxx: 20 + package-manager: conan - compiler: gcc compiler-version: 14 cxx: 20 From 903b09b4e90c667f879c843fc3a767238d8c8ced Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sun, 27 Jul 2025 22:04:08 +0200 Subject: [PATCH 15/28] Remove Conan from the macOS pipeline --- .github/workflows/macos.yaml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 6fc732ba..8d1dccee 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -24,19 +24,8 @@ jobs: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1 - with: - key: "${{ github.job }}-${{ matrix.os }}" - max-size: "2G" - create-symlink: true - name: Run vcpkg uses: lukka/run-vcpkg@v11 - - name: Install Conan - run: | - brew install pipx - pipx install conan - conan profile detect - name: Install ninja run: brew install ninja if: matrix.os == 'macos-latest' From e89a6317bac1f6bad2be7bf8526745bede57fb23 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Mon, 28 Jul 2025 18:35:26 +0200 Subject: [PATCH 16/28] Add JSON when necessary --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ade4cc6..568d3a6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,7 +94,7 @@ if (REFLECTCPP_USE_VCPKG) list(APPEND VCPKG_MANIFEST_FEATURES "flexbuffers") endif() - if (REFLECTCPP_JSON AND NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) + if ((REFLECTCPP_JSON OR REFLECTCPP_AVRO OR REFLECTCPP_CBOR OR REFLECTCPP_UBJSON) AND NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) list(APPEND VCPKG_MANIFEST_FEATURES "json") endif() @@ -162,7 +162,7 @@ else () target_link_libraries(reflectcpp PUBLIC ctre::ctre) endif () -if (REFLECTCPP_JSON) +if (REFLECTCPP_JSON OR REFLECTCPP_AVRO OR REFLECTCPP_CBOR OR REFLECTCPP_UBJSON) list(APPEND REFLECT_CPP_SOURCES src/reflectcpp_json.cpp ) From aa04bb7dbafbca6d329abdd7bed75e8a6bb6f777 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Mon, 28 Jul 2025 22:49:05 +0200 Subject: [PATCH 17/28] Split up macOS as well --- .github/workflows/macos.yaml | 26 +++++++------------------- .github/workflows/windows.yaml | 12 +----------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 8d1dccee..e7ade986 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -11,6 +11,8 @@ jobs: fail-fast: false matrix: os: ["macos-latest", "macos-13"] + format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + name: "${{ matrix.os }} (${{ matrix.format }})" runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -39,26 +41,12 @@ jobs: export CMAKE_GENERATOR=Ninja fi $CXX --version - cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + if [[ "${{ matrix.format == 'JSON' }}" == "true" ]]; then + cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + else + cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + fi cmake --build build -j 4 - name: Run tests run: | ctest --test-dir build --output-on-failure - - name: Run benchmarks - run: | - echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY - echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index f1a2c577..6f6b84c0 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -10,17 +10,7 @@ jobs: strategy: fail-fast: false matrix: - include: - - format: JSON - - format: BSON - - format: CAPNPROTO - - format: CBOR - - format: FLEXBUFFERS - - format: MSGPACK - - format: XML - - format: TOML - - format: UBJSON - - format: YAML + format: ["JSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] name: "windows-msvc (${{ matrix.format }})" runs-on: windows-latest steps: From 855690191eff9d92bcabe0a055e6f256434ab009 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Mon, 28 Jul 2025 23:06:38 +0200 Subject: [PATCH 18/28] Add REFLECTCPP_ALL_FORMATS --- CMakeLists.txt | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 568d3a6a..8fe8bf53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,17 +3,18 @@ cmake_minimum_required(VERSION 3.23) option(REFLECTCPP_BUILD_SHARED "Build shared library" ${BUILD_SHARED_LIBS}) option(REFLECTCPP_INSTALL "Install reflect cpp" OFF) +option(REFLECTCPP_ALL_FORMATS "Enable all supported formats" OFF) option(REFLECTCPP_JSON "Enable JSON support" ON) # enabled by default -option(REFLECTCPP_AVRO "Enable AVRO support" OFF) -option(REFLECTCPP_BSON "Enable BSON support" OFF) -option(REFLECTCPP_CAPNPROTO "Enable Cap’n Proto support" OFF) -option(REFLECTCPP_CBOR "Enable CBOR support" OFF) -option(REFLECTCPP_FLEXBUFFERS "Enable flexbuffers support" OFF) -option(REFLECTCPP_MSGPACK "Enable msgpack support" OFF) -option(REFLECTCPP_XML "Enable XML support" OFF) -option(REFLECTCPP_TOML "Enable TOML support" OFF) -option(REFLECTCPP_UBJSON "Enable UBJSON support" OFF) -option(REFLECTCPP_YAML "Enable YAML support" OFF) +option(REFLECTCPP_AVRO "Enable AVRO support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_BSON "Enable BSON support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_CAPNPROTO "Enable Cap’n Proto support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_CBOR "Enable CBOR support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_FLEXBUFFERS "Enable flexbuffers support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_MSGPACK "Enable msgpack support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_XML "Enable XML support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_TOML "Enable TOML support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_UBJSON "Enable UBJSON support" ${REFLECTCPP_ALL_FORMATS}) +option(REFLECTCPP_YAML "Enable YAML support" ${REFLECTCPP_ALL_FORMATS}) option(REFLECTCPP_BUILD_BENCHMARKS "Build benchmarks" OFF) option(REFLECTCPP_BUILD_TESTS "Build tests" OFF) From 4b0b97eb27092f0629f2eed4fbb359b7bda675c2 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Mon, 28 Jul 2025 23:15:29 +0200 Subject: [PATCH 19/28] Next attempt to split up linux --- .github/workflows/linux.yaml | 45 +++++++++++++++++------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index adacabf0..9de33b74 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -8,7 +8,13 @@ env: jobs: linux: strategy: + fail-fast: false matrix: + format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + compiler: [llvm, gcc] + compiler-version: [11, 12, 13, 14, 16, 17, 18] + cxx: [20, 23] + package-manager: [vcpkg, conan] include: - compiler: llvm compiler-version: 16 @@ -24,7 +30,6 @@ jobs: package-manager: vcpkg - compiler: gcc compiler-version: 11 - additional-dep: "g++-11" cxx: 20 package-manager: vcpkg - compiler: gcc @@ -51,15 +56,18 @@ jobs: compiler-version: 18 cxx: 20 package-manager: conan + format: "JSON" - compiler: gcc compiler-version: 14 cxx: 20 package-manager: conan + format: "JSON" - compiler: gcc compiler-version: 14 cxx: 23 package-manager: conan - name: "${{ github.job }} (C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.package-manager }})" + format: "JSON" + name: "${{ github.job }} (${{ matrix.format }}-C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.package-manager }})" runs-on: ubuntu-24.04 steps: - name: Checkout @@ -79,7 +87,11 @@ jobs: - name: Install dependencies run: | sudo apt update - sudo apt install -y ninja-build ${{ matrix.additional-dep }} + if [[ "${{ matrix.compiler-version }}" == 11 ]]; then + sudo apt install -y ninja-build g++-11 + else + sudo apt install -y ninja-build + fi - name: Install Conan if: matrix.package-manager == 'conan' run: | @@ -100,28 +112,13 @@ jobs: export CXX=g++-${{ matrix.compiler-version }} fi $CXX --version - cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_BSON=ON -DREFLECTCPP_CAPNPROTO=ON -DREFLECTCPP_CBOR=ON -DREFLECTCPP_FLEXBUFFERS=ON -DREFLECTCPP_MSGPACK=ON -DREFLECTCPP_TOML=ON -DREFLECTCPP_XML=ON -DREFLECTCPP_YAML=ON -DCMAKE_BUILD_TYPE=Release - cmake --build build + if [[ "${{ matrix.format == 'JSON' }}" == "true" ]]; then + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release + else + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release + fi + cmake --build build -j4 - name: Run tests if: matrix.package-manager != 'conan' run: | ctest --test-dir build --output-on-failure - - name: Run benchmarks - if: matrix.package-manager != 'conan' - run: | - echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY - echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY - ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY From 35809fce9fc29e0ab3e015f07e41f39557bf45c0 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Mon, 28 Jul 2025 23:16:41 +0200 Subject: [PATCH 20/28] Next attempt --- .github/workflows/linux.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 9de33b74..42723e39 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -11,10 +11,6 @@ jobs: fail-fast: false matrix: format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - compiler: [llvm, gcc] - compiler-version: [11, 12, 13, 14, 16, 17, 18] - cxx: [20, 23] - package-manager: [vcpkg, conan] include: - compiler: llvm compiler-version: 16 From a834c89cd497e3538aff87461acc0769b060492f Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Mon, 28 Jul 2025 23:25:37 +0200 Subject: [PATCH 21/28] Next attempt --- .github/workflows/linux.yaml | 59 +++++++++++++----------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 42723e39..b841b9e9 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -11,58 +11,41 @@ jobs: fail-fast: false matrix: format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] - include: - - compiler: llvm + compiler: [llvm, gcc] + compiler-version: [11, 12, 13, 14, 16, 17, 18] + cxx: [20, 23] + package-manager: [vcpkg] + exclude: + - compiler: gcc compiler-version: 16 - cxx: 20 - package-manager: vcpkg - - compiler: llvm + - compiler: gcc compiler-version: 17 - cxx: 20 - package-manager: vcpkg - - compiler: llvm + - compiler: gcc compiler-version: 18 - cxx: 20 - package-manager: vcpkg - - compiler: gcc + - compiler: llvm compiler-version: 11 - cxx: 20 - package-manager: vcpkg - - compiler: gcc + - compiler: llvm compiler-version: 12 - cxx: 20 package-manager: vcpkg - - compiler: gcc + - compiler: llvm compiler-version: 13 - cxx: 20 - package-manager: vcpkg - - compiler: gcc + - compiler: llvm compiler-version: 14 - cxx: 20 - package-manager: vcpkg - compiler: gcc - compiler-version: 13 + compiler-version: 11 cxx: 23 - package-manager: vcpkg - compiler: gcc - compiler-version: 14 + compiler-version: 12 cxx: 23 - package-manager: vcpkg - - compiler: llvm - compiler-version: 18 - cxx: 20 - package-manager: conan - format: "JSON" - - compiler: gcc - compiler-version: 14 - cxx: 20 - package-manager: conan - format: "JSON" - compiler: gcc - compiler-version: 14 + compiler-version: 13 + cxx: 23 + - compiler: llvm + compiler-version: 16 + cxx: 23 + - compiler: llvm + compiler-version: 17 cxx: 23 - package-manager: conan - format: "JSON" name: "${{ github.job }} (${{ matrix.format }}-C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.package-manager }})" runs-on: ubuntu-24.04 steps: From 14c946bc6c9746c1b3a50de19d16636611eb1893 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Tue, 29 Jul 2025 20:55:06 +0200 Subject: [PATCH 22/28] Added the benchmarks back into the linux pipeline --- .github/workflows/linux.yaml | 41 ++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index b841b9e9..bd54f7f3 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -10,11 +10,10 @@ jobs: strategy: fail-fast: false matrix: - format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML", "benchmarks"] compiler: [llvm, gcc] compiler-version: [11, 12, 13, 14, 16, 17, 18] cxx: [20, 23] - package-manager: [vcpkg] exclude: - compiler: gcc compiler-version: 16 @@ -46,7 +45,7 @@ jobs: - compiler: llvm compiler-version: 17 cxx: 23 - name: "${{ github.job }} (${{ matrix.format }}-C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }}-${{ matrix.package-manager }})" + name: "${{ github.job }} (${{ matrix.format }}-C++${{ matrix.cxx }}-${{ matrix.compiler }}-${{ matrix.compiler-version }})" runs-on: ubuntu-24.04 steps: - name: Checkout @@ -61,7 +60,6 @@ jobs: core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - name: Run vcpkg - if: matrix.package-manager != 'conan' uses: lukka/run-vcpkg@v11 - name: Install dependencies run: | @@ -71,17 +69,7 @@ jobs: else sudo apt install -y ninja-build fi - - name: Install Conan - if: matrix.package-manager == 'conan' - run: | - sudo apt install -y pipx - pipx install conan - conan profile detect - - name: Make sure the library compiles with Conan - if: matrix.package-manager == 'conan' - run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True - name: Compile - if: matrix.package-manager != 'conan' run: | if [[ "${{ matrix.compiler }}" == "llvm" ]]; then export CC=clang-${{ matrix.compiler-version }} @@ -91,13 +79,34 @@ jobs: export CXX=g++-${{ matrix.compiler-version }} fi $CXX --version - if [[ "${{ matrix.format == 'JSON' }}" == "true" ]]; then + if [[ "${{ matrix.format }}" == "JSON" ]]; then cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release + elif [[ "${{ matrix.format }}" == "benchmarks" ]]; then + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_ALL_FORMATS=ON -DCMAKE_BUILD_TYPE=Release else cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release fi cmake --build build -j4 - name: Run tests - if: matrix.package-manager != 'conan' + if: matrix.compiler != 'benchmarks' run: | ctest --test-dir build --output-on-failure + - name: Run benchmarks + if: matrix.compiler == 'benchmarks' + run: | + echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY From b44577e6d9fd6ab068e38283e561a89dedb267e5 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Tue, 29 Jul 2025 20:56:32 +0200 Subject: [PATCH 23/28] Fixed typo --- .github/workflows/linux.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index bd54f7f3..86bf5ac7 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -25,7 +25,6 @@ jobs: compiler-version: 11 - compiler: llvm compiler-version: 12 - package-manager: vcpkg - compiler: llvm compiler-version: 13 - compiler: llvm From 87beb59778527817eee84853197f2347aa72b6b1 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Tue, 29 Jul 2025 22:03:18 +0200 Subject: [PATCH 24/28] Removed headers we don't have to precompile --- benchmarks/all/CMakeLists.txt | 2 +- benchmarks/json/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/all/CMakeLists.txt b/benchmarks/all/CMakeLists.txt index b79a06f6..cbed3067 100644 --- a/benchmarks/all/CMakeLists.txt +++ b/benchmarks/all/CMakeLists.txt @@ -6,7 +6,7 @@ add_executable( reflect-cpp-all-format-benchmarks ${SOURCES} ) -target_precompile_headers(reflect-cpp-all-format-benchmarks PRIVATE [["rfl.hpp"]] ) +target_precompile_headers(reflect-cpp-all-format-benchmarks PRIVATE [["rfl.hpp"]] ) target_include_directories(reflect-cpp-all-format-benchmarks SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") target_include_directories(reflect-cpp-all-format-benchmarks SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include/tinycbor") diff --git a/benchmarks/json/CMakeLists.txt b/benchmarks/json/CMakeLists.txt index bf4d8ba0..60dd74dd 100644 --- a/benchmarks/json/CMakeLists.txt +++ b/benchmarks/json/CMakeLists.txt @@ -6,7 +6,7 @@ add_executable( reflect-cpp-json-benchmarks ${SOURCES} ) -target_precompile_headers(reflect-cpp-json-benchmarks PRIVATE [["rfl.hpp"]] ) +target_precompile_headers(reflect-cpp-json-benchmarks PRIVATE [["rfl.hpp"]] ) target_include_directories(reflect-cpp-json-benchmarks SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include") From e866f15b4a93648424a1259b8a7a2671cd4fb33a Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Tue, 29 Jul 2025 22:41:01 +0200 Subject: [PATCH 25/28] Added benchmarks to Windows --- .github/workflows/linux.yaml | 4 ++-- .github/workflows/windows.yaml | 28 ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 86bf5ac7..83df6c4a 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -87,11 +87,11 @@ jobs: fi cmake --build build -j4 - name: Run tests - if: matrix.compiler != 'benchmarks' + if: matrix.format != 'benchmarks' run: | ctest --test-dir build --output-on-failure - name: Run benchmarks - if: matrix.compiler == 'benchmarks' + if: matrix.format == 'benchmarks' run: | echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 6f6b84c0..1727de4e 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - format: ["JSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + format: ["JSON", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML", "benchmarks"] name: "windows-msvc (${{ matrix.format }})" runs-on: windows-latest steps: @@ -27,17 +27,41 @@ jobs: core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - uses: ilammy/msvc-dev-cmd@v1 - uses: lukka/run-vcpkg@v11 + - name: Compile benchmarks + if: matrix.format == 'benchmarks' + run: | + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_ALL_FORMATS=ON -DCMAKE_BUILD_TYPE=Release + cmake --build build --config Release -j4 - name: Compile tests (JSON) if: matrix.format == 'JSON' run: | cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release -j4 - name: Compile tests (Other formats) - if: matrix.format != 'JSON' + if: matrix.format != 'JSON' && matrix.format != 'benchmarks' run: | cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release -j4 - name: Run tests run: | ctest --test-dir build --output-on-failure + - name: Run benchmarks + if: matrix.format == 'benchmarks' + run: | + echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY From 818685149dc6c4571d8a07ccec6c23bbc9f44af2 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Wed, 30 Jul 2025 19:53:37 +0200 Subject: [PATCH 26/28] Added benchmarks to macOS --- .github/workflows/macos.yaml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index e7ade986..60f3f0aa 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -11,7 +11,7 @@ jobs: fail-fast: false matrix: os: ["macos-latest", "macos-13"] - format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML"] + format: ["JSON", "AVRO", "CAPNPROTO", "CBOR", "FLEXBUFFERS", "MSGPACK", "XML", "TOML", "UBJSON", "YAML", "benchmarks"] name: "${{ matrix.os }} (${{ matrix.format }})" runs-on: ${{ matrix.os }} steps: @@ -41,12 +41,34 @@ jobs: export CMAKE_GENERATOR=Ninja fi $CXX --version - if [[ "${{ matrix.format == 'JSON' }}" == "true" ]]; then + if [[ "${{ matrix.format }}" == "JSON" ]]; then cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ + elif [[ "${{ matrix.format }}" == "benchmarks" ]]; then + cmake -S . -B build -G Ninja -DCMAKE_CXX_STANDARD=${{ matrix.cxx }} -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_BENCHMARKS=ON -DREFLECTCPP_ALL_FORMATS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ else cmake -S . -B build -DCMAKE_CXX_STANDARD=20 -DREFLECTCPP_BUILD_TESTS=ON -DREFLECTCPP_JSON=OFF -DREFLECTCPP_${{ matrix.format }}=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ fi cmake --build build -j 4 - name: Run tests + if: matrix.format != 'benchmarks' run: | ctest --test-dir build --output-on-failure + - name: Run benchmarks + if: matrix.format == 'benchmarks' + run: | + echo '# Benchmarks' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks across different formats' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=canada_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=licenses_write >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/all/reflect-cpp-all-format-benchmarks --benchmark_filter=person_write >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo '## Benchmarks for JSON' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=person_read >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=canada >> $GITHUB_STEP_SUMMARY + ./build/benchmarks/json/reflect-cpp-json-benchmarks --benchmark_filter=licenses >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY From 8f2ca494f884207accabd9d284a39b28f7ef03fa Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Wed, 30 Jul 2025 21:20:16 +0200 Subject: [PATCH 27/28] Added Conan --- .github/workflows/linux-conan.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/linux-conan.yaml diff --git a/.github/workflows/linux-conan.yaml b/.github/workflows/linux-conan.yaml new file mode 100644 index 00000000..9bcc1b84 --- /dev/null +++ b/.github/workflows/linux-conan.yaml @@ -0,0 +1,25 @@ +name: linux + +on: [ push, pull_request ] + +jobs: + linux: + name: "${{ github.job }} (Conan)" + runs-on: ubuntu-24.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y ninja-build pipx + - name: Install Conan + run: | + pipx install conan + conan profile detect + - name: Make sure the library compiles with Conan + run: conan build . --build=missing -s compiler.cppstd=gnu20 -o *:with_capnproto=True -o *:with_cbor=True -o *:with_flatbuffers=True -o *:with_msgpack=True -o *:with_toml=True -o *:with_ubjson=True -o *:with_xml=True -o *:with_yaml=True + From 7d47a0724c92e6accf4c981dc1f4e219406cad05 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Wed, 30 Jul 2025 22:01:56 +0200 Subject: [PATCH 28/28] Minor fixes --- CMakeLists.txt | 10 ++++++++-- reflectcpp-config.cmake.in | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fe8bf53..7d092f8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,12 @@ if (REFLECTCPP_BUILD_TESTS OR REFLECTCPP_BUILD_BENCHMARKS OR set(REFLECTCPP_USE_VCPKG_DEFAULT ON) endif() +if(REFLECTCPP_JSON OR REFLECTCPP_AVRO OR REFLECTCPP_CBOR OR REFLECTCPP_UBJSON) + set(_REFLECTCPP_NEEDS_JSON_IMPL ON) +else() + set(_REFLECTCPP_NEEDS_JSON_IMPL OFF) +endif() + option(REFLECTCPP_USE_VCPKG "Use VCPKG to download and build dependencies" ${REFLECTCPP_USE_VCPKG_DEFAULT}) if (REFLECTCPP_USE_VCPKG) @@ -95,7 +101,7 @@ if (REFLECTCPP_USE_VCPKG) list(APPEND VCPKG_MANIFEST_FEATURES "flexbuffers") endif() - if ((REFLECTCPP_JSON OR REFLECTCPP_AVRO OR REFLECTCPP_CBOR OR REFLECTCPP_UBJSON) AND NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) + if (_REFLECTCPP_NEEDS_JSON_IMPL AND NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) list(APPEND VCPKG_MANIFEST_FEATURES "json") endif() @@ -163,7 +169,7 @@ else () target_link_libraries(reflectcpp PUBLIC ctre::ctre) endif () -if (REFLECTCPP_JSON OR REFLECTCPP_AVRO OR REFLECTCPP_CBOR OR REFLECTCPP_UBJSON) +if (_REFLECTCPP_NEEDS_JSON_IMPL) list(APPEND REFLECT_CPP_SOURCES src/reflectcpp_json.cpp ) diff --git a/reflectcpp-config.cmake.in b/reflectcpp-config.cmake.in index f000148a..c38da966 100644 --- a/reflectcpp-config.cmake.in +++ b/reflectcpp-config.cmake.in @@ -18,8 +18,11 @@ endif() include(${CMAKE_CURRENT_LIST_DIR}/reflectcpp-exports.cmake) -if (REFLECTCPP_JSON AND NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) +if (NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) find_dependency(ctre) +endif() + +if ((REFLECTCPP_JSON OR REFLECTCPP_AVRO OR REFLECTCPP_CBOR OR REFLECTCPP_UBJSON) AND NOT REFLECTCPP_USE_BUNDLED_DEPENDENCIES) find_dependency(yyjson) endif()