Skip to content

Commit

Permalink
Fix dylib in macOS wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
Twixes committed Oct 6, 2023
1 parent bbbac45 commit 19ce931
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 0 additions & 1 deletion hogql_parser/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
build/
*.egg-info
*.so
wheelhouse/
dist/
14 changes: 9 additions & 5 deletions hogql_parser/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ build = [ # Build CPython wheels on Linux and macOS, for x86 as well as ARM
build-frontend = "build" # This is successor to building with pip

[tool.cibuildwheel.macos]
archs = [
archs = [ # We could also build a universal wheel, but separate ones are lighter individually
"x86_64",
"arm64",
] # We could also build a universal wheel, but separate ones are lighter individually
before-all = ["brew install boost antlr antlr4-cpp-runtime"]
]
before-build = [
"brew uninstall --force boost antlr4-cpp-runtime",
"brew fetch --force --bottle-tag=${ARCHFLAGS##'-arch '}_monterey boost antlr4-cpp-runtime",
"brew install $(brew --cache --bottle-tag=${ARCHFLAGS##'-arch '}_monterey boost antlr4-cpp-runtime)",
]

[tool.cibuildwheel.linux]
before-all = [
Expand All @@ -26,8 +30,8 @@ before-all = [
"unzip antlr4-source.zip -d antlr4-source && cd antlr4-source",
"cmake .",
"DESTDIR=out make install",
"cp -r out/usr/local/include/antlr4-runtime /usr/local/include",
"cp out/usr/local/lib64/libantlr4-runtime.so* /usr/local/lib",
"cp -r out/usr/local/include/antlr4-runtime /usr/include/",
"cp out/usr/local/lib64/libantlr4-runtime.so* /usr/lib64/",
"ldconfig",
]
archs = ["x86_64", "aarch64"]
Expand Down
5 changes: 2 additions & 3 deletions hogql_parser/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
],
include_dirs=[
f"{homebrew_location}/include/" if is_macos else "/usr/include/",
f"{homebrew_location}/include/antlr4-runtime/" if is_macos else "/usr/local/include/antlr4-runtime/",
f"{homebrew_location}/include/antlr4-runtime/" if is_macos else "/usr/include/antlr4-runtime/",
],
library_dirs=[
f"{homebrew_location}/Cellar/boost/1.82.0_1/lib/" if is_macos == "Darwin" else "/usr/lib64/",
f"{homebrew_location}/Cellar/antlr4-cpp-runtime/4.13.1/lib/" if is_macos == "Darwin" else "/usr/local/lib/",
f"{homebrew_location}/lib/" if is_macos else "/usr/lib64/",
],
libraries=["antlr4-runtime"],
extra_compile_args=["-std=c++20"],
Expand Down

0 comments on commit 19ce931

Please sign in to comment.