Skip to content

Commit 9eb43ab

Browse files
committed
set building macos universal wheel
1 parent c174cdc commit 9eb43ab

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/wheel.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
strategy:
5252
fail-fast: false
5353
matrix:
54-
os: [ubuntu-latest, macos-latest, windows-2019]
54+
os: [ubuntu-20.04, macos-10.15, windows-2019]
5555
architecture: ['x64']
5656
linux_archs: ["auto s390x"]
5757
include:
@@ -78,6 +78,8 @@ jobs:
7878
CIBW_SKIP: ${{ matrix.skip }}
7979
CIBW_ENVIRONMENT_WINDOWS: ${{ matrix.environment_windows }}
8080
CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }}
81+
CIBW_ARCHS_MACOS: x86_64 universal2
82+
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64"
8183
steps:
8284
- uses: actions/checkout@v2
8385

build_snappy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ case "$(uname -s)" in
1515
# See correspondence table at the bottom of this answer
1616

1717
*)
18-
cmake -S . -B "build"
19-
cmake --build build --config Release --target install
18+
cmake -S . -B "build" -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
19+
cmake --build build --config Release --target install
2020
;;
2121
esac
2222

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@
4242
More details about Snappy library: http://google.github.io/snappy
4343
"""
4444

45+
library_dirs, include_dirs = [], []
46+
if os.environ.get("CIBUILDWHEEL", False) and sys.version_info[:2] == (3, 9) and sys.platform =="darwin":
47+
library_dirs = ["/usr/local/lib/"]
48+
include_dirs = ["/usr/local/include/"]
49+
4550

4651
snappymodule = Extension('snappy._snappy',
4752
libraries=['snappy'],
48-
sources=['src/snappy/snappymodule.cc', 'src/snappy/crc32c.c'])
53+
sources=['src/snappy/snappymodule.cc', 'src/snappy/crc32c.c'],
54+
library_dirs=library_dirs,
55+
include_dirs=include_dirs)
4956

5057
ext_modules = [snappymodule]
5158
packages = ['snappy']

0 commit comments

Comments
 (0)