2 desc "C++11 library for serialization"
3 homepage "https://uscilab.github.io/cereal/"
4 url "https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.2.tar.gz"
5 sha256 "16a7ad9b31ba5880dac55d62b5d6f243c3ebc8d46a3514149e56b5e7ea81f85f"
7 head "https://github.com/USCiLab/cereal.git", branch: "develop"
11 sha256 cellar: :any_skip_relocation, all: "dd568ffbaa2689d64040eea49404b91b65a33657ea8a6567255fb738185c1199"
14 depends_on "cmake" => :build
17 system "cmake", "-S", ".", "-B", "build", "-DJUST_INSTALL_CEREAL=ON", *std_cmake_args
18 system "cmake", "--build", "build"
19 system "cmake", "--install", "build"
23 (testpath/"test.cpp").write <<~CPP
24 #include <cereal/types/unordered_map.hpp>
25 #include <cereal/types/memory.hpp>
26 #include <cereal/archives/binary.hpp>
34 template <class Archive>
35 void serialize( Archive & ar )
44 std::shared_ptr<std::unordered_map<uint32_t, MyRecord>> data;
46 template <class Archive>
47 void save( Archive & ar ) const
52 template <class Archive>
53 void load( Archive & ar )
55 static int32_t idGen = 0;
63 std::ofstream os("out.cereal", std::ios::binary);
64 cereal::BinaryOutputArchive archive( os );
72 system ENV.cxx, "test.cpp", "-std=c++11", "-I#{include}", "-o", "test"
74 assert_predicate testpath/"out.cereal", :exist?