Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macos wheel #3

Merged
merged 25 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/build_wheels_macos_x86_64.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
21 changes: 21 additions & 0 deletions cmake/FindGMP.cmake
Original file line number Diff line number Diff line change
@@ -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)
Binary file added external/gmp-6.3.0.tar.xz
Binary file not shown.
Binary file added external/mpfr-4.2.1.tar.xz
Binary file not shown.
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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"],
Expand Down