diff --git a/.github/workflows/build-wheels.yaml b/.github/workflows/build-wheels.yaml new file mode 100644 index 0000000..c3151cd --- /dev/null +++ b/.github/workflows/build-wheels.yaml @@ -0,0 +1,25 @@ +name: Build Wheels +on: [push, pull_request, workflow_dispatch] +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + steps: + - uses: actions/checkout@v4 + - name: Build wheels + uses: pypa/cibuildwheel@v2.22.0 + # env: + # CIBW_SOME_OPTION: value + # ... + # with: + # package-dir: . + # output-dir: wheelhouse + # config-file: "{package}/pyproject.toml" + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl diff --git a/pyproject.toml b/pyproject.toml index 233c8fb..5596427 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,28 @@ [build-system] -requires = [ - "setuptools>=42", - "pybind11>=2.10.0", -] +requires = ["setuptools>=42", "pybind11>=2.10.0"] build-backend = "setuptools.build_meta" + +[tool.cibuildwheel] +build = "cp312-*" +skip = "cp312-musllinux*" + +archs = ["x86_64"] +build-frontend = "build[uv]" + +before-all = "cmake -B build -D CMAKE_INSTALL_PREFIX=install && cmake --build build --config Release && cmake --install build" + +container-engine = "docker" + +manylinux-x86_64-image = "manylinux_2_28" +manylinux-aarch64-image = "manylinux_2_28" + + +[tool.cibuildwheel.linux] +repair-wheel-command = """ + ORIG_PATH=$PATH && \ + ORIG_LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \ + export LD_LIBRARY_PATH=$(pwd)/install/lib:$(pwd)/install/lib64:$(pwd)/lib/onnxruntime-linux-x64-1.14.1/lib:$LD_LIBRARY_PATH && \ + auditwheel repair --plat manylinux_2_28_x86_64 --wheel-dir {dest_dir} {wheel} && \ + export PATH=$ORIG_PATH && \ + export LD_LIBRARY_PATH=$ORIG_LD_LIBRARY_PATH +""" diff --git a/setup.py b/setup.py index 778088c..70e1f22 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ packages=["piper_phonemize"], package_data={ "piper_phonemize": [ - str(p) for p in (_DIR / "piper_phonemize" / "espeak-ng-data").rglob("*") + str(p) for p in (_DIR / "install" / "share" / "espeak-ng-data").rglob("*") ] + [str(_DIR / "libtashkeel_model.ort")] },