Skip to content

Commit b350bba

Browse files
authored
Merge pull request #18 from ravenexp/dll-tool-type
Refactor and add `zig dlltool` support
2 parents d3794f5 + 0a42851 commit b350bba

File tree

4 files changed

+323
-131
lines changed

4 files changed

+323
-131
lines changed

.github/workflows/rust.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,33 @@ jobs:
2222
- uses: actions/checkout@v3
2323
- name: Install the MinGW and LLVM toolchains
2424
if: matrix.os == 'ubuntu-latest'
25-
run: sudo apt-get install -y mingw-w64 llvm
25+
run: sudo apt-get install -y gcc-mingw-w64 llvm
2626
- name: Build
2727
run: cargo build --verbose
2828
- name: Run tests
29-
run: cargo test --verbose
29+
run: cargo test --verbose -- --test-threads=1
30+
zigbuild:
31+
name: Test zig dlltool
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v3
35+
- uses: goto-bus-stop/setup-zig@v1
36+
with:
37+
version: 0.9.1
38+
- name: Run tests with zig
39+
run: ZIG_COMMAND=zig cargo test --verbose
40+
zigwheel:
41+
name: Test python -m ziglang dlltool
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v3
45+
- uses: actions/setup-python@v2
46+
with:
47+
python-version: "3.10"
48+
- name: Install ziglang package
49+
run: pip install ziglang
50+
- name: Run tests with python -m ziglang
51+
run: ZIG_COMMAND="python -m ziglang" cargo test --verbose
3052
fmt:
3153
name: Check code formatting
3254
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Unreleased
6+
7+
### Features
8+
9+
- Add `zig dlltool` support in [#18](https://github.com/pyo3/python3-dll-a/pull/18)
10+
11+
### Fixes
12+
13+
- Improve error message when `dlltool` is not found in [#17](https://github.com/pyo3/python3-dll-a/pull/17)
14+
515
## [0.2.2] - 2022-05-10
616

717
### Features

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ Generates import libraries for the Python DLL
55
(either `python3.dll` or `python3y.dll`)
66
for MinGW-w64 and MSVC (cross-)compile targets.
77

8-
See <https://docs.python.org/3/c-api/stable.html> for the Stable ABI details.
9-
108
This crate **does not require** Python 3 distribution files
119
to be present on the (cross-)compile host system.
1210

13-
**Note:** MSVC cross-compile targets require LLVM binutils
14-
to be available on the host system.
11+
**Note:** MSVC cross-compile targets require either LLVM binutils
12+
or Zig to be available on the host system.
1513
More specifically, `python3-dll-a` requires `llvm-dlltool` executable
1614
to be present in `PATH` when targeting `*-pc-windows-msvc` from Linux.
1715

16+
Alternatively, `ZIG_COMMAND` environment variable may be set to e.g. "zig"
17+
or "python -m ziglang", then `zig dlltool` will be used in place
18+
of `llvm-dlltool` (or MinGW binutils).
19+
1820
PyO3 integration
1921
----------------
2022

@@ -42,7 +44,7 @@ from the crate build script.
4244

4345
The examples below assume using an older version of PyO3.
4446

45-
### Example `build.rs` script
47+
### Example `build.rs` script for an `abi3` PyO3 extension
4648

4749
The following cargo build script can be used to cross-compile Stable ABI
4850
PyO3 extension modules for Windows (64/32-bit x86 or 64-bit ARM)
@@ -73,6 +75,14 @@ pointed by the `PYO3_CROSS_LIB_DIR` environment variable.
7375
PYO3_CROSS_LIB_DIR=target/python3-dll cargo build --target x86_64-pc-windows-gnu
7476
```
7577

78+
Generating version-specific `python3y.dll` import libraries
79+
-----------------------------------------------------------
80+
81+
As an advanced feature, `python3-dll-a` can generate Python version
82+
specific import libraries such as `python39.lib`.
83+
84+
See the `ImportLibraryGenerator` builder API description for details.
85+
7686
Maintenance
7787
-----------
7888

0 commit comments

Comments
 (0)