@@ -120,6 +120,22 @@ jobs:
120120 with :
121121 cmake-version : " 3.26.x"
122122
123+ - name : Install nlohmann-json
124+ shell : bash
125+ run : |
126+ if [[ "${{ runner.os }}" == "Linux" ]]; then
127+ sudo apt-get update && sudo apt-get install -y nlohmann-json3-dev
128+ elif [[ "${{ runner.os }}" == "macOS" ]]; then
129+ brew install nlohmann-json
130+ fi
131+
132+ - name : Install nlohmann-json (Windows)
133+ if : runner.os == 'Windows'
134+ run : |
135+ vcpkg install nlohmann-json:x64-windows
136+ echo "CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV
137+ shell : bash
138+
123139 - name : Install cxxbridge
124140 run : cargo install cxxbridge-cmd
125141
@@ -128,7 +144,13 @@ jobs:
128144 working-directory : ./src/rust
129145
130146 - name : Configure CMake
131- run : cmake -B build -G "${{ matrix.cmake_generator }}" -DCMAKE_BUILD_TYPE=Release
147+ shell : bash
148+ run : |
149+ CMAKE_ARGS="-B build -G \"${{ matrix.cmake_generator }}\" -DCMAKE_BUILD_TYPE=Release"
150+ if [[ -n "${CMAKE_TOOLCHAIN_FILE}" ]]; then
151+ CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}"
152+ fi
153+ eval cmake ${CMAKE_ARGS}
132154 working-directory : ./src/cpp
133155
134156 - name : Build C++ bindings
@@ -137,7 +159,8 @@ jobs:
137159 if [[ "${{ runner.os }}" = "Windows" ]]; then
138160 cmake --build build --config Release
139161 else
140- cmake --build build -- -j$(nproc)
162+ NPROC=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 2)
163+ cmake --build build -- -j${NPROC}
141164 fi
142165 working-directory : ./src/cpp
143166
0 commit comments