Skip to content

Commit

Permalink
build linux aarch64 wheels, closes #162
Browse files Browse the repository at this point in the history
  • Loading branch information
fgregg committed Sep 30, 2024
1 parent adfb0bd commit 4db469a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_and_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
uses: "pypa/[email protected]"
env:
CIBW_SKIP: "pp*" # FIXME
CIBW_ARCHS_LINUX: "auto aarch64"
CIBW_TEST_REQUIRES: "pytest"
CIBW_TEST_COMMAND: "pytest {project}/tests --doctest-modules"
- uses: "actions/upload-artifact@v3"
Expand Down
16 changes: 10 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from Cython.Build import cythonize
from setuptools import Extension, setup

sources = ["pycrfsuite/_pycrfsuite.pyx",
"pycrfsuite/trainer_wrapper.cpp"]
sources = ["pycrfsuite/_pycrfsuite.pyx", "pycrfsuite/trainer_wrapper.cpp"]

# crfsuite
sources += glob.glob("crfsuite/lib/crf/src/*.c")
Expand All @@ -34,12 +33,17 @@ def build_extensions(self):
_compile = c._compile

def c_compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
cc_args = cc_args + ["-D_POSIX_C_SOURCE=200112L"] if src.startswith("crfsuite/") else cc_args
cc_args = (
cc_args + ["-D_POSIX_C_SOURCE=200112L"]
if src.startswith("crfsuite/")
else cc_args
)
cc_args = cc_args + ["-std=c99"] if src.endswith(".c") else cc_args
return _compile(obj, src, ext, cc_args, extra_postargs, pp_opts)

if c.compiler_type == "unix" and \
any(item == "gcc" or item.endswith("-gcc") for item in c.compiler):
if c.compiler_type == "unix" and any(
item == "gcc" or item.endswith("-gcc") for item in c.compiler
):
c._compile = c_compile

elif self.compiler.compiler_type == "msvc":
Expand All @@ -60,5 +64,5 @@ def c_compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
)
]
),
cmdclass={"build_ext": build_ext_check_gcc}
cmdclass={"build_ext": build_ext_check_gcc},
)

0 comments on commit 4db469a

Please sign in to comment.