Skip to content

Commit 4200601

Browse files
committed
Manually copy the DLL to the wheel's root
1 parent 2404ea6 commit 4200601

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.github/workflows/python-wheels.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,21 @@ jobs:
210210
echo
211211
done
212212
213+
- name: Copy DLL to package directory (Windows)
214+
if: runner.os == 'Windows'
215+
shell: bash
216+
run: |
217+
# Copy the DLL to the package directory so maturin can include it in the wheel
218+
# The maturin.include in pyproject.toml expects it relative to the package root
219+
if [ -f "$TKET_C_API_PATH/bin/tket-c-api.dll" ]; then
220+
cp "$TKET_C_API_PATH/bin/tket-c-api.dll" "$MODULE_DIR/tket-c-api.dll"
221+
echo "Copied DLL to $MODULE_DIR/tket-c-api.dll"
222+
ls -lh "$MODULE_DIR/tket-c-api.dll"
223+
else
224+
echo "ERROR: DLL not found at $TKET_C_API_PATH/bin/tket-c-api.dll"
225+
exit 1
226+
fi
227+
213228
- name: Build wheels
214229
shell: bash
215230
run: |

tket-py/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ module-name = "tket._tket"
6161
manifest-path = "Cargo.toml"
6262
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
6363
features = ["pyo3/extension-module"]
64+
include = [
65+
# In windows targets, we need to explicitly include the DLL file if we want
66+
# the wheel to be portable.
67+
#
68+
# This gets ignored when building for non-windows targets.
69+
"tket-c-api.dll",
70+
]
6471

6572
[tool.pytest.ini_options]
6673
# Lark throws deprecation warnings for `src_parse` and `src_constants`.

0 commit comments

Comments
 (0)