Skip to content

Commit 1c69370

Browse files
authored
Add initial attempt to build cppyy on Windows
1 parent 29f2920 commit 1c69370

File tree

3 files changed

+119
-8
lines changed

3 files changed

+119
-8
lines changed

.github/actions/Build_and_Test_cppyy/action.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,96 @@ runs:
135135
tail -n1 test_xfailed.log
136136
echo "Return Code: ${RETCODE}"
137137
exit $RETCODE
138+
139+
- name: Build and Install cppyy-backend
140+
if: ${{ matrix.cppyy == 'On' && runner.os == 'Windows' }}
141+
shell: powershell
142+
run: |
143+
# Download cppyy-backend
144+
git clone --depth=1 https://github.com/compiler-research/cppyy-backend.git
145+
cd cppyy-backend
146+
mkdir -p $env:CPPINTEROP_DIR\lib build && cd build
147+
# Install CppInterOp
148+
(cd $env:CPPINTEROP_BUILD_DIR && cmake --build . --target install --parallel ${{ env.ncpus }} )
149+
# Build and Install cppyy-backend
150+
cmake -DCppInterOp_DIR=$env:CPPINTEROP_DIR ..
151+
cmake --build . --parallel ${{ env.ncpus }}
152+
cp libcppyy-backend.dll $CPPINTEROP_DIR\lib\
153+
cd ..
154+
155+
- name: Install CPyCppyy
156+
if: ${{ matrix.cppyy == 'On' && runner.os == 'Windows' }}
157+
shell: powershell
158+
run: |
159+
python -m venv .venv
160+
. .\.venv\Scripts\Activate.ps1
161+
# Install CPyCppyy
162+
git clone --depth=1 https://github.com/compiler-research/CPyCppyy.git
163+
mkdir CPyCppyy\build
164+
cd CPyCppyy\build
165+
cmake ..
166+
cmake --build . --parallel ${{ env.ncpus }}
167+
#
168+
env:CPYCPPYY_DIR = $PWD.Path
169+
cd ../..
170+
# We need CPYCPPYY_DIR later
171+
echo "CPYCPPYY_DIR=$env:CPYCPPYY_DIR" >> $env:GITHUB_ENV
172+
173+
- name: Install cppyy
174+
if: ${{ matrix.cppyy == 'On' && runner.os == 'Windows' }}
175+
shell: powershell
176+
run: |
177+
# source virtual environment
178+
. .\.venv\Scripts\Activate.ps1
179+
# Install cppyy
180+
git clone --depth=1 https://github.com/compiler-research/cppyy.git
181+
cd cppyy
182+
python -m pip install --upgrade . --no-deps
183+
cd ..
184+
185+
- name: Run cppyy
186+
if: ${{ matrix.cppyy == 'On' && runner.os == 'Windows' }}
187+
shell: powershell
188+
run: |
189+
# Run cppyy
190+
. .\.venv\Scripts\Activate.ps1
191+
$env:PYTHONPATH=$env:PYTHONPATH:$env:CPYCPPYY_DIR:$env:CB_PYTHON_DIR
192+
python -c "import cppyy"
193+
# We need PYTHONPATH later
194+
echo "PYTHONPATH=$env:PYTHONPATH" >> $GITHUB_ENV
195+
196+
- name: Run the tests
197+
if: ${{ matrix.cppyy == 'On' && runner.os == 'Windows' }}
198+
shell: powershell
199+
run: |
200+
# Run the tests
201+
. .\.venv\Scripts\Activate.ps1
202+
cd cppyy\test
203+
echo ::group::Prepare For Testing
204+
make all
205+
python -m pip install --upgrade pip
206+
python -m pip install pytest
207+
python -m pip install pytest-xdist
208+
python -m pip install numba
209+
echo ::endgroup::
210+
echo ::group::Run complete test suite
211+
$ErrorActionPreference = "Stop"
212+
python -m pytest -sv -ra 2>&1 | Tee-Object -FilePath complete_testrun.log
213+
$ErrorActionPreference = "Continue"
214+
echo ::group::Crashing Test Logs
215+
# See if we don't have a crash that went away
216+
# Comment out all xfails but the ones that have a run=False condition.
217+
find.exe . -name "*.py" -exec sed.exe -i '/run=False/!s/^ *@mark.xfail\(.*\)/#&/' {} \;
218+
python -m pytest -n 1 -m "xfail" --runxfail -sv -ra --max-worker-restart 512 2>&1 | Tee-Object -FilePath test_crashed.log
219+
$LASTEXITCODE = 0
220+
git checkout .
221+
echo ::endgroup::
222+
echo ::group::XFAIL Test Logs
223+
# Rewrite all xfails that have a run clause to skipif. This way we will
224+
# avoid conditionally crashing xfails
225+
find.exe . -name "*.py" -exec sed.exe -i -E 's/(^ *)@mark.xfail\(run=(.*)/\1@mark.skipif(condition=not \2/g' {} \;
226+
# See if we don't have an xfail that went away
227+
python -m pytest --runxfail -sv -ra | tee test_xfailed.log 2>&1 || true
228+
git checkout .
229+
echo ::endgroup::
230+
echo ::group::Passing Test Logs

.github/workflows/Windows-arm.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,19 @@ jobs:
233233
fail-fast: false
234234
matrix:
235235
include:
236-
- name: win11-msvc-clang-repl-20
236+
- name: win11-msvc-clang-repl-20-cppyy
237237
os: windows-11-arm
238238
compiler: msvc
239239
clang-runtime: '20'
240240
cling: Off
241-
cppyy: Off
242-
- name: win11-msvc-clang18-cling
241+
cppyy: On
242+
- name: win11-msvc-clang18-cling-cppyy
243243
os: windows-11-arm
244244
compiler: msvc
245245
clang-runtime: '18'
246246
cling: On
247247
cling-version: '1.2'
248-
cppyy: Off
248+
cppyy: On
249249

250250
steps:
251251
- uses: actions/checkout@v4
@@ -291,6 +291,13 @@ jobs:
291291
$env:ncpus=$([Environment]::ProcessorCount)
292292
echo "ncpus=$env:ncpus" >> $env:GITHUB_ENV
293293
294+
- name: Install deps on Windows
295+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
296+
run: |
297+
choco install findutils
298+
choco install gnuwin32-coreutils.install
299+
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"
300+
294301
- name: Setup compiler on Windows
295302
run: |
296303
if ( "${{ matrix.compiler }}" -imatch "clang" )
@@ -324,6 +331,8 @@ jobs:
324331

325332
- uses: ./.github/actions/Build_and_Test_CppInterOp
326333

334+
- uses: ./.github/actions/Build_and_Test_cppyy
335+
327336
- name: Setup tmate session
328337
if: ${{ failure() && runner.debug }}
329338
uses: mxschmitt/action-tmate@v3

.github/workflows/Windows.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,19 @@ jobs:
233233
fail-fast: false
234234
matrix:
235235
include:
236-
- name: win2025-msvc-clang-repl-20
236+
- name: win2025-msvc-clang-repl-20-cppyy
237237
os: windows-2025
238238
compiler: msvc
239239
clang-runtime: '20'
240240
cling: Off
241-
cppyy: Off
242-
- name: win2025-msvc-clang18-cling
241+
cppyy: On
242+
- name: win2025-msvc-clang18-cling-cppyy
243243
os: windows-2025
244244
compiler: msvc
245245
clang-runtime: '18'
246246
cling: On
247247
cling-version: '1.2'
248-
cppyy: Off
248+
cppyy: On
249249

250250
steps:
251251
- uses: actions/checkout@v4
@@ -291,6 +291,13 @@ jobs:
291291
$env:ncpus=$([Environment]::ProcessorCount)
292292
echo "ncpus=$env:ncpus" >> $env:GITHUB_ENV
293293
294+
- name: Install deps on Windows
295+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
296+
run: |
297+
choco install findutils
298+
choco install gnuwin32-coreutils.install
299+
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"
300+
294301
- name: Setup compiler on Windows
295302
run: |
296303
if ( "${{ matrix.compiler }}" -imatch "clang" )
@@ -324,6 +331,8 @@ jobs:
324331

325332
- uses: ./.github/actions/Build_and_Test_CppInterOp
326333

334+
- uses: ./.github/actions/Build_and_Test_cppyy
335+
327336
- name: Setup tmate session
328337
if: ${{ failure() && runner.debug }}
329338
uses: mxschmitt/action-tmate@v3

0 commit comments

Comments
 (0)