Skip to content

Commit 080f567

Browse files
linesightclaude
andcommitted
Migrate build system to scikit-build-core + CMake
Replaces the old setup.py / build_cefpython.py toolchain with a modern scikit-build-core backend driven by CMake, enabling clean incremental dev builds, a structured CI pipeline (compile → test → wheel), and optional Cython profiling/line-tracing flags. Key changes: - CMakeLists.txt (root + per-subdir): full CMake build for the extension module, subprocess executable, client_handler and cpp_utils static libs; auto-detects CEF root; installs CEF runtime files via cmake --install - pyproject.toml: scikit-build-core build backend, Cython >=3.2 dependency - tools/cmake_generate_pxi.py: generates platform .pxi files at configure time - tools/cmake_prepare_pyx.py: stages .pyx files and injects version constants - tools/cmake_fix_header.py: patches Cython-generated header for MSVC compat - tools/build.py: unified dev/CI entry point; --clean for full rebuild, --wheel for pip wheel, --enable-profiling / --enable-line-tracing for Cython instrumentation - .github/workflows/ci-windows.yml: split into compile / test / wheel jobs with artifact hand-off; supports Python 3.10–3.14 - .gitignore: add _cmake_test/, _skbuild/ Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7191270 commit 080f567

15 files changed

Lines changed: 1025 additions & 876 deletions

.github/workflows/ci-windows.yml

Lines changed: 127 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI Windows
22

33
on:
44
push:
5-
branches: [ "github-actions-ci", "master" ]
5+
branches: [ "github-actions-ci", "master", "scikit-build-core" ]
66
pull_request:
77
branches: [ "master" ]
88
workflow_dispatch:
@@ -13,7 +13,7 @@ on:
1313
default: false
1414

1515
jobs:
16-
build-and-test:
16+
compile:
1717
runs-on: windows-latest
1818
timeout-minutes: 60
1919
strategy:
@@ -30,8 +30,65 @@ jobs:
3030
with:
3131
python-version: ${{ matrix.python-version }}
3232

33-
- name: Install Python dependencies
34-
run: pip install -r tools/requirements.txt
33+
- name: Read CEF version
34+
id: cef-version
35+
run: |
36+
$ver = (Select-String -Path src/version/cef_version_win.h `
37+
-Pattern '#define CEF_VERSION "([^"]+)"').Matches[0].Groups[1].Value
38+
echo "value=$ver" >> $env:GITHUB_OUTPUT
39+
40+
- name: Cache CEF binaries
41+
uses: actions/cache@v4
42+
if: ${{ inputs.bypass_cache != true }}
43+
with:
44+
path: build/cef_binary_*
45+
key: cef-windows64-${{ steps.cef-version.outputs.value }}
46+
47+
- name: Download CEF binaries
48+
run: python tools/download_cef.py
49+
50+
- name: Prepare prebuilt CEF
51+
run: python tools/automate.py --prebuilt-cef
52+
53+
- name: Install build tools
54+
run: python tools/requirements.py
55+
56+
- name: Configure CMake
57+
run: cmake -S . -B build/_cmake_build -A x64
58+
59+
- name: Build
60+
run: cmake --build build/_cmake_build --config Release --parallel
61+
62+
- name: Stage build outputs
63+
run: |
64+
New-Item -ItemType Directory -Force build/artifacts
65+
Copy-Item build/_cmake_build/Release/cefpython_py*.pyd build/artifacts/
66+
Copy-Item build/_cmake_build/subprocess_build/Release/subprocess.exe build/artifacts/
67+
68+
- name: Upload build artifacts
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: build-py${{ matrix.python-version }}-win64
72+
path: build/artifacts/
73+
retention-days: 1
74+
75+
test:
76+
needs: compile
77+
runs-on: windows-latest
78+
timeout-minutes: 30
79+
strategy:
80+
fail-fast: false
81+
matrix:
82+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
83+
84+
steps:
85+
- name: Checkout
86+
uses: actions/checkout@v4
87+
88+
- name: Set up Python
89+
uses: actions/setup-python@v5
90+
with:
91+
python-version: ${{ matrix.python-version }}
3592

3693
- name: Read CEF version
3794
id: cef-version
@@ -53,5 +110,69 @@ jobs:
53110
- name: Prepare prebuilt CEF
54111
run: python tools/automate.py --prebuilt-cef
55112

56-
- name: Build and run unit tests
57-
run: python tools/build.py --unittests
113+
- name: Download build artifacts
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: build-py${{ matrix.python-version }}-win64
117+
path: build/artifacts/
118+
119+
- name: Set up cefpython3 package for testing
120+
run: |
121+
Copy-Item build/artifacts/cefpython_py*.pyd cefpython3/
122+
Copy-Item build/artifacts/subprocess.exe cefpython3/
123+
$cefBin = (Get-ChildItem build/cef*_win64 -Directory | Select-Object -First 1).FullName + "/bin"
124+
Get-ChildItem $cefBin | Where-Object { $_.Name -notmatch '^(cefclient|cefsimple|ceftests)' } |
125+
ForEach-Object { Copy-Item $_.FullName cefpython3/ -Recurse -Force }
126+
127+
- name: Run unit tests
128+
run: python unittests/_test_runner.py
129+
130+
wheel:
131+
needs: test
132+
runs-on: windows-latest
133+
timeout-minutes: 60
134+
strategy:
135+
fail-fast: false
136+
matrix:
137+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
138+
139+
steps:
140+
- name: Checkout
141+
uses: actions/checkout@v4
142+
143+
- name: Set up Python
144+
uses: actions/setup-python@v5
145+
with:
146+
python-version: ${{ matrix.python-version }}
147+
148+
- name: Read CEF version
149+
id: cef-version
150+
run: |
151+
$ver = (Select-String -Path src/version/cef_version_win.h `
152+
-Pattern '#define CEF_VERSION "([^"]+)"').Matches[0].Groups[1].Value
153+
echo "value=$ver" >> $env:GITHUB_OUTPUT
154+
155+
- name: Cache CEF binaries
156+
uses: actions/cache@v4
157+
if: ${{ inputs.bypass_cache != true }}
158+
with:
159+
path: build/cef_binary_*
160+
key: cef-windows64-${{ steps.cef-version.outputs.value }}
161+
162+
- name: Download CEF binaries
163+
run: python tools/download_cef.py
164+
165+
- name: Prepare prebuilt CEF
166+
run: python tools/automate.py --prebuilt-cef
167+
168+
- name: Install build tools
169+
run: python tools/requirements.py
170+
171+
- name: Build wheel
172+
run: pip wheel --no-build-isolation -w build/dist .
173+
174+
- name: Upload wheel artifact
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: cefpython3-py${{ matrix.python-version }}-win64
178+
path: build/dist/*.whl

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.idea/
22
build/
33
dist/
4+
_cmake_test/
5+
_skbuild/
46
venv/
57
*.log
68
__pycache__/

0 commit comments

Comments
 (0)