From bead3657a9dc7aa61a8363d2dbdec865aa70024c Mon Sep 17 00:00:00 2001 From: Max Bachmann Date: Tue, 17 Dec 2024 13:46:10 +0100 Subject: [PATCH] add emscripten support --- .github/workflows/releasebuild.yml | 35 ++++++++++++++++++++++++++++++ CMakeLists.txt | 5 +++++ 2 files changed, 40 insertions(+) diff --git a/.github/workflows/releasebuild.yml b/.github/workflows/releasebuild.yml index ba75a19f..72973817 100644 --- a/.github/workflows/releasebuild.yml +++ b/.github/workflows/releasebuild.yml @@ -188,6 +188,41 @@ jobs: name: artifact-${{ github.job }}-${{ strategy.job-index }} path: ./wheelhouse/*.whl + build_wheels_pyodide: + name: Build wheels on ubuntu-latest/pyodide + needs: [build_sdist] + runs-on: ubuntu-latest + env: + CIBW_TEST_REQUIRES: pytest hypothesis + CIBW_TEST_COMMAND: pytest {package}/tests + CIBW_PLATFORM: pyodide + CIBW_BUILD_VERBOSITY: 3 + + steps: + - uses: actions/download-artifact@v4 + with: + name: artifact-sdist + path: dist + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Copy wheel + run: cp dist/*.tar.gz rapidfuzz.tar.gz + + - name: Build wheel + uses: pypa/cibuildwheel@v2.22.0 + with: + package-dir: rapidfuzz.tar.gz + output-dir: wheelhouse + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: pyodide-wheel + path: ./wheelhouse/*.whl + deploy-wheels: if: github.event_name == 'release' && github.event.action == 'published' needs: [build_wheels_windows, build_wheels_macos, build_wheels_linux, build_sdist] diff --git a/CMakeLists.txt b/CMakeLists.txt index e8dead28..de2c1c05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,11 @@ else() add_compile_options(-Wall -Wextra -pedantic -Wno-psabi) endif() +if(EMSCRIPTEN) + add_compile_options(-fexceptions) + add_link_options(-fexceptions) +endif() + if(CMAKE_VERSION VERSION_LESS 3.18) find_package( Python