class Spdlog < Formula desc "Super fast C++ logging library" homepage "https://github.com/gabime/spdlog" url "https://github.com/gabime/spdlog/archive/v1.4.1.tar.gz" sha256 "3291958eb54ed942d1bd3aef1b4f8ccf70566cbc04d34296ec61eb96ceb73cff" head "https://github.com/gabime/spdlog.git", :branch => "v1.x" bottle do cellar :any_skip_relocation sha256 "a445742dd150bce375c1106b52ac73db032bb20b701f5beeecdf05621269818e" => :mojave sha256 "941e1d69df2a1c7488c9031fc3ae600af3cc7e8e846c4e0702e6c1559412fe8d" => :high_sierra sha256 "54d5e4fdcf522f0eb4cd2c45317df2c8bcf1271ea996774a721844a26e89760a" => :sierra end depends_on "cmake" => :build def install ENV.cxx11 mkdir "spdlog-build" do args = std_cmake_args args << "-Dpkg_config_libdir=#{lib}" << "-DSPDLOG_BUILD_BENCH=OFF" << "-DSPDLOG_BUILD_TESTS=OFF" << ".." system "cmake", *args system "make", "install" end end test do (testpath/"test.cpp").write <<~EOS #include "spdlog/sinks/basic_file_sink.h" #include #include int main() { try { auto console = spdlog::basic_logger_mt("basic_logger", "#{testpath}/basic-log.txt"); console->info("Test"); } catch (const spdlog::spdlog_ex &ex) { std::cout << "Log init failed: " << ex.what() << std::endl; return 1; } } EOS system ENV.cxx, "-std=c++11", "test.cpp", "-I#{include}", "-o", "test" system "./test" assert_predicate testpath/"basic-log.txt", :exist? assert_match "Test", (testpath/"basic-log.txt").read end end