Skip to content

Commit 20ac9af

Browse files
committed
Add initial attempt to build cppyy on Windows
1 parent dd50000 commit 20ac9af

File tree

4 files changed

+130
-16
lines changed

4 files changed

+130
-16
lines changed

.github/actions/Build_and_Test_CppInterOp/action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ runs:
9191
echo "CLING_BUILD_DIR=$env:CLING_BUILD_DIR"
9292
echo "CLING_BUILD_DIR=$env:CLING_BUILD_DIR" >> $env:GITHUB_ENV
9393
94-
$env:CPLUS_INCLUDE_PATH="$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;"
95-
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH"
96-
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH" >> $env:GITHUB_ENV
94+
$env:IncludePath="$env:IncludePath;$env:CLING_DIR\tools\cling\include;$env:CLING_BUILD_DIR\include;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;"
95+
echo "IncludePath=$env:IncludePath"
96+
echo "IncludePath=$env:IncludePath" >> $env:GITHUB_ENV
9797
}
9898
else
9999
{
100-
$env:CPLUS_INCLUDE_PATH="$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;"
101-
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH"
102-
echo "CPLUS_INCLUDE_PATH=$env:CPLUS_INCLUDE_PATH" >> $env:GITHUB_ENV
100+
$env:IncludePath="$env:IncludePath;$env:LLVM_DIR\llvm\include;$env:LLVM_DIR\clang\include;$env:LLVM_BUILD_DIR\include;$env:LLVM_BUILD_DIR\tools\clang\include;$env:PWD_DIR\include;"
101+
echo "IncludePath=$env:IncludePath"
102+
echo "IncludePath=$env:IncludePath" >> $env:GITHUB_ENV
103103
}
104104
105105
$env:CB_PYTHON_DIR="$env:PWD_DIR\cppyy-backend\python"
@@ -113,7 +113,7 @@ runs:
113113
# Build CppInterOp next to cling and llvm-project.
114114
mkdir build
115115
cd build
116-
$env:CPPINTEROP_BUILD_DIR="$env:PWD_DIR"
116+
$env:CPPINTEROP_BUILD_DIR=$PWD.Path
117117
echo "CPPINTEROP_BUILD_DIR=$env:CPPINTEROP_BUILD_DIR"
118118
echo "CPPINTEROP_BUILD_DIR=$env:CPPINTEROP_BUILD_DIR" >> $env:GITHUB_ENV
119119
if ( "${{ matrix.cling }}" -imatch "On" )

.github/actions/Build_and_Test_cppyy/action.yml

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

.github/workflows/Windows-arm.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,19 @@ jobs:
142142
fail-fast: false
143143
matrix:
144144
include:
145-
- name: win11-msvc-clang-repl-20
145+
- name: win11-msvc-clang-repl-20-cppyy
146146
os: windows-11-arm
147147
compiler: msvc
148148
clang-runtime: '20'
149149
cling: Off
150-
cppyy: Off
151-
- name: win11-msvc-clang18-cling
150+
cppyy: On
151+
- name: win11-msvc-clang18-cling-cppyy
152152
os: windows-11-arm
153153
compiler: msvc
154154
clang-runtime: '18'
155155
cling: On
156156
cling-version: '1.2'
157-
cppyy: Off
157+
cppyy: On
158158

159159
steps:
160160
- uses: actions/checkout@v4
@@ -200,6 +200,13 @@ jobs:
200200
$env:ncpus=$([Environment]::ProcessorCount)
201201
echo "ncpus=$env:ncpus" >> $env:GITHUB_ENV
202202
203+
- name: Install deps on Windows
204+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
205+
run: |
206+
choco install findutils
207+
choco install gnuwin32-coreutils.install
208+
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"
209+
203210
- name: Setup compiler on Windows
204211
run: |
205212
if ( "${{ matrix.compiler }}" -imatch "clang" )
@@ -233,6 +240,8 @@ jobs:
233240

234241
- uses: ./.github/actions/Build_and_Test_CppInterOp
235242

243+
- uses: ./.github/actions/Build_and_Test_cppyy
244+
236245
- name: Setup tmate session
237246
if: ${{ failure() && runner.debug }}
238247
uses: mxschmitt/action-tmate@v3

.github/workflows/Windows.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,19 @@ jobs:
142142
fail-fast: false
143143
matrix:
144144
include:
145-
- name: win2025-msvc-clang-repl-20
145+
- name: win2025-msvc-clang-repl-20-cppyy
146146
os: windows-2025
147147
compiler: msvc
148148
clang-runtime: '20'
149149
cling: Off
150-
cppyy: Off
151-
- name: win2025-msvc-clang18-cling
150+
cppyy: On
151+
- name: win2025-msvc-clang18-cling-cppyy
152152
os: windows-2025
153153
compiler: msvc
154154
clang-runtime: '18'
155155
cling: On
156156
cling-version: '1.2'
157-
cppyy: Off
157+
cppyy: On
158158

159159
steps:
160160
- uses: actions/checkout@v4
@@ -200,6 +200,13 @@ jobs:
200200
$env:ncpus=$([Environment]::ProcessorCount)
201201
echo "ncpus=$env:ncpus" >> $env:GITHUB_ENV
202202
203+
- name: Install deps on Windows
204+
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
205+
run: |
206+
choco install findutils
207+
choco install gnuwin32-coreutils.install
208+
$env:PATH="C:\Program Files (x86)\GnuWin32\bin;$env:PATH"
209+
203210
- name: Setup compiler on Windows
204211
run: |
205212
if ( "${{ matrix.compiler }}" -imatch "clang" )
@@ -233,6 +240,8 @@ jobs:
233240

234241
- uses: ./.github/actions/Build_and_Test_CppInterOp
235242

243+
- uses: ./.github/actions/Build_and_Test_cppyy
244+
236245
- name: Setup tmate session
237246
if: ${{ failure() && runner.debug }}
238247
uses: mxschmitt/action-tmate@v3

0 commit comments

Comments
 (0)