Skip to content

Commit

Permalink
mistral: add initial formula
Browse files Browse the repository at this point in the history
  • Loading branch information
Dekker1 committed Jun 18, 2022
1 parent ecccb08 commit 7d83822
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Formula/mistral.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
class Mistral < Formula
desc "Open source constraint programming library and FlatZinc solver written in C++"
homepage "https://github.com/ehebrard/Mistral-2.0"
url "https://github.com/ehebrard/Mistral-2.0.git",
revision: "762f42638ee7ff418aa37f60fd85b644dcb6f726"
version "2022-06-16"
license "AGPL-3.0-only"
head "https://github.com/ehebrard/Mistral-2.0.git", branch: "master"

depends_on "boost" => :build
depends_on "python"

def install
system "make", "-C", "fz"

bin.install "fz/mistral-fzn"
inreplace "fz/mistral-fz" do |s|
s.gsub!("mcmd = ['./mistral-fzn']", "mcmd = ['#{bin}/mistral-fzn']")
end
bin.install "fz/mistral-fz"

(share / "minizinc").mkpath
(share / "minizinc").install "fz/mznlib" => "mistral"

(share / "minizinc/solvers").mkpath
(share / "minizinc/solvers/mistral.msc").write <<~EOS
{
"id": "org.mistral.mistral",
"name": "Mistral",
"description": "Mistral FlatZinc interface",
"version": "#{version}",
"mznlib": "#{share}/minizinc/mistral",
"executable": "#{bin}/mistral-fz",
"tags": ["cp", "int"],
"stdFlags": ["-a"],
"extraFlags": [],
"supportsMzn": false,
"supportsFzn": true,
"needsSolns2Out": true,
"needsMznExecutable": false,
"needsStdlibDir": false,
"isGUIApplication": false
}
EOS
end

test do
(testpath/"test.fzn").write <<~EOS
var bool: x1;
solve satisfy;
EOS
assert_match "----------", shell_output("#{bin}/mistral-fz test.fzn").strip
end
end

0 comments on commit 7d83822

Please sign in to comment.