Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add erikzenker-hsm/1.4.7 #6805

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8e6dedc
Add hsm/1.4.7
erikzenker Aug 10, 2021
ff60a71
Update recipes/hsm/all/conandata.yml
SSE4 Sep 26, 2021
d0062f1
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
e97d770
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
91c023f
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
81e7beb
Update recipes/hsm/all/test_package/CMakeLists.txt
SSE4 Sep 26, 2021
52971a5
Update recipes/hsm/all/test_package/CMakeLists.txt
SSE4 Sep 26, 2021
4222f29
Update recipes/hsm/all/test_package/conanfile.py
SSE4 Sep 26, 2021
d9960fb
Update recipes/hsm/all/test_package/conanfile.py
SSE4 Sep 26, 2021
a1a0704
Update recipes/hsm/all/test_package/conanfile.py
SSE4 Sep 26, 2021
0ed8fb0
Update recipes/hsm/all/test_package/example.cpp
SSE4 Sep 26, 2021
ac1b130
Update recipes/hsm/config.yml
SSE4 Sep 26, 2021
8f170f6
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
dc641bb
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
26e681e
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
56433ec
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
57782e9
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
8a73818
Update recipes/hsm/all/test_package/CMakeLists.txt
SSE4 Sep 26, 2021
3d98c6b
Update recipes/hsm/all/test_package/CMakeLists.txt
SSE4 Sep 26, 2021
46a6007
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
11a1b2f
Update recipes/hsm/all/conanfile.py
SSE4 Sep 26, 2021
3c5157c
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
b991706
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
beef119
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
bd0dbbf
Update recipes/hsm/all/test_package/CMakeLists.txt
SSE4 Oct 4, 2021
f3e12bd
Update recipes/hsm/all/test_package/conanfile.py
SSE4 Oct 4, 2021
21afee2
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
d5ae910
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
2da87ff
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
2aed9e8
Update recipes/hsm/all/test_package/CMakeLists.txt
SSE4 Oct 4, 2021
b3510b7
Update recipes/hsm/all/test_package/conanfile.py
SSE4 Oct 4, 2021
2b2ec99
Update recipes/hsm/all/conanfile.py
SSE4 Oct 4, 2021
a8daecf
- move
SSE4 Oct 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/erikzenker-hsm/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.4.7":
sha256: e56fd4a71337448727dbb9e2abe18992224d496a7ab5567030d6717a00680364
url: https://github.com/erikzenker/hsm/archive/refs/tags/v1.4.7.tar.gz
49 changes: 49 additions & 0 deletions recipes/erikzenker-hsm/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from conans import ConanFile, CMake, tools
from conans.errors import ConanInvalidConfiguration
from conans.tools import Version
import os

required_conan_version = ">=1.33.0"

class HsmConan(ConanFile):
name = "erikzenker-hsm"
license = "MIT"
homepage = "https://github.com/erikzenker/hsm.git"
url = "https://github.com/conan-io/conan-center-index"
description = "The hana state machine (hsm) is a finite state machine library based on the boost hana meta programming library. It follows the principles of the boost msm and boost sml libraries, but tries to reduce own complex meta programming code to a minimum."
topics = ("state-machine", "template-meta-programming")
requires = "boost/1.77.0"
no_copy_source = True
generators = "cmake"
settings = "os", "arch", "build_type", "compiler"

@property
def _source_subfolder(self):
return "source_subfolder"

def validate(self):
# https://github.com/erikzenker/hsm#dependencies
if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < 8:
raise ConanInvalidConfiguration("clang 8+ is required")
if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 8:
raise ConanInvalidConfiguration("GCC 8+ is required")

def source(self):
tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True)

def build(self):
cmake = CMake(self)
cmake.configure(source_folder=self._source_subfolder)

def package(self):
cmake = CMake(self)
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
self.copy("LICENSE", src=self._source_subfolder, dst="licenses")

def package_id(self):
self.info.header_only()

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "hsm"
self.cpp_info.names["cmake_find_package_multi"] = "hsm"
13 changes: 13 additions & 0 deletions recipes/erikzenker-hsm/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.1)
project(PackageTest CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(hsm CONFIG REQUIRED)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(example example.cpp)
target_link_libraries(example hsm::hsm)
19 changes: 19 additions & 0 deletions recipes/erikzenker-hsm/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os

from conans import ConanFile, CMake, tools


class HsmTestConan(ConanFile):
settings = "cppstd", "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package_multi"

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", "example")
self.run(bin_path, run_environment=True)
62 changes: 62 additions & 0 deletions recipes/erikzenker-hsm/all/test_package/example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "hsm/hsm.h"

#include <iostream>
#include <cassert>

// States
struct Locked {
};
struct Unlocked {
};

// Events
struct Push {
};
struct Coin {
};

// Guards
const auto noError = [](auto /*event*/, auto /*source*/, auto /*target*/) { return true; };

// Actions
constexpr auto beep
= [](auto /*event*/, auto /*source*/, auto /*target*/) { std::cout << "beep!" << std::endl; };
constexpr auto blink = [](auto /*event*/, auto /*source*/, auto /*target*/) {
std::cout << "blink, blink, blink!" << std::endl;
};

struct Turnstile {
static constexpr auto make_transition_table()
{
// clang-format off
return hsm::transition_table(
// Source + Event [Guard] / Action = Target
// +-------------------+-----------------+---------+--------+----------------------+
* hsm::state<Locked> + hsm::event<Push> / beep = hsm::state<Locked> ,
hsm::state<Locked> + hsm::event<Coin> [noError] / blink = hsm::state<Unlocked>,
// +--------------------+---------------------+---------+--------+------------------------+
hsm::state<Unlocked> + hsm::event<Push> [noError] = hsm::state<Locked> ,
hsm::state<Unlocked> + hsm::event<Coin> / blink = hsm::state<Unlocked>
// +--------------------+---------------------+---------+--------+------------------------+
);
// clang-format on
}
};

auto main() -> int
{
hsm::sm<Turnstile> turnstileSm;

// The turnstile is initially locked
assert(turnstileSm.is(hsm::state<Locked>));

// Inserting a coin unlocks it
turnstileSm.process_event(Coin {});
assert(turnstileSm.is(hsm::state<Unlocked>));

// Entering the turnstile will lock it again
turnstileSm.process_event(Push {});
assert(turnstileSm.is(hsm::state<Locked>));

return 0;
}
3 changes: 3 additions & 0 deletions recipes/erikzenker-hsm/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.4.7":
folder: all