Skip to content

Commit 4962ce4

Browse files
committed
[CI] use Ninja on Windows (supports sccache)
1 parent 9e4e29e commit 4962ce4

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

.github/workflows/wheel.yml

+34-10
Original file line numberDiff line numberDiff line change
@@ -217,19 +217,42 @@ jobs:
217217
runs-on: ${{ matrix.os }}
218218
strategy:
219219
matrix:
220-
os: [macos-latest, windows-latest]
220+
include:
221+
- os: windows-latest
222+
cibw-arch: AMD64
223+
arch: amd64
224+
- os: windows-latest
225+
cibw-arch: x86
226+
arch: amd64_x86
227+
- os: windows-latest
228+
cibw-arch: ARM64
229+
arch: amd64_arm64
230+
- os: macos-latest
231+
cibw-arch: universal2
221232
fail-fast: false
222233
env:
223234
CONAN_HOME: ${{ github.workspace }}/.conan2
224235
SCCACHE_GHA_VERSION: "1"
225236
SCCACHE_CACHE_MULTIARCH: "1"
237+
CIBW_ARCHS: ${{ matrix.cibw-arch }}
238+
CIBW_ENABLE: 'pypy'
239+
CIBW_TEST_SKIP: 'pp*'
240+
CIBW_BUILD: 'cp311-* pp310-*'
226241
steps:
227242
- name: Checkout
228243
uses: actions/checkout@v4
229244

245+
- name: Install Python
246+
uses: actions/setup-python@v5
247+
with:
248+
python-version: "3.12"
249+
230250
- name: Install sccache
231251
uses: mozilla-actions/sccache-action@9e326ebed976843c9932b3aa0e021c6f50310eb4
232252

253+
- name: Install cibuildwheel
254+
run: python -m pip install cibuildwheel~=2.22.0
255+
233256
- name: Cache Conan dependencies
234257
uses: actions/cache@v4
235258
with:
@@ -250,19 +273,20 @@ jobs:
250273
cp -a scripts sdist
251274
252275
- name: Build wheels
253-
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969
254-
with:
255-
package-dir: sdist
256-
output-dir: dist
257-
env:
258-
CIBW_ENABLE: 'pypy'
259-
CIBW_TEST_SKIP: 'pp*'
260-
CIBW_BUILD: 'cp311-* pp310-*'
276+
if: runner.os == 'Windows'
277+
shell: cmd
278+
run: |
279+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }}
280+
cibuildwheel sdist --output-dir dist
281+
282+
- name: Build wheels
283+
if: runner.os != 'Windows'
284+
run: cibuildwheel sdist --output-dir dist
261285

262286
- name: Upload package
263287
uses: actions/upload-artifact@v4
264288
with:
265-
name: wheels-${{ matrix.os }}
289+
name: wheels-${{ matrix.os }}-${{ matrix.cibw-arch }}
266290
path: ./dist/*.whl
267291

268292
# This step checks the package version before release (to make sure that the

scripts/ci/pre-build-windows.py

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
arch={conan_arch}
5555
build_type=Release
5656
[conf]
57+
tools.cmake.cmaketoolchain:generator=Ninja Multi-Config
5758
tools.build:skip_test=True
5859
tools.build:cflags+={cpu_flags}
5960
tools.build:cxxflags+={cpu_flags}

scripts/ci/py-build-cmake.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[cmake]
2+
generator = "Ninja Multi-Config"
3+
14
[cmake.options]
25
"CMAKE_BUILD_TYPE" = "Debug" # Forces pybind11 to keep debug symbols (https://github.com/pybind/pybind11/issues/4454)
36

0 commit comments

Comments
 (0)