Skip to content

Commit

Permalink
Make manylinux wheel available (#3)
Browse files Browse the repository at this point in the history
* fix windows wheels

* whole brotlidec
  • Loading branch information
Isotr0py authored Oct 2, 2023
1 parent 8f727e2 commit 3a4280c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ jobs:
with:
python-version: '3.10'

- name: Install dependencys
run: |
sudo apt --fix-broken install
sudo apt update
sudo apt install cmake clang doxygen g++ extra-cmake-modules libgif-dev libjpeg-dev ninja-build libgoogle-perftools-dev libunwind-dev
- name: Build and install libjxl
run: |
git clone https://github.com/libjxl/libjxl.git --recursive --shallow-submodules
cd libjxl
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ..
cmake --build . -- -j$(nproc)
sudo cmake --install .
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand All @@ -58,8 +43,15 @@ jobs:
docker-options: |
-e RUST_BACKTRACE=1
-e DEP_JXL_LIB=${{ github.workspace }}/libjxl/build/lib
# before-script-linux: |
# yum install -y cmake clang doxygen extra-cmake-modules ninja-build
before-script-linux: |
yum install -y epel-release
yum install -y cmake clang doxygen gcc-c++ extra-cmake-modules ninja-build
git clone --recurse-submodules --depth 1 -b v0.8.2 https://github.com/libjxl/libjxl.git
cd libjxl
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
cmake --build build
cmake --install build
cd ..
- name: Upload wheels
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -97,8 +89,13 @@ jobs:
with:
rust-toolchain: stable-x86_64-pc-windows-gnu
target: x86_64-pc-windows-gnu
args: --release --out dist --find-interpreter --all-features -- -L gcc -L stdc++ -L pthread
args: --release --out wheels --find-interpreter --all-features
sccache: 'true'

- name: Fix wheels with delvewheel
run: |
pip install delvewheel
Get-ChildItem ${{ github.workspace }}/wheels/*win_amd64.whl | ForEach-Object -Process {delvewheel repair $PSItem -w dist}
- name: Upload wheels
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "pillow-jxl-plugin"
version = "0.1.0"
edition = "2021"
build = "build.rs"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
Expand Down
22 changes: 22 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use std::env;

fn main() {
#[cfg(not(feature = "vendored"))]
{
println!("cargo:rustc-link-lib=static=jxl");
println!("cargo:rustc-link-lib=static=jxl_threads");

println!("cargo:rustc-link-lib=static=hwy");
if let Ok(path) = env::var("DEP_HWY_LIB") {
println!("cargo:rustc-link-search=native={}", path);
}

println!("cargo:rustc-link-lib=static:+whole-archive=brotlidec-static");
println!("cargo:rustc-link-lib=static=brotlienc-static");
println!("cargo:rustc-link-lib=static=brotlicommon-static");
if let Ok(path) = env::var("DEP_BROTLI_LIB") {
println!("cargo:rustc-link-search=native={}", path);
}
}
println!("cargo:rustc-link-lib=stdc++");
}

0 comments on commit 3a4280c

Please sign in to comment.