homebrew-core/Formula/parallel-hashmap.rb

47 lines
1.4 KiB
Ruby

class ParallelHashmap < Formula
desc "Family of header-only, fast, memory-friendly C++ hashmap and btree containers"
homepage "https://greg7mdp.github.io/parallel-hashmap/"
url "https://github.com/greg7mdp/parallel-hashmap/archive/1.33.tar.gz"
sha256 "f6e4d0508c4d935fa25dcbaec63fbe0d7503435797e275ec109e8a3f1462a4cd"
license "Apache-2.0"
head "https://github.com/greg7mdp/parallel-hashmap.git"
bottle do
sha256 cellar: :any_skip_relocation, all: "a85127ad3dc77cf767da692834eb0e572631f1fc81c981f6060ac0961fd59134"
end
depends_on "cmake" => :build
def install
system "cmake", ".", *std_cmake_args
system "make", "install"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <iostream>
#include <string>
#include <parallel_hashmap/phmap.h>
using phmap::flat_hash_map;
int main() {
flat_hash_map<std::string, std::string> examples =
{
{"foo", "a"},
{"bar", "b"}
};
for (const auto& n : examples)
std::cout << n.first << ":" << n.second << std::endl;
examples["baz"] = "c";
std::cout << "baz:" << examples["baz"] << std::endl;
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", "-I#{include}"
assert_equal "foo:a\nbar:b\nbaz:c\n", shell_output("./test")
end
end