class Libosmium < Formula
desc "Fast and flexible C++ library for working with OpenStreetMap data."
homepage "http://osmcode.org/libosmium/"
url "https://github.com/osmcode/libosmium/archive/v2.12.1.tar.gz"
sha256 "7e83f9b7af3195dd0eafae7d3c572ef90e4c9409ed6c3f96635fa75603aa6538"
bottle do
cellar :any_skip_relocation
sha256 "84d82f574141dbad3f6b6eac5c043a36f981ae54c66851349e119e8d5aaaee3c" => :sierra
sha256 "5a6f073a64828c6018db7fe89e0902287ed7d4fdf28b97fd9e870576f5a3b099" => :el_capitan
sha256 "5a6f073a64828c6018db7fe89e0902287ed7d4fdf28b97fd9e870576f5a3b099" => :yosemite
end
depends_on "cmake" => :build
depends_on "boost" => :build
depends_on "google-sparsehash" => :optional
depends_on "expat" => :optional
depends_on "gdal" => :optional
depends_on "proj" => :optional
depends_on "doxygen" => :optional
def install
mkdir "build" do
system "cmake", *std_cmake_args, "-DINSTALL_GDALCPP=ON", "-DINSTALL_PROTOZERO=ON", "-DINSTALL_UTFCPP=ON", ".."
system "make", "install"
end
end
test do
(testpath/"test.osm").write <<-EOS.undent
EOS
(testpath/"test.cpp").write <<-EOS.undent
#include
#include
#include
int main(int argc, char* argv[]) {
osmium::io::File input_file{argv[1]};
osmium::io::Reader reader{input_file};
while (osmium::memory::Buffer buffer = reader.read()) {}
reader.close();
}
EOS
system ENV.cxx, "-std=c++11", "-stdlib=libc++", "-lexpat", "-o", "libosmium_read", "test.cpp"
system "./libosmium_read", "test.osm"
end
end