Skip to content

Commit 23337c1

Browse files
committed
Complete Cantera 3.1.0 source build implementation
Add full implementation for building Cantera 3.1.0 from git source: - Add Cantera git resource with v3.1.0 tag - Add scons, sundials, yaml-cpp dependencies - Build Cantera with scons before MFC toolchain installation - Install Cantera Python bindings into venv - Update CI to install all required dependencies This provides exact Cantera 3.1.0 that MFC requires, which isn't on PyPI.
1 parent c0dbe80 commit 23337c1

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

.github/workflows/homebrew.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Install formula dependencies
3636
run: |
3737
echo "Installing MFC dependencies..."
38-
brew install cmake gcc [email protected] boost fftw hdf5 open-mpi openblas
38+
brew install cmake gcc scons [email protected] boost fftw hdf5 open-mpi openblas sundials yaml-cpp
3939
4040
- name: Validate formula syntax
4141
run: |

packaging/homebrew/mfc.rb

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@ class Mfc < Formula
1212

1313
depends_on "cmake" => :build
1414
depends_on "gcc" => :build
15+
depends_on "scons" => :build
1516

1617
depends_on "boost"
1718
depends_on "fftw"
1819
depends_on "hdf5"
1920
depends_on "open-mpi"
2021
depends_on "openblas"
2122
depends_on "[email protected]"
23+
depends_on "sundials"
24+
depends_on "yaml-cpp"
25+
26+
resource "cantera" do
27+
url "https://github.com/Cantera/cantera.git",
28+
tag: "v3.1.0",
29+
revision: "3882f63dc48cc12bbc3cabb0c5c6e87e9bbaa8a0"
30+
end
2231

2332
def install
2433
# MFC uses a Python wrapper script for building
@@ -46,16 +55,39 @@ def install
4655
# Install examples
4756
pkgshare.install "examples"
4857

49-
# Patch pyproject.toml to use available cantera version
50-
# Version 3.1.0 doesn't exist on PyPI, use 3.0.1 instead
51-
inreplace prefix/"toolchain/pyproject.toml", 'cantera==3.1.0', 'cantera>=3.0.0,<4.0'
52-
53-
# Create Python virtual environment with MFC dependencies
58+
# Create Python virtual environment first
5459
venv = libexec/"venv"
5560
system Formula["[email protected]"].opt_bin/"python3.12", "-m", "venv", venv
56-
57-
# Install MFC Python package and dependencies into venv
5861
system venv/"bin/pip", "install", "--upgrade", "pip", "setuptools", "wheel"
62+
63+
# Build and install Cantera 3.1.0 from source
64+
resource("cantera").stage do
65+
# Install Cantera build dependencies
66+
system venv/"bin/pip", "install", "cython", "numpy", "ruamel.yaml"
67+
68+
# Configure Cantera build
69+
system "scons", "build",
70+
"python_package=y",
71+
"f90_interface=n",
72+
"system_sundials=y",
73+
"system_yamlcpp=y",
74+
"system_fmt=n",
75+
"extra_inc_dirs=#{Formula["sundials"].opt_include}:#{Formula["yaml-cpp"].opt_include}",
76+
"extra_lib_dirs=#{Formula["sundials"].opt_lib}:#{Formula["yaml-cpp"].opt_lib}",
77+
"prefix=#{libexec}/cantera",
78+
"python_cmd=#{venv}/bin/python",
79+
"-j#{ENV.make_jobs}"
80+
81+
# Install Cantera
82+
system "scons", "install"
83+
84+
# Install Cantera Python package into venv
85+
cd "build/python" do
86+
system venv/"bin/pip", "install", "--no-build-isolation", "."
87+
end
88+
end
89+
90+
# Install MFC Python package and remaining dependencies into venv
5991
system venv/"bin/pip", "install", "-e", prefix/"toolchain"
6092

6193
# Create a wrapper that sets up a working environment for mfc.sh

0 commit comments

Comments
 (0)