diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux_x86_64.yml similarity index 100% rename from .github/workflows/build_wheels_linux.yml rename to .github/workflows/build_wheels_linux_x86_64.yml diff --git a/.github/workflows/build_wheels_macos_x86_64.yml b/.github/workflows/build_wheels_macos_x86_64.yml new file mode 100644 index 0000000..d7dae71 --- /dev/null +++ b/.github/workflows/build_wheels_macos_x86_64.yml @@ -0,0 +1,58 @@ +name: Wheel::MacOS::Intel + +on: + pull_request: + push: + branches: + - master + release: + types: [published] + +env: + MACOSX_DEPLOYMENT_TARGET: 10.15 + + +concurrency: + group: wheel_macos_x86_64-${{ github.ref }} + cancel-in-progress: true + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-12] + arch: [x86_64] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + name: Install Python + with: + python-version: '3.9' + + - name: Install cibuildwheel + run: python3.9 -m pip install cibuildwheel~=2.11.0 + + - name: Build wheels + env: + CIBW_ARCHS_MACOS: ${{matrix.arch}} + + CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-*" + + # MacOS specific build settings + CIBW_BEFORE_ALL_MACOS: | + brew install mpfr gmp + + CIBW_BEFORE_BUILD: | + python -m pip install pybind11 cmake~=3.24.0 + + CIBW_BUILD_VERBOSITY: 1 + + run: python3.9 -m cibuildwheel --output-dir wheelhouse + + - uses: actions/upload-artifact@v3 + with: + path: ./wheelhouse/*.whl diff --git a/CMakeLists.txt b/CMakeLists.txt index 886b323..9a161dc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,11 +26,19 @@ include(FetchContent) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") add_library(polyval2d_high_precision_external_libs INTERFACE) + +# Add MPFR find_package(MPFR REQUIRED) target_include_directories(polyval2d_high_precision_external_libs INTERFACE ${MPFR_INCLUDE_DIRS}) target_link_libraries(polyval2d_high_precision_external_libs INTERFACE ${MPFR_LIBRARIES}) +# Add GMP +find_package(GMP REQUIRED) +message(STATUS "Found GMP; GMP_INCLUDES = ${GMP_INCLUDES}, GMP_LIBRARIES=${GMP_LIBRARIES}") +target_link_libraries(polyval2d_high_precision_external_libs INTERFACE ${GMP_LIBRARIES}) +target_include_directories(polyval2d_high_precision_external_libs INTERFACE ${GMP_INCLUDES}) + set(BOOST_MP_STANDALONE ON) set(BOOST_MATH_STANDALONE ON) diff --git a/cmake/FindGMP.cmake b/cmake/FindGMP.cmake new file mode 100644 index 0000000..1f02739 --- /dev/null +++ b/cmake/FindGMP.cmake @@ -0,0 +1,21 @@ +# Try to find the GNU Multiple Precision Arithmetic Library (GMP) +# See http://gmplib.org/ + +if (GMP_INCLUDES AND GMP_LIBRARIES) + set(GMP_FIND_QUIETLY TRUE) +endif (GMP_INCLUDES AND GMP_LIBRARIES) + +find_path(GMP_INCLUDES + NAMES + gmp.h + PATHS + $ENV{GMPDIR} + ${INCLUDE_INSTALL_DIR} +) + +find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMP DEFAULT_MSG + GMP_INCLUDES GMP_LIBRARIES) +mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES) diff --git a/external/gmp-6.3.0.tar.xz b/external/gmp-6.3.0.tar.xz new file mode 100644 index 0000000..eed1334 Binary files /dev/null and b/external/gmp-6.3.0.tar.xz differ diff --git a/external/mpfr-4.2.1.tar.xz b/external/mpfr-4.2.1.tar.xz new file mode 100644 index 0000000..62fb991 Binary files /dev/null and b/external/mpfr-4.2.1.tar.xz differ diff --git a/setup.py b/setup.py index 396c2ce..179a0bd 100644 --- a/setup.py +++ b/setup.py @@ -48,6 +48,10 @@ def build_extension(self, ext: CMakeExtension): f"-DPYTHON_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm ] + + if "CMAKE_ARGS" in os.environ: + configure_args += os.environ["CMAKE_ARGS"].split(" ") + configure_args += self.cmake_defines build_args = [] @@ -91,7 +95,7 @@ def build_extension(self, ext: CMakeExtension): "package_data": {}, "entry_points": { }, - "description": "C++ helper tool for efficient computation of HVA", + "description": "C++ helper tool for efficient computation of poly2val", "long_description": open("README.rst").read(), "long_description_content_type": "text/x-rst", "provides": ["polyval2d_mp"],