53 lines
1.6 KiB
Ruby
53 lines
1.6 KiB
Ruby
class Spdlog < Formula
|
|
desc "Super fast C++ logging library"
|
|
homepage "https://github.com/gabime/spdlog"
|
|
url "https://github.com/gabime/spdlog/archive/v1.6.1.tar.gz"
|
|
sha256 "378a040d91f787aec96d269b0c39189f58a6b852e4cbf9150ccfacbe85ebbbfc"
|
|
head "https://github.com/gabime/spdlog.git", :branch => "v1.x"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "63dec5d3109417affd92cad8ed695c389e20da60531bc0b22f13826833ccf9f9" => :catalina
|
|
sha256 "19f5bc7e791fd794467a305039157acafa4d8a209a87ea8c137ce0a2909ee20c" => :mojave
|
|
sha256 "d47ec48d568261f83d2c7b67439b463346fd0ed3038c19392974b6efd9cbfa99" => :high_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 <iostream>
|
|
#include <memory>
|
|
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
|