Skip to content

Commit

Permalink
Fix CasADi libs workaround for macOS wheels, update to CasADi 3.6.6 f…
Browse files Browse the repository at this point in the history
…or Windows wheels (pybamm-team#4391)

* Fix CasADi libs workaround for macOS wheels

* Bump to CasADi 3.6.6

* Update vcpkg baseline for CasADi 3.6.6 update

* libc++ is still not fixed

* Fix a typo in the build-system table

* Fix GHA macOS versions for images

* Fix Windows access violation with `msvcp140.dll`

---------

Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com>
  • Loading branch information
agriyakhetarpal and kratman authored Sep 2, 2024
1 parent 4b4b98b commit 396741e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL=${{ steps.get_num_cores.outputs.count }}
CIBW_ARCHS: AMD64
CIBW_BEFORE_BUILD: python -m pip install setuptools wheel delvewheel # skip CasADi and CMake
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair -w {dest_dir} {wheel}
# Fix access violation because GHA runners have modified PATH that picks wrong
# msvcp140.dll, see https://github.com/adang1345/delvewheel/issues/54
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair --add-path C:/Windows/System32 -w {dest_dir} {wheel}
CIBW_TEST_EXTRAS: "all,dev,jax"
CIBW_TEST_COMMAND: |
python -c "import pybamm; print(pybamm.IDAKLUSolver())"
Expand Down Expand Up @@ -149,9 +151,6 @@ jobs:
- name: Clone pybind11 repo (no history)
run: git clone --depth 1 --branch v2.12.0 https://github.com/pybind/pybind11.git -c advice.detachedHead=false

- name: Set macOS-specific environment variables
run: echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

Expand Down Expand Up @@ -243,13 +242,15 @@ jobs:
python scripts/install_KLU_Sundials.py
python -m cibuildwheel --output-dir wheelhouse
env:
# 10.13 for Intel (macos-12/macos-13), 11.0 for Apple Silicon (macos-14 and macos-latest)
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.os == 'macos-14' && '11.0' || '10.13' }}
CIBW_ARCHS_MACOS: auto
CIBW_BEFORE_BUILD: python -m pip install cmake casadi setuptools wheel delocate
CIBW_REPAIR_WHEEL_COMMAND: |
if [[ $(uname -m) == "x86_64" ]]; then
delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel}
elif [[ $(uname -m) == "arm64" ]]; then
# Use higher macOS target for now: https://github.com/casadi/casadi/issues/3698
# Use higher macOS target for now since casadi/libc++.1.0.dylib is still not fixed
delocate-listdeps {wheel} && delocate-wheel -v -w {dest_dir} {wheel} --require-target-macos-version 11.1
for file in {dest_dir}/*.whl; do mv "$file" "${file//macosx_11_1/macosx_11_0}"; done
fi
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ requires = [
"setuptools>=64",
"wheel",
# On Windows, use the CasADi vcpkg registry and CMake bundled from MSVC
"casadi>=3.6.5; platform_system!='Windows'",
"casadi>=3.6.6; platform_system!='Windows'",
# Note: the version of CasADi as a build-time dependency should be matched
# cross platforms, so updates to its minimum version here should be accompanied
# across platforms, so updates to its minimum version here should be accompanied
# by a version bump in https://github.com/pybamm-team/casadi-vcpkg-registry.
"cmake; platform_system!='Windows'",
]
Expand Down Expand Up @@ -37,7 +37,7 @@ classifiers = [
dependencies = [
"numpy>=1.23.5,<2.0.0",
"scipy>=1.11.4",
"casadi>=3.6.5",
"casadi>=3.6.6",
"xarray>=2022.6.0",
"anytree>=2.8.0",
"sympy>=1.12",
Expand Down
2 changes: 1 addition & 1 deletion vcpkg-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
"kind": "git",
"repository": "https://github.com/pybamm-team/casadi-vcpkg-registry.git",
"baseline": "ceee3ed50246744cdef43517d7d7617b8ac291e7",
"baseline": "1cb93f2fb71be26c874db724940ef8e604ee558e",
"packages": ["casadi"]
}
]
Expand Down

0 comments on commit 396741e

Please sign in to comment.