Skip to content
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
25 changes: 11 additions & 14 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,34 @@ jobs:
build_and_test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
os: [ubuntu-latest, windows-latest, macos-14, macos-15-intel]
name: Build and test, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: mamba-org/setup-micromamba@v1
with:
cache-downloads: true
- name: Build wheels
run: |
$MAMBA_EXE create -n cibuildwheel python=3.12
$MAMBA_EXE create -n cibuildwheel python=3.12 eigen pybind11
eval "$($MAMBA_EXE shell activate cibuildwheel)"
python -m pip install cibuildwheel
if [[ $OSTYPE == "darwin23" ]] || [[ $OSTYPE == "darwin22" ]]
if [[ $OSTYPE == "linux-gnu" ]]
then
# For some reason cibuildwheel on builds 3.9-3.12 arm64 on macos-latest
export CIBW_BUILD="cp39* cp310* cp311* cp312*"
export CIBW_ENVIRONMENT="CONDA_PREFIX=/host/$CONDA_PREFIX"
fi
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_BUILD: "cp38-* cp39* cp310-* cp311-* cp312-*"
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*musllinux* *win32* *i686*"
CIBW_ARCHS_MACOS: "native"
CIBW_BUILD_VERBOSITY: 1
- name: Install wheels and run test
run: |
# set -e makes sure the script fails if any command in the loop fails
set -e
if [[ $OSTYPE == "darwin23" ]] || [[ $OSTYPE == "darwin22" ]]
then
export PYVERS="3.9 3.10 3.11 3.12"
else
export PYVERS="3.8 3.9 3.10 3.11 3.12"
fi
for pyver in $PYVERS
for pyver in 3.10 3.11 3.12 3.13 3.14
do
$MAMBA_EXE create -n py$pyver -c conda-forge python=$pyver numpy
eval "$($MAMBA_EXE shell activate py$pyver)"
Expand All @@ -67,6 +59,11 @@ jobs:
python -m unittest
cd ..
done
- name: Build Pyodide wheel
if: matrix.os == 'ubuntu-latest'
run: |
eval "$($MAMBA_EXE shell activate cibuildwheel)"
CIBW_BUILD="cp312*" python -m cibuildwheel --output-dir wheelhouse --platform pyodide
- name: Upload release wheels
if: |
contains(github.event.pull_request.title, 'RELEASE') &&
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
*.swo
*.o
*.exe
*.whl
__pycache__

.pyodide-xbuildenv
build
dist
libMcPhase.egg-info
libmcphase.egg-info
emsdk
Emscripten.cmake

libmcphase/*pyd
24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_MACOSX_RPATH TRUE)
set(CMAKE_CXX_STANDARD 11)
set(CXX_STANDARD_REQUIRED 11)
cmake_policy(SET CMP0148 OLD) # New policy gives error when cannot find shared libs

set(LIBMCPHASE_PYTHON_MODULE libmcphase)

Expand All @@ -18,11 +19,26 @@ if(WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -d2:-FH4-")
endif(WIN32)

include(Eigen)
include_directories(${EIGEN3_INCLUDE_DIR})
if (DEFINED ENV{CONDA_PREFIX})
message(STATUS "Searching $ENV{CONDA_PREFIX} for Pybind11 and Eigen")
file(GLOB pybind11_search $ENV{CONDA_PREFIX}/share/cmake/pybind11/pybind11Config.cmake)
if (NOT pybind11_search STREQUAL "")
cmake_path(GET pybind11_search PARENT_PATH pybind11_DIR)
endif()
file(GLOB eigen_search $ENV{CONDA_PREFIX}/share/eigen3/cmake/Eigen3Config.cmake)
if (NOT eigen_search STREQUAL "")
cmake_path(GET eigen_search PARENT_PATH Eigen3_DIR)
endif()
endif()

if (EMSCRIPTEN)
message(STATUS "Emscripten detected - setting Pybind to use cross-compiler")
set(PYBIND11_USE_CROSSCOMPILING TRUE)
endif()

include(PyBind11)
add_subdirectory(${PyBind11_DIR})
find_package(Eigen3 REQUIRED NO_MODULE)
include_directories(${EIGEN3_INCLUDE_DIR})
find_package(pybind11 CONFIG)

add_subdirectory(src)

Expand Down
18 changes: 0 additions & 18 deletions cmake/Eigen.cmake

This file was deleted.

18 changes: 0 additions & 18 deletions cmake/Eigen.in

This file was deleted.

19 changes: 0 additions & 19 deletions cmake/PyBind11.cmake

This file was deleted.

12 changes: 0 additions & 12 deletions cmake/PyBind11.in

This file was deleted.

6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
import sys
import subprocess
import pkgutil
import importlib.util
from sysconfig import get_platform
from subprocess import CalledProcessError, check_output, check_call
from distutils.version import LooseVersion
Expand All @@ -14,7 +14,7 @@
# Except that in the manylinux builds it's placed at /opt/python/[version]/bin/
# (as a symlink at least) which is *not* on the path.
# If cmake is a known module, import it and use it tell us its binary directory
if pkgutil.find_loader('cmake') is not None:
if (cmakemod := importlib.util.find_spec('cmake')) and cmakemod.loader:
import cmake
CMAKE_BIN = cmake.CMAKE_BIN_DIR + os.path.sep + 'cmake'
else:
Expand Down Expand Up @@ -124,10 +124,10 @@ def build_extension(self, ext):
cmdclass=cmdclass,
url="https://github.com/mducle/libmcphase",
zip_safe=False,
license="GPL-3.0-or-later",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: POSIX :: Linux",
"Programming Language :: C++",
Expand Down
Loading