From 96370b4453814e1672f2c728d629f8490e521409 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 6 Jul 2021 12:02:10 +0200 Subject: [PATCH] (#5987) add pcg-cpp/cci.20210406 --- recipes/pcg-cpp/all/conandata.yml | 4 +++ recipes/pcg-cpp/all/conanfile.py | 34 +++++++++++++++++++ .../pcg-cpp/all/test_package/CMakeLists.txt | 9 +++++ recipes/pcg-cpp/all/test_package/conanfile.py | 17 ++++++++++ .../pcg-cpp/all/test_package/test_package.cpp | 10 ++++++ recipes/pcg-cpp/config.yml | 3 ++ 6 files changed, 77 insertions(+) create mode 100644 recipes/pcg-cpp/all/conandata.yml create mode 100644 recipes/pcg-cpp/all/conanfile.py create mode 100644 recipes/pcg-cpp/all/test_package/CMakeLists.txt create mode 100644 recipes/pcg-cpp/all/test_package/conanfile.py create mode 100644 recipes/pcg-cpp/all/test_package/test_package.cpp create mode 100644 recipes/pcg-cpp/config.yml diff --git a/recipes/pcg-cpp/all/conandata.yml b/recipes/pcg-cpp/all/conandata.yml new file mode 100644 index 00000000000000..19d6cd5450a074 --- /dev/null +++ b/recipes/pcg-cpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20210406": + url: "https://github.com/imneme/pcg-cpp/archive/ffd522e7188bef30a00c74dc7eb9de5faff90092.tar.gz" + sha256: "81e4ab1936971627e6cc49fba279d0891b657d4397fc7940f6e751a37e4fdc94" diff --git a/recipes/pcg-cpp/all/conanfile.py b/recipes/pcg-cpp/all/conanfile.py new file mode 100644 index 00000000000000..73c7d19ead4543 --- /dev/null +++ b/recipes/pcg-cpp/all/conanfile.py @@ -0,0 +1,34 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.33.0" + + +class PcgcppConan(ConanFile): + name = "pcg-cpp" + description = "C++ implementation of the PCG family of random number generators." + license = ("MIT", "Apache-2.0") + topics = ("pcg-cpp", "pcg", "rng", "random") + homepage = "https://github.com/imneme/pcg-cpp" + url = "https://github.com/conan-io/conan-center-index" + settings = "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) diff --git a/recipes/pcg-cpp/all/test_package/CMakeLists.txt b/recipes/pcg-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..33ae887aa6aea3 --- /dev/null +++ b/recipes/pcg-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/pcg-cpp/all/test_package/conanfile.py b/recipes/pcg-cpp/all/test_package/conanfile.py new file mode 100644 index 00000000000000..5216332f39f5ca --- /dev/null +++ b/recipes/pcg-cpp/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pcg-cpp/all/test_package/test_package.cpp b/recipes/pcg-cpp/all/test_package/test_package.cpp new file mode 100644 index 00000000000000..9a061e43f0ebd9 --- /dev/null +++ b/recipes/pcg-cpp/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include +#include + +int main() { + pcg32 rng(pcg_extras::seed_seq_from{}); + std::cout << "RNG used: " << rng << "\n\n"; + return 0; +} diff --git a/recipes/pcg-cpp/config.yml b/recipes/pcg-cpp/config.yml new file mode 100644 index 00000000000000..92120b7e9b6de2 --- /dev/null +++ b/recipes/pcg-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210406": + folder: "all"