Skip to content

Commit

Permalink
Merge pull request OpenChemistry#322 from OpenChemistry/wheel-fixes
Browse files Browse the repository at this point in the history
Wheel build fixes
  • Loading branch information
cjh1 authored Sep 13, 2024
2 parents e3581be + deb307c commit 08593dc
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -ev
pip install cibuildwheel

if [[ $RUNNER_OS == "Windows" ]]; then
git clone --recursive -b 3.3.9 --depth 1 https://gitlab.com/libeigen/eigen /c/eigen
.github/scripts/install_eigen_windows.sh
elif [[ $RUNNER_OS == "macOS" ]]; then
brew install eigen hdf5 ninja
brew install eigen ninja
fi
9 changes: 9 additions & 0 deletions .github/scripts/install_eigen_windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -ev

choco install ninja
git clone --recursive -b 3.3.9 --depth 1 https://gitlab.com/libeigen/eigen /c/eigen
mkdir /c/build
cd /c/build
cmake -GNinja /c/eigen
ninja install
18 changes: 18 additions & 0 deletions .github/scripts/install_hdf5_macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -ev

VERSION="1.14.4"
PATCH_LABEL="3"
VERSION_PATH="hdf5_$VERSION.$PATCH_LABEL"
NAME="hdf5-$VERSION-$PATCH_LABEL"
TARBALL="$NAME.tar.gz"
wget https://github.com/HDFGroup/hdf5/releases/download/$VERSION_PATH/$TARBALL
tar -xzf $TARBALL
mkdir build
cd build
cmake -GNinja ../$NAME -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF -DBUILD_TESTING:BOOL=OFF
ninja
sudo ninja install
# We create a symlink to the install directory that doesn't include the version number, so
# we can use it elsewhere without having to change the version number.
sudo ln -s /usr/local/HDF_Group/HDF5/$VERSION /usr/local/HDF_Group/HDF5/current
10 changes: 7 additions & 3 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ env:

# Specify eigen location for windows, and force it to use python in the path...
CIBW_ENVIRONMENT_WINDOWS: >
EXTRA_CMAKE_ARGS="-DEIGEN3_INCLUDE_DIR=C:\\eigen;-Dstempy_ENABLE_HDF5=OFF"
EXTRA_CMAKE_ARGS="-DEIGEN3_DIR=C:\\PROGRA~2\\Eigen3\\share\\eigen3\\cmake\\;-Dstempy_ENABLE_HDF5=OFF"
USE_PYTHON_IN_PATH=1
# Get cmake to use python in the path...
CIBW_ENVIRONMENT_MACOS: USE_PYTHON_IN_PATH=1
CIBW_ENVIRONMENT_MACOS: >
EXTRA_CMAKE_ARGS="-DHDF5_DIR=/usr/local/HDF_Group/HDF5/current/cmake"
USE_PYTHON_IN_PATH=1
CIBW_BEFORE_TEST: pip install -r {project}/tests/requirements.txt

CIBW_TEST_COMMAND: pytest {project}/tests

CIBW_ARCHS_MACOS: x86_64 arm64

CIBW_BEFORE_ALL_MACOS: . .github/scripts/install_hdf5_macos.sh

# Use bash by default for the run command
defaults:
run:
Expand All @@ -54,7 +58,7 @@ jobs:
fetch-depth: 0
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.10'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
Expand Down
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ include_directories(
)

find_package(Eigen3 REQUIRED)
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/pybind11)
Expand All @@ -39,7 +38,7 @@ set(PYBIND11_CPP_STANDARD "-std=c++14" CACHE STRING "")

option(BUILD_SHARED_LIBS "Build shared libraries" ON)

set(_libs Threads::Threads)
set(_libs Threads::Threads Eigen3::Eigen)

option(stempy_ENABLE_MPI "Build with MPI" OFF)
if (stempy_ENABLE_MPI)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build-system]
requires = ["setuptools", "wheel", "scikit-build==0.14.1", "setuptools_scm[toml]"]
requires = ["setuptools", "wheel", "scikit-build", "setuptools_scm[toml]"]

0 comments on commit 08593dc

Please sign in to comment.