diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20cab9c..ef7cd12 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: key: ${{ runner.os }}-conda-${{ matrix.python-version}}-${{ env.CACHE_NUMBER }} - name: Configure conda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: activate-environment: test channels: conda-forge diff --git a/.github/workflows/distribution.yml b/.github/workflows/distribution.yml index bdffda0..2520076 100644 --- a/.github/workflows/distribution.yml +++ b/.github/workflows/distribution.yml @@ -17,7 +17,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v2 - name: Install cibuildwheel - run: python -m pip install cibuildwheel==1.9.0 + run: python -m pip install cibuildwheel==2.17.0 - name: Build wheels run: python -m cibuildwheel --output-dir wheelhouse @@ -26,11 +26,11 @@ jobs: # against the lal library. However, the lal library installed through # pip is hard to link against. This symlinks it into /usr/lib so # that it can be found. - CIBW_BEFORE_BUILD: bash tools/cibuildwheel_prep.sh - CIBW_BUILD: cp36-* cp37-* cp38-* cp39-* + # CIBW_BEFORE_BUILD: bash tools/cibuildwheel_prep.sh + CIBW_BUILD: cp36-manylinux* cp37-manylinux* cp38-manylinux* cp39-manylinux* cp310-manylinux* cp311-manylinux* cp312-manylinux* CIBW_ARCHS: auto64 - CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014 + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 + CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_28 - uses: actions/upload-artifact@v2 with: path: ./wheelhouse/*.whl diff --git a/sbank/overlap_cpu_lib.c b/sbank/overlap_cpu_lib.c index c738840..443b228 100644 --- a/sbank/overlap_cpu_lib.c +++ b/sbank/overlap_cpu_lib.c @@ -21,23 +21,10 @@ #include #include #include - -/* ---------------- LAL STUFF NEEDED ----------------- */ -typedef struct tagCOMPLEX8Vector { - uint32_t length; /**< Number of elements in array. */ - float complex *data; /**< Pointer to the data array. */ -} COMPLEX8Vector; - -COMPLEX8Vector * XLALCreateCOMPLEX8Vector ( uint32_t length ); -void XLALDestroyCOMPLEX8Vector ( COMPLEX8Vector * vector ); - -typedef struct tagCOMPLEX8FFTPlan COMPLEX8FFTPlan; - -COMPLEX8FFTPlan * XLALCreateReverseCOMPLEX8FFTPlan( uint32_t size, int measurelvl ); - -void XLALDestroyCOMPLEX8FFTPlan( COMPLEX8FFTPlan *plan ); - -/* ----------------------------------------------- */ +#include +#include +#include +#include typedef struct tagWS { size_t n; diff --git a/setup.py b/setup.py index 1a72a4b..28d15e3 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ """ import os +import subprocess from setuptools import setup, Extension @@ -15,6 +16,17 @@ __author__ = "Duncan Macleod " +# Ensure we can find lal libraries +def pkgconfig(package, kw): + flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'} + output = subprocess.getoutput( + 'pkg-config --cflags --libs {}'.format(package)) + print(output) + for token in output.strip().split(): + kw.setdefault(flag_map.get(token[:2]), []).append(token[2:]) + return kw + + # define cython options cython_compile_args = [ "-O3", @@ -33,16 +45,24 @@ cython_directives["linetrace"] = True cython_compile_args.append("-DCYTHON_TRACE") +# Set extension arguments +extension_kwargs = { + 'include_dirs': [numpy.get_include()], + 'language': "c", + 'libraries': ["lal"], + 'extra_compile_args': cython_compile_args, + 'extra_link_args': [], +} + +# lal arguments +extension_kwargs = pkgconfig('lal', extension_kwargs) + # define compiled extensions exts = [ Extension( "sbank.overlap_cpu", ["sbank/overlap_cpu.pyx"], - include_dirs=[numpy.get_include()], - language="c", - libraries=["lal"], - extra_compile_args=cython_compile_args, - extra_link_args=[], + **extension_kwargs ), ]