Skip to content

Commit

Permalink
add package for the rocket library
Browse files Browse the repository at this point in the history
  • Loading branch information
Slashcash authored and geniorio committed Sep 25, 2023
1 parent dbc177b commit 590e9fd
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 0 deletions.
3 changes: 3 additions & 0 deletions recipes/rocket/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sources:
"2.0":
commit: "348869fcda83f8b8b521c7654f83fea07ebe7a0a"
29 changes: 29 additions & 0 deletions recipes/rocket/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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"]
7 changes: 7 additions & 0 deletions recipes/rocket/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions recipes/rocket/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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")
13 changes: 13 additions & 0 deletions recipes/rocket/all/test_package/src/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <cstdlib>

#include "rocket.hpp"

int main()
{
rocket::signal<int(int)> test;
test.connect([](int x)
{ return x * 3; });

constexpr int value = 2;
return test(value) == value*3 ? EXIT_SUCCESS : EXIT_FAILURE;
}
3 changes: 3 additions & 0 deletions recipes/rocket/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"2.0":
folder: "all"

0 comments on commit 590e9fd

Please sign in to comment.