Skip to content

Commit

Permalink
Add eventpp package (#574)
Browse files Browse the repository at this point in the history
Co-authored-by: Seb Horsewell <[email protected]>
  • Loading branch information
bazfp and Seb Horsewell authored Jun 9, 2022
1 parent 123a702 commit 4e8f299
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmake/configs/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ hunter_default_version(entityx VERSION 1.3.0-p1)
hunter_default_version(eos VERSION 0.12.1)
hunter_default_version(etc2comp VERSION 0.0.0-9cd0f9c-p0)
hunter_default_version(ethash VERSION 0.9.0)
hunter_default_version(eventpp VERSION 0.1.2-for-hunter-pm)
hunter_default_version(farmhash VERSION 1.1)
hunter_default_version(fast_obj VERSION 1.1-9255172-p0)
hunter_default_version(ffmpeg VERSION n4.1-dev-45499e557c-p7)
Expand Down
26 changes: 26 additions & 0 deletions cmake/projects/eventpp/hunter.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2022
# All rights reserved.

# !!! DO NOT PLACE HEADER GUARDS HERE !!!

include(hunter_add_version)
include(hunter_cacheable)
include(hunter_cmake_args)
include(hunter_download)
include(hunter_pick_scheme)
include(hunter_source_subdir)

hunter_add_version(
PACKAGE_NAME
eventpp
VERSION
"0.1.2-for-hunter-pm"
URL
"https://github.com/wqking/eventpp/archive/refs/tags/v0.1.2-for-hunter-pm.tar.gz"
SHA1
0b3d8408c0f5868dfc35b9cd05b0a2da823b73bf
)

hunter_pick_scheme(DEFAULT url_sha1_cmake)
hunter_cacheable(eventpp)
hunter_download(PACKAGE_NAME eventpp)
19 changes: 19 additions & 0 deletions docs/packages/pkg/eventpp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. spelling::

eventpp

.. index:: messaging ; eventpp

.. _pkg.eventpp:

eventpp
=======

- `Official <https://github.com/wqking/eventpp>`__
- `Example <https://github.com/cpp-pm/hunter/blob/master/examples/eventpp/CMakeLists.txt>`__
- Added by `bazfp <https://github.com/bazfp>`__

.. literalinclude:: /../examples/eventpp/CMakeLists.txt
:language: cmake
:start-after: # DOCUMENTATION_START {
:end-before: # DOCUMENTATION_END }
19 changes: 19 additions & 0 deletions examples/eventpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2022
# All rights reserved.

cmake_minimum_required(VERSION 3.0)

# Emulate HunterGate:
# * https://github.com/hunter-packages/gate
include("../common.cmake")

project(eventpp-example)

# DOCUMENTATION_START {
hunter_add_package(eventpp)
find_package(eventpp CONFIG REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main eventpp::eventpp)
include_directories(${EVENTPP_INCLUDE_DIR})
# DOCUMENTATION_END }
14 changes: 14 additions & 0 deletions examples/eventpp/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <eventpp/eventdispatcher.h>
#include <eventpp/callbacklist.h>

#include <iostream>

int main()
{
eventpp::EventDispatcher<int, void()> dispatcher;
dispatcher.appendListener(3, []()
{ std::cout << "Got event 3." << std::endl; });
// dispatch event 3
dispatcher.dispatch(3);
return 0;
}

0 comments on commit 4e8f299

Please sign in to comment.