From 73ddb8145a78a9b9bd8bca3cb68158cb60affc0e Mon Sep 17 00:00:00 2001 From: Alena Chaikouskaya Date: Wed, 1 Nov 2023 18:09:58 +0100 Subject: [PATCH] Build MacOS ARM wheels Note that we have to copy lots of code because it seems like toml files do now allow to share flow any other way. --- .github/workflows/wheels.yaml | 5 ++- README.md | 16 ++++----- python/pyproject.toml | 63 +++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index 05b01e94a..30ad81efa 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -32,6 +32,8 @@ jobs: arch: i686 - os: macos-11 arch: x86_64 + - os: macos-13-xlarge + arch: arm64 steps: - name: Disable autocrlf @@ -65,7 +67,8 @@ jobs: CIBW_ARCHS: ${{ matrix.arch }} # musllinux arch skip: unlikely someone wants to run dlisio on alpine on non-standard architecture # musllinux cp37 and cp38 skip: latest available numpy doesn't provide musslinux wheels, so it is unlikely useful - CIBW_SKIP: pp* *-musllinux_i686 *-musllinux_aarch64 cp37*-musllinux* cp38*-musllinux* cp36-* + # macosx 38 skip: cibuildwheel can't test it + CIBW_SKIP: pp* *-musllinux_i686 *-musllinux_aarch64 cp37*-musllinux* cp38*-musllinux* cp38*-macosx_*:arm64 cp36-* run: | python -m cibuildwheel --output-dir wheelhouse python/ diff --git a/README.md b/README.md index 164e07731..05da7cac6 100644 --- a/README.md +++ b/README.md @@ -47,14 +47,14 @@ pip install dlisio ``` -| | macOS Intel | Windows 64bit | Windows 32bit | manylinux x86_64 | manylinux aarch64 | manylinux i686 | musllinux x86_64 -|---------------|----|-----|-----|----|----|----|----| -| CPython 3.7 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - | -| CPython 3.8 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | - | -| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| CPython 3.11 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| CPython 3.12 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| | macOS Intel | macOS ARM | Windows 64bit | Windows 32bit | manylinux x86_64 | manylinux aarch64 | manylinux i686 | musllinux x86_64 +|---------------|----|-----|-----|----|----|----|----|----| +| CPython 3.7 | ✅ | - | ✅ | ✅ | ✅ | ✅ | ✅ | - | +| CPython 3.8 | ✅ | - | ✅ | ✅ | ✅ | ✅ | ✅ | - | +| CPython 3.9 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.10 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.11 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | +| CPython 3.12 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | See [Build dlisio](#Build-dlisio) for building dlisio from source. diff --git a/python/pyproject.toml b/python/pyproject.toml index 2c647dbcb..2f6bc6795 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -114,3 +114,66 @@ before-build= [ [tool.cibuildwheel.macos] environment = { CXXFLAGS="-L/usr/local/lib" } + +before-all = [ + """curl \ + -L https://github.com/fmtlib/fmt/archive/refs/tags/7.1.3.tar.gz \ + -o fmt-7.1.3.tar.gz \ + """, + "tar xf fmt-7.1.3.tar.gz", + """cmake \ + -S fmt-7.1.3 \ + -B fmt-7.1.3/build \ + -DFMT_TEST=OFF \ + -DFMT_DOC=OFF \ + """, + """sudo cmake \ + --build fmt-7.1.3/build \ + --target install \ + --config Release \ + """, + """git clone https://github.com/equinor/layered-file-protocols.git""", + """cmake \ + -S layered-file-protocols \ + -B layered-file-protocols/build \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DLFP_FMT_HEADER_ONLY=ON \ + -DBUILD_TESTING=OFF \ + """, + """sudo cmake \ + --build layered-file-protocols/build \ + --target install \ + --config Release \ + """, + """curl \ + -L https://github.com/mpark/variant/archive/refs/tags/v1.4.0.tar.gz \ + -o variant-1.4.0.tar.gz \ + """, + "tar xf variant-1.4.0.tar.gz", + """cmake \ + -S variant-1.4.0 \ + -B variant-1.4.0/build \ + """, + """sudo cmake \ + --build variant-1.4.0/build \ + --target install \ + --config Release \ + """, +] + +before-build = [ + """cmake \ + -S . \ + -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DBUILD_TESTING=OFF \ + -DBUILD_PYTHON=OFF \ + """, + """sudo cmake \ + --build build \ + --parallel \ + --target install \ + --config Release \ + """, +]