Skip to content

Commit

Permalink
casadi 3.6.6 (new formula)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Sep 1, 2024
1 parent 9633f04 commit 1b1cf9a
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions Formula/c/casadi.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
class Casadi < Formula

Check warning on line 1 in Formula/c/casadi.rb

View workflow job for this annotation

GitHub Actions / macOS 14-arm64

`brew linkage --cached --test --strict casadi` failed on macOS Sonoma (14) on Apple Silicon!

Indirect dependencies with linkage: openblas

Check warning on line 1 in Formula/c/casadi.rb

View workflow job for this annotation

GitHub Actions / macOS 13-arm64

`brew linkage --cached --test --strict casadi` failed on macOS Ventura (13) on Apple Silicon!

Indirect dependencies with linkage: openblas

Check warning on line 1 in Formula/c/casadi.rb

View workflow job for this annotation

GitHub Actions / macOS 12-arm64

`brew linkage --cached --test --strict casadi` failed on macOS Monterey (12) on Apple Silicon!

Indirect dependencies with linkage: openblas
desc "Symbolic framework for numeric optimization"
homepage "http://casadi.org"
url "https://github.com/casadi/casadi/releases/download/3.6.6/casadi-3.6.6.tar.gz"
sha256 "104601d37ab7ebf897bce7e097823bb090dd7629a7cc4c2e76780f46fc0e59f6"
license "LGPL-3.0-or-later"

depends_on "cmake" => :build
depends_on "doxygen" => :build
depends_on "pkg-config" => :build
depends_on "swig" => :build

depends_on "ipopt"
depends_on "numpy"
depends_on "osqp"
depends_on "proxsuite"
depends_on "python@3.12"
depends_on "swig"
depends_on "tinyxml2"

def python3
"python3.12"
end

def install
site_packages = prefix/Language::Python.site_packages(python3)
system "cmake", "-S", ".", "-B", "build",
"-DPYTHON_EXECUTABLE=#{which(python3)}",
"-DWITH_PYTHON=ON",
"-DWITH_PYTHON3=ON",
"-DWITH_LAPACK=ON",
"-DWITH_IPOPT=ON",
"-DWITH_BUILD_IPOPT=OFF",
"-DWITH_JSON=OFF",
"-DWITH_THREAD=ON",
"-DWITH_OSQP=ON",
"-DWITH_BUILD_OSQP=OFF",
"-DWITH_QPOASES=ON",
"-DWITH_PROXQP=ON",
"-DWITH_BUILD_PROXQP=OFF",
"-DWITH_TINYXML=ON",
"-DWITH_BUILD_TINYXML=OFF",
"-DWITH_KNITRO=OFF",
"-DWITH_BUILD_KNITRO=OFF",
"-DWITH_CPLEX=OFF",
"-DWITH_MOCKUP_CPLEX=OFF",
"-DWITH_GUROBI=OFF",
"-DWITH_MOCKUP_GUROBI=OFF",
"-DWITH_HSL=OFF",
"-DWITH_MOCKUP_HSL=OFF",
"-DWITH_WORHP=OFF",
"-DWITH_MOCKUP_WORHP=OFF",
"-DCASADI_PYTHON_PIP_METADATA_INSTALL=ON",
"-DCASADI_PYTHON_PIP_METADATA_INSTALLER:STRING=\"brew\"",
"-DSWIG_IMPORT=ON -DSWIG_EXPORT=OFF",
"-DPYTHON_PREFIX=#{site_packages}",
*std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
system python3, "-c", <<~EOS
from casadi import *
# minimize 3x + 4y
# subject to x + 2y <= 14
# 3x - y >= 0
# x - y <= 2
# Sparsity of the LP linear term
A = Sparsity.dense(3, 2)
# Create solver
solver = conic('solver', 'qpoases', {'a':A})
g = DM([3,4])
a = DM([[1, 2],[3, -1], [1, -1]])
lba = DM([-inf, 0, -inf])
uba = DM([14, inf, 2])
sol = solver(g=g, a=a, lba=lba, uba=uba)
print(sol)
EOS
end
end

0 comments on commit 1b1cf9a

Please sign in to comment.