diff --git a/recipes/rocket/all/conandata.yml b/recipes/rocket/all/conandata.yml new file mode 100644 index 00000000000000..67f145724cf1b4 --- /dev/null +++ b/recipes/rocket/all/conandata.yml @@ -0,0 +1,3 @@ +sources: + "2.0": + commit: "348869fcda83f8b8b521c7654f83fea07ebe7a0a" diff --git a/recipes/rocket/all/conanfile.py b/recipes/rocket/all/conanfile.py new file mode 100644 index 00000000000000..46f70768d613ac --- /dev/null +++ b/recipes/rocket/all/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.files import copy +from conan.tools.scm import Git +import os + +required_conan_version = ">=2.0.0" + +class RocketConan(ConanFile): + name = "rocket" + description = "Fast single header signal/slots library for C++" + license = "public domain" + topics = ("signal-slots", "observer-pattern") + homepage = "https://github.com/tripleslash/rocket" + url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" + + def source(self): + git = Git(self) + git.clone(url="https://github.com/tripleslash/rocket.git", target=".") + git.checkout(**self.conan_data["sources"][self.version]) + + def build(self): + pass + + def package(self): + copy(self, "rocket.hpp", self.build_folder, os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.libs = ["rocket"] \ No newline at end of file diff --git a/recipes/rocket/all/test_package/CMakeLists.txt b/recipes/rocket/all/test_package/CMakeLists.txt new file mode 100644 index 00000000000000..64439cec2dde07 --- /dev/null +++ b/recipes/rocket/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(PackageTest) + +find_package(rocket CONFIG REQUIRED) + +add_executable(example src/example.cpp) +target_link_libraries(example rocket::rocket) \ No newline at end of file diff --git a/recipes/rocket/all/test_package/conanfile.py b/recipes/rocket/all/test_package/conanfile.py new file mode 100644 index 00000000000000..e9bfb8a397d251 --- /dev/null +++ b/recipes/rocket/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class RocketTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def layout(self): + cmake_layout(self) + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindir, "example") + self.run(cmd, env="conanrun") \ No newline at end of file diff --git a/recipes/rocket/all/test_package/src/example.cpp b/recipes/rocket/all/test_package/src/example.cpp new file mode 100644 index 00000000000000..650057e685b63b --- /dev/null +++ b/recipes/rocket/all/test_package/src/example.cpp @@ -0,0 +1,13 @@ +#include + +#include "rocket.hpp" + +int main() +{ + rocket::signal test; + test.connect([](int x) + { return x * 3; }); + + constexpr int value = 2; + return test(value) == value*3 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/rocket/config.yml b/recipes/rocket/config.yml new file mode 100644 index 00000000000000..714f48cddc003c --- /dev/null +++ b/recipes/rocket/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0": + folder: "all"