homebrew-core/Formula/opencsg.rb
2017-04-06 16:25:36 +01:00

47 lines
1.5 KiB
Ruby

class Opencsg < Formula
desc "The CSG rendering library"
homepage "http://www.opencsg.org"
url "http://www.opencsg.org/OpenCSG-1.4.2.tar.gz"
sha256 "d952ec5d3a2e46a30019c210963fcddff66813efc9c29603b72f9553adff4afb"
bottle do
cellar :any
rebuild 1
sha256 "e62e1f707d9aa71d0fc7a8f3ae33273d71162a400fb81fcb6f713ea1d1948530" => :sierra
sha256 "0363ac5efebc67433d163bfc7f88b063a989f9851adb691cdbc4ffdb8528df91" => :el_capitan
sha256 "dcd887e9c5e0512747c7db19197999d29adbf4fff24793cdb9f91b64edf5259f" => :yosemite
end
depends_on "qt" => :build
depends_on "glew"
# This patch disabling building examples
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/990b9bb/opencsg/disable-examples.diff"
sha256 "12cc799a6352eda4a18706eeefea059d14e23605a627dc12ed2a809f65328d69"
end
def install
system "qmake", "-r", "INSTALLDIR=#{prefix}",
"INCLUDEPATH+=#{Formula["glew"].opt_include}",
"LIBS+=-L#{Formula["glew"].opt_lib} -lGLEW"
system "make", "install"
end
test do
(testpath/"test.cpp").write <<-EOS.undent
#include <opencsg.h>
class Test : public OpenCSG::Primitive {
public:
Test() : OpenCSG::Primitive(OpenCSG::Intersection, 0) {}
void render() {}
};
int main(int argc, char** argv) {
Test test;
}
EOS
system ENV.cxx, "test.cpp", "-o", "test", "-L#{lib}", "-lopencsg",
"-framework", "OpenGL"
system "./test"
end
end