Skip to content

Commit 1477c08

Browse files
authored
Merge pull request #881 from SpaceIm/add-cereal-1.3.0
add cereal/1.3.0
2 parents cb12fa8 + ff361d1 commit 1477c08

File tree

7 files changed

+109
-0
lines changed

7 files changed

+109
-0
lines changed

recipes/cereal/all/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 2.8.11)
2+
project(cmake_wrapper)
3+
4+
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
5+
conan_basic_setup()
6+
7+
add_subdirectory("source_subfolder")

recipes/cereal/all/conandata.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"1.3.0":
3+
url: "https://github.com/USCiLab/cereal/archive/v1.3.0.tar.gz"
4+
sha256: "329ea3e3130b026c03a4acc50e168e7daff4e6e661bc6a7dfec0d77b570851d5"

recipes/cereal/all/conanfile.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import os
2+
3+
from conans import ConanFile, CMake, tools
4+
5+
class CerealConan(ConanFile):
6+
name = "cereal"
7+
description = "Serialization header-only library for C++11."
8+
license = "BSD-3-Clause"
9+
topics = ("conan", "cereal", "header-only", "serialization", "cpp11")
10+
homepage = "https://github.com/USCiLab/cereal"
11+
url = "https://github.com/conan-io/conan-center-index"
12+
exports_sources = "CMakeLists.txt"
13+
generators = "cmake"
14+
settings = "os"
15+
options = {"thread_safe": [True, False]}
16+
default_options = {"thread_safe": False}
17+
no_copy_source = True
18+
19+
@property
20+
def _source_subfolder(self):
21+
return "source_subfolder"
22+
23+
def source(self):
24+
tools.get(**self.conan_data["sources"][self.version])
25+
os.rename(self.name + "-" + self.version, self._source_subfolder)
26+
27+
def package(self):
28+
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
29+
cmake = CMake(self)
30+
cmake.definitions["JUST_INSTALL_CEREAL"] = True
31+
cmake.configure()
32+
cmake.install()
33+
tools.rmdir(os.path.join(self.package_folder, "share"))
34+
35+
def package_id(self):
36+
self.info.header_only()
37+
38+
def package_info(self):
39+
if self.options.thread_safe:
40+
self.cpp_info.defines = ["CEREAL_THREAD_SAFE=1"]
41+
if self.settings.os == "Linux":
42+
self.cpp_info.system_libs.append("pthread")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cmake_minimum_required(VERSION 2.8.11)
2+
project(test_package)
3+
4+
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
5+
conan_basic_setup()
6+
7+
add_executable(${PROJECT_NAME} test_package.cpp)
8+
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
9+
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
3+
from conans import ConanFile, CMake, tools
4+
5+
class TestPackageConan(ConanFile):
6+
settings = "os", "compiler", "build_type", "arch"
7+
generators = "cmake"
8+
9+
def build(self):
10+
cmake = CMake(self)
11+
cmake.configure()
12+
cmake.build()
13+
14+
def test(self):
15+
if not tools.cross_building(self.settings):
16+
bin_path = os.path.join("bin", "test_package")
17+
self.run(bin_path, run_environment=True)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <cstdlib>
2+
#include <iostream>
3+
4+
#include <cereal/archives/binary.hpp>
5+
6+
7+
struct Data
8+
{
9+
int x, y, z;
10+
template<class Archive>
11+
void serialize(Archive & archive) { archive( x, y, z ); }
12+
};
13+
14+
15+
int main() {
16+
std::cout << "Serialized data: ";
17+
{
18+
cereal::BinaryOutputArchive oarchive(std::cout);
19+
Data d1{42, 12, 52};
20+
Data d2{33, 34, 35};
21+
Data d3{74, 34, 45};
22+
oarchive(d1, d2, d3);
23+
}
24+
std::cout << std::endl;
25+
26+
return EXIT_SUCCESS;
27+
}

recipes/cereal/config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"1.3.0":
3+
folder: all

0 commit comments

Comments
 (0)