-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libsbml 5.20.2 (new formula) (#1672)
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |