Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsbml 5.20.2 (new formula) #1672

Merged
merged 6 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions Formula/libsbml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
class Libsbml < Formula
desc "Library for handling SBML (Systems Biology Markup Language)"
homepage "https://sbml.org/software/libsbml"
url "https://github.com/sbmlteam/libsbml/archive/refs/tags/v5.20.2.tar.gz"
sha256 "a196cab964b0b41164d4118ef20523696510bbfd264a029df00091305a1af540"
license "LGPL-2.1-only"

depends_on "check" => :build
depends_on "cmake" => :build
depends_on "pkg-config" => :build

uses_from_macos "bzip2"
uses_from_macos "libxml2"

def install
# avoid an error "invalid conversion from ‘const xmlError*’"
ENV.append_to_cflags "-fpermissive" if OS.linux?
args = %w[
-DWITH_SWIG=OFF
-DWITH_ZLIB=OFF
-DWITH_BZIP2=ON
-DENABLE_COMP=ON
-DENABLE_FBC=ON
-DENABLE_GROUPS=ON
-DENABLE_L3V2EXTENDEDMATH=ON
-DENABLE_LAYOUT=ON
-DENABLE_MULTI=ON
-DENABLE_QUAL=ON
-DENABLE_RENDER=ON
]
args << "-DLIBSBML_DEPENDENCY_DIR=#{HOMEBREW_PREFIX}"
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end

test do
(testpath/"test.cpp").write <<~EOS
#include <sbml/SBMLTypes.h>
#include <sbml/packages/fbc/common/FbcExtensionTypes.h>
#include <sbml/packages/groups/common/GroupsExtensionTypes.h>

LIBSBML_CPP_NAMESPACE_USE

int main(int argc,char** argv)
{
SBMLNamespaces sbmlns(3,2);

sbmlns.addPkgNamespace("fbc",1);
sbmlns.addPkgNamespace("groups",1);

// create the document

SBMLDocument *document = new SBMLDocument(&sbmlns);
document->setPackageRequired("fbc", false);
document->setPackageRequired("groups", false);

// create the model
Model* model = document->createModel();

// basic test
model->setId("Homebrew_SBMLtest");
std::cout << model->getId() << std::endl;

return 0;
}
EOS
system ENV.cxx, "-std=c++17", "-L#{lib}", "-I#{include}", "test.cpp", "-o", "test", "-lsbml"
assert_equal "Homebrew_SBMLtest", shell_output("./test").strip
end
end
Loading