Skip to content

Commit

Permalink
Try to build macos wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
tnipen committed Feb 25, 2025
1 parent 03c128d commit 044f4fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ jobs:
strategy:
matrix:
# os: [ubuntu-20.04, windows-2019, macos-11]
os: [ubuntu-20.04]
os: [macos-14]
# os: [ubuntu-20.04]

steps:
- uses: actions/checkout@v3
Expand All @@ -56,7 +57,8 @@ jobs:
# PyPy compilation on MACOS doesn't work, possibly since there is no available numpy release for this
# Armadillo isn't available for i687 on Centos 7, making compilation more complicated
# # Musllinux doesn't use yum as its package manager
CIBW_SKIP: pp*-macosx* *i686* *musllinux* *p36* *p37* *p38* pp*
# CIBW_SKIP: pp*-macosx* *i686* *musllinux* *p36* *p37* *p38* pp*
CIBW_BUILD: cp310-macosx_arm64
CIBW_BEFORE_ALL_LINUX: |
yum install -y lapack-devel gsl-devel armadillo-devel
curl -L -O https://archives.boost.io/release/1.72.0/source/boost_1_72_0.tar.gz
Expand All @@ -66,16 +68,17 @@ jobs:
CIBW_BEFORE_ALL_MACOS: |
# Other than the latest version, Brew only has boost 1.76. Therefore we must install boost from source
# brew reinstall gcc lapack gsl armadillo
brew reinstall lapack gsl armadillo
curl -L -O https://archives.boost.io/release/1.72.0/source/boost_1_72_0.tar.gz
tar -xf boost_1_72_0.tar.gz
cd boost_1_72_0
cp -r boost /usr/local/include
pwd
brew reinstall lapack gsl armadillo boost
#curl -L -O https://archives.boost.io/release/1.72.0/source/boost_1_72_0.tar.gz
#tar -xf boost_1_72_0.tar.gz
#cd boost_1_72_0
#sudo cp -r boost /usr/local/include
# Link in gcc, otherwise the default Apple compiler will be used, which doesn't support openmp by default
# ln -s /usr/local/bin/gcc-13 /usr/local/bin/gcc
# ln -s /usr/local/bin/g++-13 /usr/local/bin/g++
# CIBW_ENVIRONMENT_MACOS: CC='/usr/local/bin/gcc' LDSHARED='/usr/local/bin/gcc' CXX='/usr/local/bin/g++'
CIBW_ENVIRONMENT_MACOS: CFLAGS='-Wno-c++11-narrowing'
CIBW_ENVIRONMENT_MACOS: CFLAGS='-Wno-c++11-narrowing' LDFLAGS='-L/opt/homebrew/lib' CPPFLAGS='-I/opt/homebrew/include -std=c++14'
CIBW_BEFORE_ALL_WINDOWS: choco install -y lapack-devel
CIBW_TEST_COMMAND: >
python {project}/tests/check_installation.py
Expand Down
2 changes: 1 addition & 1 deletion swig/python-packaging/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ add_custom_target(package-python

COMMAND ${SWIG_EXECUTABLE} -python -outdir ${CMAKE_CURRENT_BINARY_DIR} -c++ -I./include -o ${CMAKE_CURRENT_BINARY_DIR}/titanlibPYTHON_wrap.cxx ${SWIG_INTERFACE}
# COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY_OUT} sdist --dist-dir ${CMAKE_BINARY_DIR}
COMMAND python ${SETUP_PY_OUT} sdist --dist-dir ${CMAKE_BINARY_DIR}
COMMAND python3 ${SETUP_PY_OUT} sdist --dist-dir ${CMAKE_BINARY_DIR}
)
# add_dependencies(package-python _titanlib2)
3 changes: 2 additions & 1 deletion swig/python-packaging/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ requires = [
"wheel",
"Cython",
"numpy==1.12.1; python_version<'3.5'",
"oldest-supported-numpy; python_version>='3.5'",
"oldest-supported-numpy; python_version>='3.5' and python_version<'3.9'",
"numpy==2.0.2; python_version>='3.9'",
]

build-backend = "setuptools.build_meta"
6 changes: 5 additions & 1 deletion swig/python-packaging/setup.in.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ def run(self):
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=['numpy<2'],
# TODO: Could introduce python version-specific numpy versions
# However, since the earliest precompiled numpy versions have been used when compiling gridpp,
# it is unlikely the user will have an older version of numpy
# install_requires=['numpy<=1.12.1; python_version < "3"'],
install_requires=['numpy'],

test_suite="titanlib.tests",
ext_modules = [module],
Expand Down

0 comments on commit 044f4fc

Please sign in to comment.