homebrew-core/Formula/glbinding.rb
2018-08-23 23:40:59 +02:00

45 lines
1.6 KiB
Ruby

class Glbinding < Formula
desc "C++ binding for the OpenGL API"
homepage "https://github.com/cginternals/glbinding"
url "https://github.com/cginternals/glbinding/archive/v2.1.4.tar.gz"
sha256 "cb5971b086c0d217b2304d31368803fd2b8c12ee0d41c280d40d7c23588f8be2"
bottle do
cellar :any
sha256 "720c3c74d33cef2dae21328440ce107660fc417059dbb3cb98128ed947c9be6b" => :mojave
sha256 "fd4ecf93841f884924c9394e6c9ce1ceadbd4d4a5d93a8e816ba547873fe8f84" => :high_sierra
sha256 "17af598a7d19f598412b3c94efe9166ab31f027d81ed3ded7aa7e2e318c2d166" => :sierra
sha256 "206ed78988d76389de106d58d8b8ffb8417fc1e48ed32141f58e3ebc1f41b77e" => :el_capitan
end
option "with-glfw", "Enable tools that display OpenGL information for your system"
option "with-static", "Build static instead of shared glbinding libraries"
depends_on "cmake" => :build
depends_on "glfw" => :optional
needs :cxx11
def install
ENV.cxx11
args = std_cmake_args
args << "-DGLFW_LIBRARY_RELEASE=" if build.without? "glfw"
args << "-DBUILD_SHARED_LIBS:BOOL=OFF" if build.with? "static"
system "cmake", ".", *args
system "cmake", "--build", ".", "--target", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <glbinding/gl/gl.h>
#include <glbinding/Binding.h>
int main(void)
{
glbinding::Binding::initialize();
}
EOS
system ENV.cxx, "-o", "test", "test.cpp", "-std=c++11", "-stdlib=libc++",
"-I#{include}/glbinding", "-I#{lib}/glbinding", "-framework", "OpenGL",
"-L#{lib}", "-lglbinding", *ENV.cflags.to_s.split
system "./test"
end
end