EventBus/CMakeLists.txt
Dawid Drozd fc1dbe335f Update EventBus to 2.1.0 inspired by Boost::MSM
I was wondering if it is a good step for EventBus. Of course, it will break back
compatibility again as well as it was when changing v1 -> v2, but this change is
smaller. Those changes were inspired by Boost::MSM how it handles events.

Why i decided to change:

+ It will prevent from bugs like typo in Event string eg. Event<int>{"text"}
+ If we want to change signature of Event, we won't have to update all listeners
and their signature
+ Less includes for listener. Simply in our class header we will have eg.
pointer/ref to event type not to all args
+ Strongly typed (this is always better)
+ Storing event for future reuse
+ More easy to introduce thread safe EventBus in future
+ EventBus is more simple
+ const Event forbids some kind of communication. Eg. passing and modifying
reference
+ Less errors when using std::bind

- Breaking back compatibility
- Need fixes in projects that using this lib
- Someone can add methods etc. to Event :(
- We can't generate easily multiple "types" of events like in 'for' loop
- Worst performance (still not such bad as CCNotificationCenter)
2017-08-26 13:28:45 +02:00

51 lines
1.2 KiB
CMake

CMAKE_MINIMUM_REQUIRED(VERSION 3.2 FATAL_ERROR)
# BUILD_SHARED_LIBS can controll build type!
PROJECT(EventBus
VERSION 2.1.0
LANGUAGES CXX
)
ADD_LIBRARY(EventBus
src/eventbus/EventCollector.cpp include/eventbus/EventCollector.h
include/eventbus/EventBus.h
)
ADD_LIBRARY(Dexode::EventBus ALIAS EventBus)
TARGET_INCLUDE_DIRECTORIES(EventBus PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
$<INSTALL_INTERFACE:include/>
PRIVATE src/
)
TARGET_COMPILE_OPTIONS(EventBus
PRIVATE -Wall -pedantic -Wno-unused-private-field -Wnon-virtual-dtor -Wno-gnu
-Werror
)
SET_TARGET_PROPERTIES(EventBus PROPERTIES
CXX_STANDARD 14
)
TARGET_COMPILE_FEATURES(EventBus
PUBLIC cxx_auto_type cxx_variadic_templates
)
INSTALL(TARGETS EventBus EXPORT EventBusConfig
ARCHIVE DESTINATION lib/
LIBRARY DESTINATION lib/
RUNTIME DESTINATION bin/
INCLUDES DESTINATION include/
)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/ FILES_MATCHING PATTERN "*.h*")
INSTALL(EXPORT EventBusConfig
DESTINATION cmake/
NAMESPACE Dexode::
)
EXPORT(TARGETS EventBus FILE EventBusConfig.cmake)
ENABLE_TESTING()
ADD_SUBDIRECTORY(test/)
ADD_SUBDIRECTORY(performance/)