Skip to content

Commit b938db7

Browse files
committed
ci: Enable Ninja builds, which requires msvc vars (via msvc-dev-cmd action), disable unnecessary ccache from Windows CIBW
1 parent 0ee500c commit b938db7

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/packaging_wheels.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,26 @@ jobs:
8989
cache-suffix: -${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}
9090
python-version: ${{ matrix.python }}
9191

92+
# Load MSVC environment, needed for Windows - ninja builds
93+
# Without this, the linking step will fail.
94+
# Note: CIBW uses the host environment for windows, rather than an isolated container
95+
- uses: ilammy/msvc-dev-cmd@v1
96+
if: ${{ matrix.platform.cibw_system == 'win' }}
97+
with:
98+
arch: ${{ matrix.platform.arch }}
99+
92100
- name: Build${{ inputs.testsuite != 'none' && ' and test ' || ' ' }}wheels
93101
uses: pypa/[email protected]
94102
env:
95103
CIBW_ARCHS: ${{ matrix.platform.arch == 'amd64' && 'AMD64' || matrix.platform.arch }}
96104
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform.cibw_system }}_${{ matrix.platform.arch }}
97-
# PYTHON_GIL=1: Suppresses the RuntimeWarning that the GIL is enabled on free-threaded builds.
98-
# TODO: Remove PYTHON_GIL=1 when free-threaded is supported.
105+
# PYTHON_GIL=1: Suppresses the RuntimeWarning that the GIL is enabled on free-threaded builds.
106+
# TODO: Remove PYTHON_GIL=1 when free-threaded is supported.
107+
# CMAKE_BUILD_TYPE=Release: Override Debug default when MSVC dev environment is loaded
99108
CIBW_ENVIRONMENT: PYTHON_GIL=1
109+
# For Windows, msvc-dev-cmd sets build to Debug. So, override it back to Release.
110+
# This is a problem because Debug enables Jemalloc, which fails to build on Windows
111+
CIBW_ENVIRONMENT_WINDOWS: PYTHON_GIL=1 CMAKE_BUILD_TYPE=Release
100112
- name: Upload wheel
101113
uses: actions/upload-artifact@v4
102114
with:

pyproject.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ if.env.COVERAGE = false
123123
inherit.cmake.define = "append"
124124
cmake.define.DISABLE_UNITY = "1"
125125

126+
[[tool.scikit-build.overrides]]
127+
if.platform-system = "^win32"
128+
cmake.args = [
129+
"-G", "Ninja",
130+
"--log-level=DEBUG",
131+
]
132+
126133
[tool.scikit-build.sdist]
127134
include = [
128135
"README.md",
@@ -388,4 +395,5 @@ before-build = ["yum install -y ccache"]
388395
before-build = ["brew install ccache"]
389396

390397
[tool.cibuildwheel.windows]
391-
before-build = ["choco install ccache"]
398+
# Strawberry ccache is already installed on the cibuildwheel images
399+
before-build = []

0 commit comments

Comments
 (0)