Skip to content

Commit

Permalink
Fix Mac OS X ARM64 and AMD64 builds (#62)
Browse files Browse the repository at this point in the history
* Fix Mac OS X ARM64 and AMD64 builds

At least one of these were broken, based on which architecure of Judy
was being used.
Fix the build by always building Judy and fetching the relevant
architecure flags from the environment.

* Bump to macos-14
  • Loading branch information
nils-dohop authored Nov 4, 2024
1 parent a6c3c7a commit 4af10ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, ubuntu-latest]
os: [macos-14, ubuntu-latest]
python-version: ['3.12']

steps:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test-skip = [
]

[tool.cibuildwheel.macos]
archs = ["x86_64", "universal2", "arm64"]
archs = ["x86_64", "arm64"]
environment = "CC=clang"

[[tool.cibuildwheel.overrides]]
Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def build_judy() -> None:
print('INFO: building judy static library...')

CC = os.environ.get('CC', 'clang')
ARCH_FLAGS = os.environ.get('ARCHFLAGS', '')

is_clang = False
is_gcc_46 = False
Expand All @@ -32,7 +33,7 @@ def build_judy() -> None:
assert sys.maxsize == (2**63 - 1)

if is_clang or is_gcc_46:
CFLAGS = '-DJU_64BIT -O0 -fPIC -fno-strict-aliasing -Wall -D_REENTRANT -D_GNU_SOURCE -g'
CFLAGS = '-DJU_64BIT -O0 -fPIC -fno-strict-aliasing -Wall -D_REENTRANT -D_GNU_SOURCE -g ' + ARCH_FLAGS
else:
CFLAGS = '-DJU_64BIT -O0 -fPIC -fno-strict-aliasing -fno-aggressive-loop-optimizations'

Expand All @@ -43,9 +44,7 @@ def build_judy() -> None:

print(output)


if not os.path.isfile('./judy-1.0.5/src/libJudy.a'):
build_judy()
build_judy()


setup(
Expand Down

0 comments on commit 4af10ff

Please sign in to comment.