Skip to content

Commit

Permalink
(conan-io#5987) add pcg-cpp/cci.20210406
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm authored and AndreyMlashkin committed Jul 19, 2021
1 parent 145b1ee commit 96370b4
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/pcg-cpp/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"cci.20210406":
url: "https://github.com/imneme/pcg-cpp/archive/ffd522e7188bef30a00c74dc7eb9de5faff90092.tar.gz"
sha256: "81e4ab1936971627e6cc49fba279d0891b657d4397fc7940f6e751a37e4fdc94"
34 changes: 34 additions & 0 deletions recipes/pcg-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"))
9 changes: 9 additions & 0 deletions recipes/pcg-cpp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions recipes/pcg-cpp/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
10 changes: 10 additions & 0 deletions recipes/pcg-cpp/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <pcg_random.hpp>

#include <random>
#include <iostream>

int main() {
pcg32 rng(pcg_extras::seed_seq_from<std::random_device>{});
std::cout << "RNG used: " << rng << "\n\n";
return 0;
}
3 changes: 3 additions & 0 deletions recipes/pcg-cpp/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"cci.20210406":
folder: "all"

0 comments on commit 96370b4

Please sign in to comment.