homebrew-core/Formula/glm.rb
2019-03-23 22:05:06 +08:00

51 lines
1.5 KiB
Ruby

class Glm < Formula
desc "C++ mathematics library for graphics software"
homepage "https://glm.g-truc.net/"
url "https://github.com/g-truc/glm/releases/download/0.9.9.4/glm-0.9.9.4.zip"
sha256 "972b8c319ff1b96eeac19c63563176f138527ebf6fa5110b8eac5fe23f5e7d9f"
head "https://github.com/g-truc/glm.git"
bottle do
cellar :any_skip_relocation
sha256 "8ba51243f0276e651ec43f6edd4f8f9aa48e8a6445faa61c8ba4b7b38f4c52d8" => :mojave
sha256 "84551dca48f057289cfda741cbc16972f95a4a9a7c732ca38418ca58c50f332b" => :high_sierra
sha256 "6d528c84ff11e13a550de7384c93f56db90392c9c431c30495bd04774e63490a" => :sierra
end
depends_on "cmake" => :build
depends_on "doxygen" => :build
def install
mkdir "build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
cd "doc" do
system "doxygen", "man.doxy"
man.install "html"
end
doc.install Dir["doc/*"]
end
test do
(testpath/"test.cpp").write <<~EOS
#include <glm/vec2.hpp>// glm::vec2
int main()
{
std::size_t const VertexCount = 4;
std::size_t const PositionSizeF32 = VertexCount * sizeof(glm::vec2);
glm::vec2 const PositionDataF32[VertexCount] =
{
glm::vec2(-1.0f,-1.0f),
glm::vec2( 1.0f,-1.0f),
glm::vec2( 1.0f, 1.0f),
glm::vec2(-1.0f, 1.0f)
};
return 0;
}
EOS
system ENV.cxx, "-I#{include}", testpath/"test.cpp", "-o", "test"
system "./test"
end
end