homebrew-core/Formula/libgosu.rb
2017-11-25 03:37:24 -08:00

57 lines
1.4 KiB
Ruby

class Libgosu < Formula
desc "2D game development library"
homepage "https://libgosu.org"
url "https://github.com/gosu/gosu/archive/v0.13.1.tar.gz"
sha256 "0861beba7e19cc06042a731845d3ae3b32e88c0856a41930b390b815a7ec6fc7"
head "https://github.com/gosu/gosu.git"
bottle do
cellar :any
sha256 "147279fb12ca113b97f6e827ad60e29511c9f68772a9e65f67abdda45a208466" => :high_sierra
sha256 "03709f8df943c8f5c5d0af68f82722569cec3d248f02bfea224bca9ad3da3acf" => :sierra
sha256 "f0141f0442da13eeee06b143edba5041d28e4abb1eb285b54d499641df4fc6d6" => :el_capitan
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "sdl2"
def install
mkdir "build" do
system "cmake", "../cmake", *std_cmake_args
system "make", "install"
end
end
test do
(testpath/"test.cpp").write <<~EOS
#include <stdlib.h>
#include <Gosu/Gosu.hpp>
class MyWindow : public Gosu::Window
{
public:
MyWindow()
: Gosu::Window(640, 480)
{
set_caption(\"Hello World!\");
}
void update()
{
exit(0);
}
};
int main()
{
MyWindow window;
window.show();
}
EOS
system ENV.cxx, "test.cpp", "-o", "test", "-L#{lib}", "-lgosu", "-I#{include}", "-std=c++11"
system "./test"
end
end