Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
7bce1d66
Unverified
Commit
7bce1d66
authored
Apr 15, 2020
by
Dominik Charousset
Committed by
GitHub
Apr 15, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1087
Modernize CMake setup
parents
8f025383
60e87a05
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
814 additions
and
1223 deletions
+814
-1223
CMakeLists.txt
CMakeLists.txt
+182
-476
Jenkinsfile
Jenkinsfile
+14
-8
cmake/build_config.hpp.in
cmake/build_config.hpp.in
+1
-3
configure
configure
+225
-362
examples/CMakeLists.txt
examples/CMakeLists.txt
+93
-105
examples/aout.cpp
examples/aout.cpp
+0
-1
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+163
-140
libcaf_core/caf/raise_error.hpp
libcaf_core/caf/raise_error.hpp
+13
-13
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+10
-10
libcaf_core/caf/typed_actor_view.hpp
libcaf_core/caf/typed_actor_view.hpp
+2
-2
libcaf_core/src/blocking_actor.cpp
libcaf_core/src/blocking_actor.cpp
+1
-1
libcaf_core/src/scheduled_actor.cpp
libcaf_core/src/scheduled_actor.cpp
+12
-12
libcaf_core/test/custom_exception_handler.cpp
libcaf_core/test/custom_exception_handler.cpp
+3
-9
libcaf_io/CMakeLists.txt
libcaf_io/CMakeLists.txt
+46
-37
libcaf_openssl/CMakeLists.txt
libcaf_openssl/CMakeLists.txt
+38
-31
tools/CMakeLists.txt
tools/CMakeLists.txt
+11
-13
No files found.
CMakeLists.txt
View file @
7bce1d66
This diff is collapsed.
Click to expand it.
Jenkinsfile
View file @
7bce1d66
...
...
@@ -4,14 +4,14 @@
// Default CMake flags for release builds.
defaultReleaseBuildFlags
=
[
'CAF_ENABLE_RUNTIME_CHECKS:BOOL=
yes
'
,
'CAF_ENABLE_RUNTIME_CHECKS:BOOL=
ON
'
,
]
// Default CMake flags for debug builds.
defaultDebugBuildFlags
=
defaultReleaseBuildFlags
+
[
'CAF_SANITIZERS:STRING=address,undefined'
,
'CAF_LOG_LEVEL:STRING=TRACE'
,
'CAF_ENABLE_ACTOR_PROFILER:BOOL=
yes
'
,
'CAF_ENABLE_ACTOR_PROFILER:BOOL=
ON
'
,
]
// Configures the behavior of our stages.
...
...
@@ -28,10 +28,6 @@ config = [
// Our build matrix. Keys are the operating system labels and values are build configurations.
buildMatrix:
[
// Various Linux builds for debug and release.
[
'debian-8'
,
[
builds:
[
'debug'
,
'release'
],
tools:
[
'clang-4'
],
]],
[
'centos-6'
,
[
builds:
[
'debug'
,
'release'
],
tools:
[
'gcc-7'
],
...
...
@@ -97,12 +93,20 @@ config = [
'OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include'
,
],
],
Windows:
[
debug:
defaultDebugBuildFlags
+
[
'CAF_ENABLE_OPENSSL_MODULE:BOOL=OFF'
,
],
release:
defaultReleaseBuildFlags
+
[
'CAF_ENABLE_OPENSSL_MODULE:BOOL=OFF'
,
],
],
],
// Configures what binary the coverage report uses and what paths to exclude.
coverage:
[
binaries:
[
'build/
bin
/caf-core-test'
,
'build/
bin
/caf-io-test'
,
'build/
libcaf_core
/caf-core-test'
,
'build/
libcaf_io
/caf-io-test'
,
],
relativeExcludePaths:
[
'examples'
,
...
...
@@ -151,6 +155,8 @@ pipeline {
buildDir:
'build'
,
installation:
'cmake in search path'
,
sourceDir:
'.'
,
cmakeArgs:
'-DCAF_ENABLE_IO_MODULE:BOOL=OFF '
+
'-DCAF_ENABLE_UTILITY_TARGETS:BOOL=ON'
,
steps:
[[
args:
'--target consistency-check'
,
withCmake:
true
,
...
...
cmake/build_config.hpp.in
View file @
7bce1d66
...
...
@@ -25,10 +25,8 @@
#define CAF_LOG_LEVEL CAF_LOG_LEVEL_@CAF_LOG_LEVEL@
#cmakedefine CAF_NO_MEM_MANAGEMENT
#cmakedefine CAF_ENABLE_RUNTIME_CHECKS
#cmakedefine CAF_
NO
_EXCEPTIONS
#cmakedefine CAF_
ENABLE
_EXCEPTIONS
#cmakedefine CAF_ENABLE_ACTOR_PROFILER
configure
View file @
7bce1d66
This diff is collapsed.
Click to expand it.
examples/CMakeLists.txt
View file @
7bce1d66
add_custom_target
(
all_examples
)
include_directories
(
${
LIBCAF_INCLUDE_DIRS
}
)
macro
(
add folder name
)
function
(
add_example folder name
)
add_executable
(
${
name
}
${
folder
}
/
${
name
}
.cpp
${
ARGN
}
)
target_link_libraries
(
${
name
}
${
CAF_EXTRA_LDFLAGS
}
${
CAF_LIBRARIES
}
${
PTHREAD_LIBRARIES
}
)
install
(
FILES
${
folder
}
/
${
name
}
.cpp DESTINATION
${
CMAKE_INSTALL_DATADIR
}
/caf/examples/
${
folder
}
)
add_dependencies
(
${
name
}
all_examples
)
endmacro
()
endfunction
()
function
(
add_core_example folder name
)
add_example
(
${
folder
}
${
name
}
${
ARGN
}
)
target_link_libraries
(
${
name
}
CAF::core
)
endfunction
()
# -- examples for CAF::core ----------------------------------------------------
# introductionary applications
add
(
. aout
)
add
(
. hello_world
)
add
_core_example
(
. aout
)
add
_core_example
(
. hello_world
)
# basic message passing primitives
add
(
message_passing calculator
)
add
(
message_passing cell
)
add
(
message_passing dancing_kirby
)
add
(
message_passing delegating
)
add
(
message_passing divider
)
add
(
message_passing fan_out_request
)
add
(
message_passing fixed_stack
)
add
(
message_passing promises
)
add
(
message_passing request
)
add
(
message_passing typed_calculator
)
add
_core_example
(
message_passing calculator
)
add
_core_example
(
message_passing cell
)
add
_core_example
(
message_passing dancing_kirby
)
add
_core_example
(
message_passing delegating
)
add
_core_example
(
message_passing divider
)
add
_core_example
(
message_passing fan_out_request
)
add
_core_example
(
message_passing fixed_stack
)
add
_core_example
(
message_passing promises
)
add
_core_example
(
message_passing request
)
add
_core_example
(
message_passing typed_calculator
)
# streaming API
add
(
streaming integer_stream
)
add
_core_example
(
streaming integer_stream
)
# dynamic behavior changes using 'become'
add
(
dynamic_behavior skip_messages
)
add
(
dynamic_behavior dining_philosophers
)
add
_core_example
(
dynamic_behavior skip_messages
)
add
_core_example
(
dynamic_behavior dining_philosophers
)
# adding custom message types
add
(
custom_type custom_types_1
)
add
(
custom_type custom_types_2
)
add
(
custom_type custom_types_3
)
add
_core_example
(
custom_type custom_types_1
)
add
_core_example
(
custom_type custom_types_2
)
add
_core_example
(
custom_type custom_types_3
)
# basic remoting
add
(
remoting group_chat
)
add
(
remoting group_server
)
add
(
remoting remote_spawn
)
add
(
remoting distributed_calculator
)
# testing DSL
add_example
(
testing ping_pong
)
target_link_libraries
(
ping_pong CAF::core CAF::test
)
# basic I/O with brokers
add
(
broker simple_broker
)
add
(
broker simple_http_broker
)
# testing DSL
add
(
testing ping_pong
)
if
(
CAF_BUILD_PROTOBUF_EXAMPLES
)
find_package
(
Protobuf
)
if
(
PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE
)
PROTOBUF_GENERATE_CPP
(
ProtoSources ProtoHeaders
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/remoting/pingpong.proto"
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
# add binary dir as include path as generated headers will be located there
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_executable
(
protobuf_broker broker/protobuf_broker.cpp
${
ProtoSources
}
)
target_link_libraries
(
protobuf_broker
${
CMAKE_DL_LIBS
}
${
CAF_LIBRARIES
}
${
PTHREAD_LIBRARIES
}
${
PROTOBUF_LIBRARIES
}
)
add_dependencies
(
protobuf_broker all_examples
)
endif
(
PROTOBUF_FOUND AND PROTOBUF_PROTOC_EXECUTABLE
)
# -- examples for CAF::io ------------------------------------------------------
if
(
TARGET CAF::io
)
function
(
add_io_example folder name
)
add_example
(
${
folder
}
${
name
}
${
ARGN
}
)
target_link_libraries
(
${
name
}
CAF::io CAF::core
)
endfunction
()
# basic remoting
add_io_example
(
remoting group_chat
)
add_io_example
(
remoting group_server
)
add_io_example
(
remoting remote_spawn
)
add_io_example
(
remoting distributed_calculator
)
# basic I/O with brokers
add_io_example
(
broker simple_broker
)
add_io_example
(
broker simple_http_broker
)
endif
()
if
(
CAF_BUILD_QT_EXAMPLES
)
find_package
(
Qt5 COMPONENTS Core Gui Widgets QUIET
)
if
(
Qt5_FOUND
)
message
(
STATUS
"Found Qt5"
)
#include(${QT_USE_FILE})
QT5_ADD_RESOURCES
(
GROUP_CHAT_RCS
)
QT5_WRAP_UI
(
GROUP_CHAT_UI_HDR qtsupport/chatwindow.ui
)
QT5_WRAP_CPP
(
GROUP_CHAT_MOC_SRC qtsupport/chatwidget.hpp
)
# generated headers will be in cmake build directory
#include_directories(. qtsupport ${CMAKE_CURRENT_BINARY_DIR} ${CPPA_INCLUDE})
include_directories
(
qtsupport
${
CMAKE_CURRENT_BINARY_DIR
}
${
Qt5Core_INCLUDE_DIRS
}
${
Qt5Gui_INCLUDE_DIRS
}
${
Qt5Widgets_INCLUDE_DIRS
}
)
set
(
GROUP_CHAT_SRC qtsupport/qt_group_chat.cpp qtsupport/chatwidget.cpp
)
add_executable
(
qt_group_chat
${
GROUP_CHAT_SRC
}
${
GROUP_CHAT_MOC_SRC
}
${
GROUP_CHAT_UI_HDR
}
)
target_link_libraries
(
qt_group_chat
${
CMAKE_DL_LIBS
}
${
CAF_LIBRARIES
}
Qt5::Core
Qt5::Gui
Qt5::Widgets
)
add_dependencies
(
qt_group_chat all_examples
)
else
()
find_package
(
Qt4
)
if
(
QT4_FOUND
)
message
(
STATUS
"Found Qt4"
)
include
(
${
QT_USE_FILE
}
)
QT4_ADD_RESOURCES
(
GROUP_CHAT_RCS
)
QT4_WRAP_UI
(
GROUP_CHAT_UI_HDR qtsupport/chatwindow.ui
)
QT4_WRAP_CPP
(
GROUP_CHAT_MOC_SRC qtsupport/chatwidget.hpp
)
# generated headers will be in cmake build directory
#include_directories(. qtsupport ${CMAKE_CURRENT_BINARY_DIR} ${CPPA_INCLUDE})
include_directories
(
qtsupport
${
CMAKE_CURRENT_BINARY_DIR
}
)
set
(
GROUP_CHAT_SRCS qtsupport/qt_group_chat.cpp qtsupport/chatwidget.cpp
)
add_executable
(
qt_group_chat
${
GROUP_CHAT_SRCS
}
${
GROUP_CHAT_MOC_SRC
}
${
GROUP_CHAT_UI_HDR
}
)
target_link_libraries
(
qt_group_chat
${
CMAKE_DL_LIBS
}
${
CAF_LIBRARIES
}
${
QT_LIBRARIES
}
)
add_dependencies
(
qt_group_chat all_examples
)
endif
()
if
(
CAF_ENABLE_PROTOBUF_EXAMPLES
)
find_package
(
Protobuf REQUIRED
)
if
(
NOT PROTOBUF_PROTOC_EXECUTABLE
)
message
(
FATAL_ERROR
"CMake was unable to set PROTOBUF_PROTOC_EXECUTABLE"
)
endif
()
protobuf_generate_cpp
(
ProtoSources ProtoHeaders
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/remoting/pingpong.proto"
)
include_directories
(
${
PROTOBUF_INCLUDE_DIR
}
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
add_executable
(
protobuf_broker broker/protobuf_broker.cpp
${
ProtoSources
}
)
target_link_libraries
(
protobuf_broker
${
PROTOBUF_LIBRARIES
}
CAF::core CAF::io
)
add_dependencies
(
protobuf_broker all_examples
)
endif
()
if
(
CAF_ENABLE_QT5_EXAMPLES
)
find_package
(
Qt5 COMPONENTS Core Gui Widgets REQUIRED
)
message
(
STATUS
"Found Qt5"
)
#include(${QT_USE_FILE})
QT5_ADD_RESOURCES
(
GROUP_CHAT_RCS
)
QT5_WRAP_UI
(
GROUP_CHAT_UI_HDR qtsupport/chatwindow.ui
)
QT5_WRAP_CPP
(
GROUP_CHAT_MOC_SRC qtsupport/chatwidget.hpp
)
# generated headers will be in cmake build directory
include_directories
(
qtsupport
${
CMAKE_CURRENT_BINARY_DIR
}
${
Qt5Core_INCLUDE_DIRS
}
${
Qt5Gui_INCLUDE_DIRS
}
${
Qt5Widgets_INCLUDE_DIRS
}
)
set
(
GROUP_CHAT_SRC qtsupport/qt_group_chat.cpp qtsupport/chatwidget.cpp
)
add_executable
(
qt_group_chat
${
GROUP_CHAT_SRC
}
${
GROUP_CHAT_MOC_SRC
}
${
GROUP_CHAT_UI_HDR
}
)
target_link_libraries
(
qt_group_chat
Qt5::Core
Qt5::Gui
Qt5::Widgets
CAF::core
CAF::io
)
add_dependencies
(
qt_group_chat all_examples
)
endif
()
if
(
NOT CAF_NO_CURL_EXAMPLES
)
find_package
(
CURL
)
if
(
CURL_FOUND
)
add_executable
(
curl_fuse curl/curl_fuse.cpp
)
include_directories
(
${
CURL_INCLUDE_DIRS
}
)
target_link_libraries
(
curl_fuse
${
CMAKE_DL_LIBS
}
${
CAF_LIBRARIES
}
${
PTHREAD_LIBRARIES
}
${
CURL_LIBRARY
}
)
add_dependencies
(
curl_fuse all_examples
)
endif
(
CURL_FOUND
)
if
(
CAF_ENABLE_CURL_EXAMPLES
)
find_package
(
CURL REQUIRED
)
add_executable
(
curl_fuse curl/curl_fuse.cpp
)
include_directories
(
${
CURL_INCLUDE_DIRS
}
)
target_link_libraries
(
curl_fuse
${
CURL_LIBRARY
}
CAF::core CAF::io
)
add_dependencies
(
curl_fuse all_examples
)
endif
()
examples/aout.cpp
View file @
7bce1d66
...
...
@@ -4,7 +4,6 @@
#include <iostream>
#include "caf/all.hpp"
#include "caf/io/all.hpp"
using
namespace
caf
;
using
std
::
endl
;
...
...
libcaf_core/CMakeLists.txt
View file @
7bce1d66
...
...
@@ -19,9 +19,9 @@ add_enum_consistency_check("caf/intrusive/inbox_result.hpp"
add_enum_consistency_check
(
"caf/intrusive/task_result.hpp"
"src/intrusive/task_result_strings.cpp"
)
# --
list cpp files for libcaf_core
--------------------------------------------
# --
add library target ------------
--------------------------------------------
set
(
CAF_CORE_SOURCES
add_library
(
libcaf_core_obj OBJECT
${
CAF_CORE_HEADERS
}
src/abstract_actor.cpp
src/abstract_channel.cpp
src/abstract_group.cpp
...
...
@@ -154,140 +154,42 @@ set(CAF_CORE_SOURCES
src/uuid.cpp
)
# -- list cpp files for caf-core-test ------------------------------------------
set
(
CAF_CORE_TEST_SOURCES
test/actor_clock.cpp
test/actor_factory.cpp
test/actor_lifetime.cpp
test/actor_pool.cpp
test/actor_profiler.cpp
test/actor_registry.cpp
test/actor_system_config.cpp
test/actor_termination.cpp
test/aout.cpp
test/behavior.cpp
test/binary_deserializer.cpp
test/binary_serializer.cpp
test/blocking_actor.cpp
test/broadcast_downstream_manager.cpp
test/byte.cpp
test/composition.cpp
test/config_option.cpp
test/config_option_set.cpp
test/config_value.cpp
test/config_value_adaptor.cpp
test/const_typed_message_view.cpp
test/constructor_attach.cpp
test/continuous_streaming.cpp
test/cow_tuple.cpp
test/custom_exception_handler.cpp
test/decorator/sequencer.cpp
test/deep_to_string.cpp
test/detached_actors.cpp
test/detail/bounds_checker.cpp
test/detail/ini_consumer.cpp
test/detail/limited_vector.cpp
test/detail/meta_object.cpp
test/detail/parse.cpp
test/detail/parser/read_bool.cpp
test/detail/parser/read_floating_point.cpp
test/detail/parser/read_ini.cpp
test/detail/parser/read_number.cpp
test/detail/parser/read_number_or_timespan.cpp
test/detail/parser/read_signed_integer.cpp
test/detail/parser/read_string.cpp
test/detail/parser/read_timespan.cpp
test/detail/parser/read_unsigned_integer.cpp
test/detail/ringbuffer.cpp
test/detail/ripemd_160.cpp
test/detail/serialized_size.cpp
test/detail/tick_emitter.cpp
test/detail/type_id_list_builder.cpp
test/detail/unique_function.cpp
test/detail/unordered_flat_map.cpp
test/dictionary.cpp
test/dynamic_spawn.cpp
test/error.cpp
test/expected.cpp
test/function_view.cpp
test/fused_downstream_manager.cpp
test/handles.cpp
test/hash/fnv.cpp
test/inspector.cpp
test/intrusive/drr_cached_queue.cpp
test/intrusive/drr_queue.cpp
test/intrusive/fifo_inbox.cpp
test/intrusive/lifo_inbox.cpp
test/intrusive/task_queue.cpp
test/intrusive/wdrr_dynamic_multiplexed_queue.cpp
test/intrusive/wdrr_fixed_multiplexed_queue.cpp
test/intrusive_ptr.cpp
test/ipv4_address.cpp
test/ipv4_endpoint.cpp
test/ipv4_subnet.cpp
test/ipv6_address.cpp
test/ipv6_endpoint.cpp
test/ipv6_subnet.cpp
test/local_group.cpp
test/logger.cpp
test/mailbox_element.cpp
test/make_config_value_field.cpp
test/message.cpp
test/message_id.cpp
test/message_lifetime.cpp
test/metaprogramming.cpp
test/mixin/requester.cpp
test/mixin/sender.cpp
test/mock_streaming_classes.cpp
test/native_streaming_classes.cpp
test/node_id.cpp
test/optional.cpp
test/or_else.cpp
test/pipeline_streaming.cpp
test/policy/categorized.cpp
test/policy/select_all.cpp
test/policy/select_any.cpp
test/request_timeout.cpp
test/result.cpp
test/selective_streaming.cpp
test/serialization.cpp
test/settings.cpp
test/simple_timeout.cpp
test/span.cpp
test/stateful_actor.cpp
test/string_algorithms.cpp
test/string_view.cpp
test/sum_type.cpp
test/thread_hook.cpp
test/tracing_data.cpp
test/type_id_list.cpp
test/typed_behavior.cpp
test/typed_message_view.cpp
test/typed_response_promise.cpp
test/typed_spawn.cpp
test/unit.cpp
test/uri.cpp
test/uuid.cpp
test/variant.cpp
)
target_include_directories
(
libcaf_core_obj PRIVATE
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_core
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_core_obj>
)
add_library
(
libcaf_core_obj OBJECT
${
CAF_CORE_SOURCES
}
${
CAF_CORE_HEADERS
}
)
target_include_directories
(
libcaf_core INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
)
add_library
(
libcaf_core
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_core_obj>
)
target_include_directories
(
libcaf_core INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_BINARY_DIR
}
>
)
add_library
(
caf::core ALIAS libcaf_core
)
add_library
(
CAF::core ALIAS libcaf_core
)
# -- dependencies and compiler flags -------------------------------------------
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_core PRIVATE -fPIC
)
target_compile_options
(
libcaf_core_obj PRIVATE -fPIC
)
endif
()
target_link_libraries
(
libcaf_core PUBLIC
${
CAF_EXTRA_LDFLAGS
}
)
if
(
NOT TARGET Threads::Threads
)
find_package
(
Threads REQUIRED
)
endif
()
target_link_libraries
(
libcaf_core PUBLIC Threads::Threads
)
if
(
MSVC
)
target_link_libraries
(
libcaf_core PUBLIC iphlpapi
)
endif
()
if
(
CAF_SANITIZERS
)
target_link_libraries
(
libcaf_core PUBLIC -fsanitize=
${
CAF_SANITIZERS
}
)
endif
()
# -- API exports ---------------------------------------------------------------
generate_export_header
(
libcaf_core
EXPORT_MACRO_NAME CAF_CORE_EXPORT
...
...
@@ -321,21 +223,142 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/caf"
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-core-test
test/core-test.cpp
${
CAF_CORE_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_core_obj>
)
target_include_directories
(
caf-core-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-core-test PRIVATE libcaf_core_EXPORTS
)
target_link_libraries
(
caf-core-test
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-core-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_CORE_TEST_SOURCES
}
)
if
(
NOT CAF_ENABLE_TESTING
)
return
()
endif
()
# -- add this library to the global CAF_LIBRARIES ------------------------------
add_executable
(
caf-core-test
test/core-test.cpp
$<TARGET_OBJECTS:libcaf_core_obj>
)
target_include_directories
(
caf-core-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-core-test PRIVATE libcaf_core_EXPORTS
)
list
(
APPEND CAF_LIBRARIES libcaf_core
)
target_link_libraries
(
caf-core-test PUBLIC CAF::test
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
target_link_libraries
(
caf-core-test PRIVATE
$<TARGET_PROPERTY:libcaf_core,INTERFACE_LINK_LIBRARIES>
)
target_include_directories
(
caf-core-test PRIVATE
"
${
CMAKE_BINARY_DIR
}
"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
caf_add_test_suites
(
caf-core-test
actor_clock
actor_factory
actor_lifetime
actor_pool
actor_profiler
actor_registry
actor_system_config
actor_termination
aout
behavior
binary_deserializer
binary_serializer
blocking_actor
broadcast_downstream_manager
byte
composition
config_option
config_option_set
config_value
config_value_adaptor
const_typed_message_view
constructor_attach
continuous_streaming
cow_tuple
decorator.sequencer
deep_to_string
detached_actors
detail.bounds_checker
detail.ini_consumer
detail.limited_vector
detail.meta_object
detail.parse
detail.parser.read_bool
detail.parser.read_floating_point
detail.parser.read_ini
detail.parser.read_number
detail.parser.read_number_or_timespan
detail.parser.read_signed_integer
detail.parser.read_string
detail.parser.read_timespan
detail.parser.read_unsigned_integer
detail.ringbuffer
detail.ripemd_160
detail.serialized_size
detail.tick_emitter
detail.type_id_list_builder
detail.unique_function
detail.unordered_flat_map
dictionary
dynamic_spawn
error
expected
function_view
fused_downstream_manager
handles
hash.fnv
inspector
intrusive.drr_cached_queue
intrusive.drr_queue
intrusive.fifo_inbox
intrusive.lifo_inbox
intrusive.task_queue
intrusive.wdrr_dynamic_multiplexed_queue
intrusive.wdrr_fixed_multiplexed_queue
intrusive_ptr
ipv4_address
ipv4_endpoint
ipv4_subnet
ipv6_address
ipv6_endpoint
ipv6_subnet
local_group
logger
mailbox_element
make_config_value_field
message
message_id
message_lifetime
metaprogramming
mixin.requester
mixin.sender
mock_streaming_classes
native_streaming_classes
node_id
optional
or_else
pipeline_streaming
policy.categorized
policy.select_all
policy.select_any
request_timeout
result
selective_streaming
serialization
settings
simple_timeout
span
stateful_actor
string_algorithms
string_view
sum_type
thread_hook
tracing_data
type_id_list
typed_behavior
typed_message_view
typed_response_promise
typed_spawn
unit
uri
uuid
variant
)
if
(
CAF_ENABLE_EXCEPTIONS
)
caf_add_test_suites
(
caf-core-test custom_exception_handler
)
endif
()
libcaf_core/caf/raise_error.hpp
View file @
7bce1d66
...
...
@@ -20,7 +20,7 @@
#include "caf/config.hpp"
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
# include <stdexcept>
#endif
...
...
@@ -33,32 +33,32 @@ CAF_CORE_EXPORT void log_cstring_error(const char* cstring);
}
// namespace caf::detail
#ifdef CAF_
NO
_EXCEPTIONS
#ifdef CAF_
ENABLE
_EXCEPTIONS
# define CAF_RAISE_ERROR_IMPL_
1(msg)
\
# define CAF_RAISE_ERROR_IMPL_
2(exception_type, msg)
\
do { \
::caf::detail::log_cstring_error(msg); \
CAF_CRITICAL(msg);
\
throw exception_type(msg);
\
} while (false)
# define CAF_RAISE_ERROR_IMPL_2(unused, msg) CAF_RAISE_ERROR_IMPL_1(msg)
# define CAF_RAISE_ERROR_IMPL_1(msg) \
CAF_RAISE_ERROR_IMPL_2(std::runtime_error, msg)
#else // CAF_
NO
_EXCEPTIONS
#else // CAF_
ENABLE
_EXCEPTIONS
# define CAF_RAISE_ERROR_IMPL_
2(exception_type, msg)
\
# define CAF_RAISE_ERROR_IMPL_
1(msg)
\
do { \
::caf::detail::log_cstring_error(msg); \
throw exception_type(msg);
\
CAF_CRITICAL(msg);
\
} while (false)
# define CAF_RAISE_ERROR_IMPL_1(msg) \
CAF_RAISE_ERROR_IMPL_2(std::runtime_error, msg)
# define CAF_RAISE_ERROR_IMPL_2(unused, msg) CAF_RAISE_ERROR_IMPL_1(msg)
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
#ifdef CAF_MSVC
/// Throws an exception if `CAF_
NO_EXCEPTIONS` is un
defined, otherwise calls
/// Throws an exception if `CAF_
ENABLE_EXCEPTIONS` is
defined, otherwise calls
/// abort() after printing a given message.
# define CAF_RAISE_ERROR(...) \
CAF_PP_CAT(CAF_PP_OVERLOAD(CAF_RAISE_ERROR_IMPL_, \
...
...
@@ -67,7 +67,7 @@ CAF_CORE_EXPORT void log_cstring_error(const char* cstring);
#else // CAF_MSVC
/// Throws an exception if `CAF_
NO_EXCEPTIONS` is un
defined, otherwise calls
/// Throws an exception if `CAF_
ENABLE_EXCEPTIONS` is
defined, otherwise calls
/// abort() after printing a given message.
# define CAF_RAISE_ERROR(...) \
CAF_PP_OVERLOAD(CAF_RAISE_ERROR_IMPL_, __VA_ARGS__)(__VA_ARGS__)
...
...
libcaf_core/caf/scheduled_actor.hpp
View file @
7bce1d66
...
...
@@ -20,9 +20,9 @@
#include "caf/config.hpp"
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
# include <exception>
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
#include <forward_list>
#include <map>
...
...
@@ -190,10 +190,10 @@ public:
/// Function object for handling exit messages.
using
exit_handler
=
std
::
function
<
void
(
pointer
,
exit_msg
&
)
>
;
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
/// Function object for handling exit messages.
using
exception_handler
=
std
::
function
<
error
(
pointer
,
std
::
exception_ptr
&
)
>
;
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
/// Consumes messages from the mailbox.
struct
mailbox_visitor
{
...
...
@@ -232,9 +232,9 @@ public:
static
void
default_exit_handler
(
pointer
ptr
,
exit_msg
&
x
);
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
static
error
default_exception_handler
(
pointer
ptr
,
std
::
exception_ptr
&
x
);
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
// -- constructors and destructors -------------------------------------------
...
...
@@ -389,7 +389,7 @@ public:
set_exit_handler
([
fun
](
scheduled_actor
*
,
exit_msg
&
x
)
{
fun
(
x
);
});
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
/// Sets a custom exception handler for this actor. If multiple handlers are
/// defined, only the functor that was added *last* is being executed.
inline
void
set_exception_handler
(
exception_handler
fun
)
{
...
...
@@ -408,7 +408,7 @@ public:
set_exception_handler
(
[
f
](
scheduled_actor
*
,
std
::
exception_ptr
&
x
)
{
return
f
(
x
);
});
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
/// @cond PRIVATE
...
...
@@ -703,10 +703,10 @@ protected:
/// Pointer to a private thread object associated with a detached actor.
detail
::
private_thread
*
private_thread_
;
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
/// Customization point for setting a default exception callback.
exception_handler
exception_handler_
;
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
/// @endcond
};
...
...
libcaf_core/caf/typed_actor_view.hpp
View file @
7bce1d66
...
...
@@ -174,7 +174,7 @@ public:
self_
->
set_exit_handler
(
std
::
forward
<
Fun
>
(
fun
));
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
/// @copydoc scheduled_actor::set_exception_handler
template
<
class
Fun
>
...
...
@@ -182,7 +182,7 @@ public:
self_
->
set_exception_handler
(
std
::
forward
<
Fun
>
(
fun
));
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
// -- linking and monitoring -------------------------------------------------
...
...
libcaf_core/src/blocking_actor.cpp
View file @
7bce1d66
...
...
@@ -107,7 +107,7 @@ void blocking_actor::launch(execution_unit*, bool, bool hide) {
CAF_PUSH_AID_FROM_PTR
(
self
);
self
->
initialize
();
error
rsn
;
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
try
{
self
->
act
();
rsn
=
self
->
fail_state_
;
...
...
libcaf_core/src/scheduled_actor.cpp
View file @
7bce1d66
...
...
@@ -97,7 +97,7 @@ void scheduled_actor::default_exit_handler(scheduled_actor* ptr, exit_msg& x) {
default_error_handler
(
ptr
,
x
.
reason
);
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
error
scheduled_actor
::
default_exception_handler
(
pointer
ptr
,
std
::
exception_ptr
&
x
)
{
CAF_ASSERT
(
x
!=
nullptr
);
...
...
@@ -115,7 +115,7 @@ error scheduled_actor::default_exception_handler(pointer ptr,
}
return
sec
::
runtime_error
;
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
// -- constructors and destructors ---------------------------------------------
...
...
@@ -129,10 +129,10 @@ scheduled_actor::scheduled_actor(actor_config& cfg)
node_down_handler_
(
default_node_down_handler
),
exit_handler_
(
default_exit_handler
),
private_thread_
(
nullptr
)
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
,
exception_handler_
(
default_exception_handler
)
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
{
auto
&
sys_cfg
=
home_system
().
config
();
auto
interval
=
sys_cfg
.
stream_tick_duration
();
...
...
@@ -743,9 +743,9 @@ bool scheduled_actor::activate(execution_unit* ctx) {
CAF_LOG_ERROR
(
"activate called on a terminated actor"
);
return
false
;
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
try
{
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
if
(
!
getf
(
is_initialized_flag
))
{
initialize
();
if
(
finalize
())
{
...
...
@@ -754,7 +754,7 @@ bool scheduled_actor::activate(execution_unit* ctx) {
}
CAF_LOG_DEBUG
(
"initialized actor:"
<<
CAF_ARG
(
name
()));
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
}
catch
(...)
{
CAF_LOG_ERROR
(
"actor died during initialization"
);
auto
eptr
=
std
::
current_exception
();
...
...
@@ -762,7 +762,7 @@ bool scheduled_actor::activate(execution_unit* ctx) {
finalize
();
return
false
;
}
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
return
true
;
}
...
...
@@ -779,7 +779,7 @@ auto scheduled_actor::activate(execution_unit* ctx, mailbox_element& x)
auto
scheduled_actor
::
reactivate
(
mailbox_element
&
x
)
->
activation_result
{
CAF_LOG_TRACE
(
CAF_ARG
(
x
));
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
auto
handle_exception
=
[
&
](
std
::
exception_ptr
eptr
)
{
auto
err
=
call_handler
(
exception_handler_
,
this
,
eptr
);
if
(
x
.
mid
.
is_request
())
{
...
...
@@ -789,7 +789,7 @@ auto scheduled_actor::reactivate(mailbox_element& x) -> activation_result {
quit
(
std
::
move
(
err
));
};
try
{
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
switch
(
consume
(
x
))
{
case
invoke_message_result
:
:
dropped
:
return
activation_result
::
dropped
;
...
...
@@ -803,7 +803,7 @@ auto scheduled_actor::reactivate(mailbox_element& x) -> activation_result {
case
invoke_message_result
:
:
skipped
:
return
activation_result
::
skipped
;
}
#if
ndef CAF_NO
_EXCEPTIONS
#if
def CAF_ENABLE
_EXCEPTIONS
}
catch
(
std
::
exception
&
e
)
{
CAF_LOG_INFO
(
"actor died because of an exception, what: "
<<
e
.
what
());
static_cast
<
void
>
(
e
);
// keep compiler happy when not logging
...
...
@@ -814,7 +814,7 @@ auto scheduled_actor::reactivate(mailbox_element& x) -> activation_result {
}
finalize
();
return
activation_result
::
terminated
;
#endif // CAF_
NO
_EXCEPTIONS
#endif // CAF_
ENABLE
_EXCEPTIONS
}
// -- behavior management ----------------------------------------------------
...
...
libcaf_core/test/custom_exception_handler.cpp
View file @
7bce1d66
...
...
@@ -24,7 +24,9 @@
using
namespace
caf
;
#ifndef CAF_NO_EXCEPTIONS
#ifndef CAF_ENABLE_EXCEPTIONS
# error "building unit test for exception handlers in no-exceptions build"
#endif
class
exception_testee
:
public
event_based_actor
{
public:
...
...
@@ -77,11 +79,3 @@ CAF_TEST(test_custom_exception_handler) {
// receive all down messages
self
->
wait_for
(
testee1
,
testee2
,
testee3
);
}
#else // CAF_NO_EXCEPTIONS
CAF_TEST
(
no_exceptions_dummy
)
{
CAF_CHECK_EQUAL
(
true
,
true
);
}
#endif // CAF_NO_EXCEPTIONS
libcaf_io/CMakeLists.txt
View file @
7bce1d66
...
...
@@ -10,9 +10,9 @@ add_enum_consistency_check("caf/io/basp/message_type.hpp"
add_enum_consistency_check
(
"caf/io/network/operation.hpp"
"src/io/network/operation_strings.cpp"
)
# --
list cpp files ----
--------------------------------------------------------
# --
add library target
--------------------------------------------------------
set
(
CAF_IO_SOURCES
add_library
(
libcaf_io_obj OBJECT
${
CAF_IO_HEADERS
}
src/detail/socket_guard.cpp
src/io/abstract_broker.cpp
src/io/basp/header.cpp
...
...
@@ -55,38 +55,31 @@ set(CAF_IO_SOURCES
src/policy/udp.cpp
)
set
(
CAF_IO_TEST_SOURCES
test/io/basp/message_queue.cpp
test/io/basp_broker.cpp
test/io/broker.cpp
test/io/http_broker.cpp
test/io/monitor.cpp
test/io/network/default_multiplexer.cpp
test/io/network/ip_endpoint.cpp
test/io/receive_buffer.cpp
test/io/remote_actor.cpp
test/io/remote_group.cpp
test/io/remote_spawn.cpp
test/io/unpublish.cpp
test/io/worker.cpp
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_io_obj OBJECT
${
CAF_IO_SOURCES
}
${
CAF_IO_HEADERS
}
)
target_include_directories
(
libcaf_io_obj PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
add_library
(
libcaf_io
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_io_obj>
)
add_library
(
caf::io ALIAS libcaf_io
)
target_include_directories
(
libcaf_io INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
)
add_library
(
CAF::io ALIAS libcaf_io
)
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_io PRIVATE -fPIC
)
target_compile_options
(
libcaf_io_obj PRIVATE -fPIC
)
endif
()
target_link_libraries
(
libcaf_io PUBLIC caf::core
${
CAF_EXTRA_LDFLAGS
}
)
target_include_directories
(
libcaf_io_obj PRIVATE
$<TARGET_PROPERTY:libcaf_core,INTERFACE_INCLUDE_DIRECTORIES>
)
target_link_libraries
(
libcaf_io PUBLIC CAF::core
)
if
(
MSVC
)
target_link_libraries
(
libcaf_io PUBLIC ws2_32 iphlpapi
)
endif
()
generate_export_header
(
libcaf_io
EXPORT_MACRO_NAME CAF_IO_EXPORT
...
...
@@ -119,21 +112,37 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/caf"
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-io-test
test/io-test.cpp
${
CAF_IO_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_io_obj>
)
target_include_directories
(
caf-io-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-io-test PRIVATE libcaf_io_EXPORTS
)
target_link_libraries
(
caf-io-test caf::core
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-io-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_IO_TEST_SOURCES
}
)
if
(
NOT CAF_ENABLE_TESTING
)
return
()
endif
()
# -- add this library to the global CAF_LIBRARIES ------------------------------
add_executable
(
caf-io-test
test/io-test.cpp
$<TARGET_OBJECTS:libcaf_io_obj>
)
target_include_directories
(
caf-io-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-io-test PRIVATE libcaf_io_EXPORTS
)
list
(
APPEND CAF_LIBRARIES libcaf_io
)
target_link_libraries
(
caf-io-test PRIVATE CAF::core CAF::test
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
target_link_libraries
(
caf-io-test PRIVATE
$<TARGET_PROPERTY:libcaf_io,INTERFACE_LINK_LIBRARIES>
)
target_include_directories
(
caf-io-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
caf_add_test_suites
(
caf-io-test
io.basp.message_queue
io.basp_broker
io.broker
io.http_broker
io.monitor
io.network.default_multiplexer
io.network.ip_endpoint
io.receive_buffer
io.remote_actor
io.remote_group
io.remote_spawn
io.unpublish
io.worker
)
libcaf_openssl/CMakeLists.txt
View file @
7bce1d66
...
...
@@ -2,9 +2,9 @@
file
(
GLOB_RECURSE CAF_OPENSSL_HEADERS
"caf/*.hpp"
)
# --
list cpp files ----
--------------------------------------------------------
# --
add library target
--------------------------------------------------------
set
(
CAF_OPENSSL_SOURCES
add_library
(
libcaf_openssl_obj OBJECT
${
CAF_OPENSSL_HEADERS
}
src/openssl/manager.cpp
src/openssl/middleman_actor.cpp
src/openssl/publish.cpp
...
...
@@ -12,33 +12,36 @@ set(CAF_OPENSSL_SOURCES
src/openssl/session.cpp
)
set
(
CAF_OPENSSL_TEST_SOURCES
test/openssl/authentication.cpp
test/openssl/remote_actor.cpp
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_openssl_obj OBJECT
${
CAF_OPENSSL_SOURCES
}
${
CAF_OPENSSL_HEADERS
}
)
target_include_directories
(
libcaf_openssl_obj PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
add_library
(
libcaf_openssl
"
${
PROJECT_SOURCE_DIR
}
/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_openssl_obj>
)
add_library
(
caf::openssl ALIAS libcaf_openssl
)
target_include_directories
(
libcaf_openssl INTERFACE
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
)
add_library
(
CAF::openssl ALIAS libcaf_openssl
)
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_openssl PRIVATE -fPIC
)
target_compile_options
(
libcaf_openssl_obj PRIVATE -fPIC
)
endif
()
target_link_libraries
(
libcaf_openssl PUBLIC
caf::core caf::io
${
OPENSSL_LIBRARIES
}
)
if
(
NOT APPLE AND NOT WIN32
)
target_link_libraries
(
libcaf_openssl PUBLIC
"-pthread"
)
if
(
NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto
)
find_package
(
OpenSSL REQUIRED
)
endif
()
target_include_directories
(
libcaf_openssl_obj PRIVATE
$<TARGET_PROPERTY:libcaf_core,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:libcaf_io,INTERFACE_INCLUDE_DIRECTORIES>
${
OPENSSL_INCLUDE_DIR
}
)
target_link_libraries
(
libcaf_openssl PUBLIC
CAF::core CAF::io
OpenSSL::SSL OpenSSL::Crypto
)
generate_export_header
(
libcaf_openssl
EXPORT_MACRO_NAME CAF_OPENSSL_EXPORT
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/openssl_export.hpp"
...
...
@@ -75,22 +78,26 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/caf"
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-openssl-test
test/openssl-test.cpp
${
CAF_OPENSSL_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_openssl_obj>
)
target_include_directories
(
caf-openssl-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
target_compile_definitions
(
caf-openssl-test PRIVATE libcaf_openssl_EXPORTS
)
target_link_libraries
(
caf-openssl-test caf::core caf::io
${
OPENSSL_LIBRARIES
}
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-openssl-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_OPENSSL_TEST_SOURCES
}
)
if
(
NOT CAF_ENABLE_TESTING
)
return
()
endif
()
# -- add this library to the global CAF_LIBRARIES ------------------------------
add_executable
(
caf-openssl-test
test/openssl-test.cpp
${
CAF_OPENSSL_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_openssl_obj>
)
target_include_directories
(
caf-openssl-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/test"
)
list
(
APPEND CAF_LIBRARIES libcaf_openssl
)
target_compile_definitions
(
caf-openssl-test PRIVATE libcaf_openssl_EXPORTS
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
target_link_libraries
(
caf-openssl-test PRIVATE
CAF::io CAF::core CAF::test OpenSSL::SSL OpenSSL::Crypto
)
target_include_directories
(
caf-openssl-test PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
caf_add_test_suites
(
caf-openssl-test
openssl.authentication
openssl.remote_actor
)
tools/CMakeLists.txt
View file @
7bce1d66
add_custom_target
(
all_tools
)
include_directories
(
${
LIBCAF_INCLUDE_DIRS
}
)
macro
(
add name
)
add_executable
(
${
name
}
${
name
}
.cpp
${
ARGN
}
)
target_link_libraries
(
${
name
}
${
CAF_EXTRA_LDFLAGS
}
${
CAF_LIBRARIES
}
${
PTHREAD_LIBRARIES
}
)
install
(
FILES
${
name
}
.cpp DESTINATION
${
CMAKE_INSTALL_DATADIR
}
/caf/tools/
${
folder
}
)
install
(
FILES
${
name
}
.cpp DESTINATION
${
CMAKE_INSTALL_DATADIR
}
/caf/tools
)
add_dependencies
(
${
name
}
all_tools
)
endmacro
()
if
(
WIN32
)
message
(
STATUS
"skip caf-run (not supported on Windows)"
)
else
()
add
(
caf-run
)
endif
()
add
(
caf-vec
)
target_link_libraries
(
caf-vec PRIVATE CAF::core
)
if
(
TARGET CAF::io
)
if
(
WIN32
)
message
(
STATUS
"skip caf-run (not supported on Windows)"
)
else
()
add
(
caf-run
)
target_link_libraries
(
caf-run PRIVATE CAF::io CAF::core
)
endif
()
endif
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment