forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#22490) Add rotor v0.28, v0.29
* Add rotor v0.28 * Feedback: remove exports_sources * Update receipe * Try to use boost 1.84 * refine cppstd validation Signed-off-by: Uilian Ries <uilianries@gmail.com> * Fix test_package/conanfile.py * Add v0.29 * Add v0.29 * Add test_v1_package --------- Signed-off-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Uilian Ries <uilianries@gmail.com>
- Loading branch information
1 parent
4b480c6
commit f48eeb7
Showing
8 changed files
with
153 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
find_package("rotor" REQUIRED) | ||
find_package("rotor" COMPONENTS asio thread REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) | ||
target_link_libraries(${PROJECT_NAME} rotor::core) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
|
||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package CXX) | ||
|
||
find_package("rotor" COMPONENTS asio thread REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) | ||
target_link_libraries(${PROJECT_NAME} rotor::core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#include <rotor/supervisor.h> | ||
#include <iostream> | ||
|
||
|
||
namespace { | ||
namespace to { | ||
struct on_timer_trigger {}; | ||
} // namespace to | ||
} // namespace | ||
|
||
namespace rotor { | ||
template <> | ||
inline auto rotor::actor_base_t::access<to::on_timer_trigger, request_id_t, bool>(request_id_t request_id, | ||
bool cancelled) noexcept { | ||
on_timer_trigger(request_id, cancelled); | ||
} | ||
} // namespace rotor | ||
|
||
struct dummy_supervisor_t : public rotor::supervisor_t { | ||
using rotor::supervisor_t::supervisor_t; | ||
using timers_map_t = std::unordered_map<rotor::request_id_t, rotor::timer_handler_base_t *>; | ||
|
||
timers_map_t timers_map; | ||
|
||
void do_start_timer(const rotor::pt::time_duration &, rotor::timer_handler_base_t &handler) noexcept override { | ||
timers_map.emplace(handler.request_id, &handler); | ||
} | ||
|
||
void do_cancel_timer(rotor::request_id_t timer_id) noexcept override { | ||
auto it = timers_map.find(timer_id); | ||
auto &actor_ptr = it->second->owner; | ||
actor_ptr->access<to::on_timer_trigger, rotor::request_id_t, bool>(timer_id, true); | ||
timers_map.erase(it); | ||
} | ||
|
||
void start() noexcept override {} | ||
void shutdown() noexcept override {} | ||
void enqueue(rotor::message_ptr_t) noexcept override {} | ||
}; | ||
|
||
struct hello_actor : public rotor::actor_base_t { | ||
using rotor::actor_base_t::actor_base_t; | ||
void on_start() noexcept override { | ||
rotor::actor_base_t::on_start(); | ||
std::cout << "hello world\n"; | ||
supervisor->do_shutdown(); | ||
} | ||
}; | ||
|
||
int main() { | ||
rotor::system_context_t ctx{}; | ||
auto timeout = boost::posix_time::milliseconds{500}; /* does not matter */ | ||
auto sup = ctx.create_supervisor<dummy_supervisor_t>().timeout(timeout).finish(); | ||
sup->create_actor<hello_actor>().timeout(timeout).finish(); | ||
sup->do_process(); | ||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ versions: | |
folder: all | ||
"0.25": | ||
folder: all | ||
"0.28": | ||
folder: all | ||
"0.29": | ||
folder: all |