From c7763d75b8e36d0df0a0522e32dc7b34e5e51f4a Mon Sep 17 00:00:00 2001 From: Mikkel Wienberg Madsen Date: Thu, 18 Apr 2024 13:53:02 +0200 Subject: [PATCH] Add Windows and macOS support --- .github/workflows/pyo3.yml | 58 +++++++++++++++++++++++++++++++++++++- pycare/Cargo.lock | 10 +++++++ pycare/Cargo.toml | 2 +- 3 files changed, 68 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pyo3.yml b/.github/workflows/pyo3.yml index a5dec23..8762216 100644 --- a/.github/workflows/pyo3.yml +++ b/.github/workflows/pyo3.yml @@ -35,7 +35,7 @@ jobs: uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} - args: --release --out dist --find-interpreter --zig + args: --release --out dist --zig sccache: 'true' container: 'off' working-directory: pycare @@ -44,3 +44,59 @@ jobs: with: name: wheels path: pycare/dist + + windows: + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install C compiler + run: sudo apt-get update && sudo apt-get install -y build-essential + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install Zigbuild + run: pip install cargo-zigbuild + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: x86_64-pc-windows-msvc + args: --release --out dist --zig + sccache: 'true' + container: 'off' + working-directory: pycare + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: pycare/dist + + macos: + runs-on: self-hosted + strategy: + matrix: + target: [x86_64-apple-darwin, aarch64-apple-darwin] + steps: + - uses: actions/checkout@v3 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Install C compiler + run: sudo apt-get update && sudo apt-get install -y build-essential + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install Zigbuild + run: pip install cargo-zigbuild + - name: Build wheels + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --zig + sccache: 'true' + container: 'off' + working-directory: pycare + - name: Upload wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: pycare/dist + diff --git a/pycare/Cargo.lock b/pycare/Cargo.lock index c8d999f..fc576bb 100644 --- a/pycare/Cargo.lock +++ b/pycare/Cargo.lock @@ -783,6 +783,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7883df5835fafdad87c0d888b266c8ec0f4c9ca48a5bed6bbb592e8dedee1b50" dependencies = [ "once_cell", + "python3-dll-a", "target-lexicon", ] @@ -821,6 +822,15 @@ dependencies = [ "syn 2.0.59", ] +[[package]] +name = "python3-dll-a" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f07cd4412be8fa09a721d40007c483981bbe072cd6a21f2e83e04ec8f8343f" +dependencies = [ + "cc", +] + [[package]] name = "quote" version = "1.0.36" diff --git a/pycare/Cargo.toml b/pycare/Cargo.toml index 7248649..aec93a3 100644 --- a/pycare/Cargo.toml +++ b/pycare/Cargo.toml @@ -9,5 +9,5 @@ name = "caring" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.21", features = ["abi3-py37"]} +pyo3 = { version = "0.21", features = ["abi3-py37", "generate-import-lib"]} wecare = { path = "../wecare" }