Unverified Commit 675794d7 authored by Dominik Charousset's avatar Dominik Charousset Committed by GitHub

Merge pull request #1180

Tidy up CMake setup, propagate flags via targets
parents 44c41ad2 30db620a
This diff is collapsed.
/****************************************************************************** // this header is auto-generated by CMake
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#pragma once #pragma once
#include "caf/detail/log_level.hpp" #include "caf/detail/log_level.hpp"
// this header is auto-generated by CMake
#define CAF_LOG_LEVEL CAF_LOG_LEVEL_@CAF_LOG_LEVEL@ #define CAF_LOG_LEVEL CAF_LOG_LEVEL_@CAF_LOG_LEVEL@
#cmakedefine CAF_ENABLE_RUNTIME_CHECKS #cmakedefine CAF_ENABLE_RUNTIME_CHECKS
......
...@@ -2,13 +2,14 @@ add_custom_target(all_examples) ...@@ -2,13 +2,14 @@ add_custom_target(all_examples)
function(add_example folder name) function(add_example folder name)
add_executable(${name} ${folder}/${name}.cpp ${ARGN}) add_executable(${name} ${folder}/${name}.cpp ${ARGN})
install(FILES ${folder}/${name}.cpp DESTINATION ${CMAKE_INSTALL_DATADIR}/caf/examples/${folder}) install(FILES ${folder}/${name}.cpp
DESTINATION ${CMAKE_INSTALL_DATADIR}/caf/examples/${folder})
add_dependencies(${name} all_examples) add_dependencies(${name} all_examples)
endfunction() endfunction()
function(add_core_example folder name) function(add_core_example folder name)
add_example(${folder} ${name} ${ARGN}) add_example(${folder} ${name} ${ARGN})
target_link_libraries(${name} CAF::core) target_link_libraries(${name} PRIVATE CAF::internal CAF::core)
endfunction() endfunction()
# -- examples for CAF::core ---------------------------------------------------- # -- examples for CAF::core ----------------------------------------------------
...@@ -43,7 +44,7 @@ add_core_example(custom_type custom_types_3) ...@@ -43,7 +44,7 @@ add_core_example(custom_type custom_types_3)
# testing DSL # testing DSL
add_example(testing ping_pong) add_example(testing ping_pong)
target_link_libraries(ping_pong CAF::core CAF::test) target_link_libraries(ping_pong PRIVATE CAF::internal CAF::core CAF::test)
# -- examples for CAF::io ------------------------------------------------------ # -- examples for CAF::io ------------------------------------------------------
...@@ -52,7 +53,7 @@ if(TARGET CAF::io) ...@@ -52,7 +53,7 @@ if(TARGET CAF::io)
function(add_io_example folder name) function(add_io_example folder name)
add_example(${folder} ${name} ${ARGN}) add_example(${folder} ${name} ${ARGN})
target_link_libraries(${name} CAF::io CAF::core) target_link_libraries(${name} PRIVATE CAF::internal CAF::io)
endfunction() endfunction()
# basic remoting # basic remoting
...@@ -65,53 +66,52 @@ if(TARGET CAF::io) ...@@ -65,53 +66,52 @@ if(TARGET CAF::io)
add_io_example(broker simple_broker) add_io_example(broker simple_broker)
add_io_example(broker simple_http_broker) add_io_example(broker simple_http_broker)
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
PRIVATE ${PROTOBUF_LIBRARIES} CAF::internal CAF::io)
add_dependencies(protobuf_broker all_examples)
endif()
if(CAF_ENABLE_PROTOBUF_EXAMPLES) if(CAF_ENABLE_QT5_EXAMPLES)
find_package(Protobuf REQUIRED) find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
if(NOT PROTOBUF_PROTOC_EXECUTABLE) message(STATUS "Found Qt5")
message(FATAL_ERROR "CMake was unable to set PROTOBUF_PROTOC_EXECUTABLE") #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::io)
add_dependencies(qt_group_chat all_examples)
endif() 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) if(CAF_ENABLE_CURL_EXAMPLES)
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) find_package(CURL REQUIRED)
message(STATUS "Found Qt5") add_executable(curl_fuse curl/curl_fuse.cpp)
#include(${QT_USE_FILE}) include_directories(${CURL_INCLUDE_DIRS})
QT5_ADD_RESOURCES(GROUP_CHAT_RCS ) target_link_libraries(curl_fuse ${CURL_LIBRARY} CAF::io)
QT5_WRAP_UI(GROUP_CHAT_UI_HDR qtsupport/chatwindow.ui) add_dependencies(curl_fuse all_examples)
QT5_WRAP_CPP(GROUP_CHAT_MOC_SRC qtsupport/chatwidget.hpp) endif()
# 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(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() endif()
This diff is collapsed.
# -- get header files for creating "proper" XCode projects --------------------- # -- collect header files ------------------------------------------------------
file(GLOB_RECURSE CAF_IO_HEADERS "caf/*.hpp") file(GLOB_RECURSE CAF_IO_HEADERS "caf/*.hpp")
# -- add consistency checks for enum to_string implementations ----------------- # -- add targets ---------------------------------------------------------------
caf_add_enum_consistency_check("caf/io/basp/message_type.hpp" caf_add_component(
"src/io/basp/message_type_strings.cpp") io
DEPENDENCIES
caf_add_enum_consistency_check("caf/io/network/operation.hpp" PUBLIC
"src/io/network/operation_strings.cpp") CAF::core
$<$<CXX_COMPILER_ID:MSVC>:ws2_32>
# -- utility function for setting default properties --------------------------- PRIVATE
CAF::internal
function(caf_io_set_default_properties) ENUM_CONSISTENCY_CHECKS
foreach(target ${ARGN}) io.basp.message_type
# Set global defaults and set EXPORTS flag. io.network.operation
caf_set_default_properties(${target}) HEADERS
target_compile_definitions(${target} PRIVATE libcaf_io_EXPORTS) ${CAF_IO_HEADERS}
# Pull in public dependencies. SOURCES
caf_target_link_libraries(${target} PUBLIC CAF::core) src/detail/prometheus_broker.cpp
if(MSVC) src/detail/remote_group_module.cpp
caf_target_link_libraries(${target} PUBLIC ws2_32 iphlpapi) src/detail/socket_guard.cpp
endif() src/io/abstract_broker.cpp
endforeach() src/io/basp/header.cpp
endfunction() src/io/basp/instance.cpp
src/io/basp/message_queue.cpp
# -- add library target -------------------------------------------------------- src/io/basp/message_type_strings.cpp
src/io/basp/routing_table.cpp
add_library(libcaf_io_obj OBJECT ${CAF_IO_HEADERS} src/io/basp/worker.cpp
src/detail/prometheus_broker.cpp src/io/basp_broker.cpp
src/detail/remote_group_module.cpp src/io/broker.cpp
src/detail/socket_guard.cpp src/io/connection_helper.cpp
src/io/abstract_broker.cpp src/io/datagram_servant.cpp
src/io/basp/header.cpp src/io/doorman.cpp
src/io/basp/instance.cpp src/io/middleman.cpp
src/io/basp/message_queue.cpp src/io/middleman_actor.cpp
src/io/basp/message_type_strings.cpp src/io/middleman_actor_impl.cpp
src/io/basp/routing_table.cpp src/io/network/acceptor.cpp
src/io/basp/worker.cpp src/io/network/acceptor_manager.cpp
src/io/basp_broker.cpp src/io/network/datagram_handler.cpp
src/io/broker.cpp src/io/network/datagram_manager.cpp
src/io/connection_helper.cpp src/io/network/datagram_servant_impl.cpp
src/io/datagram_servant.cpp src/io/network/default_multiplexer.cpp
src/io/doorman.cpp src/io/network/doorman_impl.cpp
src/io/middleman.cpp src/io/network/event_handler.cpp
src/io/middleman_actor.cpp src/io/network/interfaces.cpp
src/io/middleman_actor_impl.cpp src/io/network/ip_endpoint.cpp
src/io/network/acceptor.cpp src/io/network/manager.cpp
src/io/network/acceptor_manager.cpp src/io/network/multiplexer.cpp
src/io/network/datagram_handler.cpp src/io/network/native_socket.cpp
src/io/network/datagram_manager.cpp src/io/network/operation_strings.cpp
src/io/network/datagram_servant_impl.cpp src/io/network/pipe_reader.cpp
src/io/network/default_multiplexer.cpp src/io/network/protocol.cpp
src/io/network/doorman_impl.cpp src/io/network/receive_buffer.cpp
src/io/network/event_handler.cpp src/io/network/scribe_impl.cpp
src/io/network/interfaces.cpp src/io/network/stream.cpp
src/io/network/ip_endpoint.cpp src/io/network/stream_manager.cpp
src/io/network/manager.cpp src/io/network/test_multiplexer.cpp
src/io/network/multiplexer.cpp src/io/scribe.cpp
src/io/network/native_socket.cpp src/policy/tcp.cpp
src/io/network/operation_strings.cpp src/policy/udp.cpp
src/io/network/pipe_reader.cpp TEST_SOURCES
src/io/network/protocol.cpp test/io-test.cpp
src/io/network/receive_buffer.cpp TEST_SUITES
src/io/network/scribe_impl.cpp detail.prometheus_broker
src/io/network/stream.cpp io.basp.message_queue
src/io/network/stream_manager.cpp io.basp_broker
src/io/network/test_multiplexer.cpp io.broker
src/io/scribe.cpp io.http_broker
src/policy/tcp.cpp io.monitor
src/policy/udp.cpp io.network.default_multiplexer
) io.network.ip_endpoint
io.receive_buffer
add_library(libcaf_io io.remote_actor
"${PROJECT_SOURCE_DIR}/cmake/dummy.cpp" io.remote_group
$<TARGET_OBJECTS:libcaf_io_obj>) io.remote_spawn
io.unpublish
caf_io_set_default_properties(libcaf_io_obj libcaf_io) io.worker)
caf_export_and_install_lib(io) if(CAF_ENABLE_TESTING AND UNIX)
# -- build unit tests ----------------------------------------------------------
if(NOT CAF_ENABLE_TESTING)
return()
endif()
add_executable(caf-io-test
test/io-test.cpp
$<TARGET_OBJECTS:libcaf_io_obj>)
caf_io_set_default_properties(caf-io-test)
target_include_directories(caf-io-test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/test")
target_link_libraries(caf-io-test PRIVATE CAF::test)
caf_add_test_suites(caf-io-test
detail.prometheus_broker
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
)
if(NOT WIN32)
caf_add_test_suites(caf-io-test io.middleman) caf_add_test_suites(caf-io-test io.middleman)
endif() endif()
# -- get header files for creating "proper" XCode projects --------------------- # -- collect header files ------------------------------------------------------
file(GLOB_RECURSE CAF_OPENSSL_HEADERS "caf/*.hpp") file(GLOB_RECURSE CAF_OPENSSL_HEADERS "caf/*.hpp")
...@@ -8,55 +8,27 @@ if(NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto) ...@@ -8,55 +8,27 @@ if(NOT TARGET OpenSSL::SSL OR NOT TARGET OpenSSL::Crypto)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
endif() endif()
# -- utility function for setting default properties --------------------------- # -- add targets ---------------------------------------------------------------
function(caf_openssl_set_default_properties) caf_add_component(
foreach(target ${ARGN}) openssl
# Set global defaults and set EXPORTS flag. DEPENDENCIES
caf_set_default_properties(${target}) PUBLIC
target_compile_definitions(${target} PRIVATE libcaf_openssl_EXPORTS) CAF::io
# Pull in public dependencies. OpenSSL::SSL
caf_target_link_libraries(${target} PUBLIC OpenSSL::Crypto
CAF::core CAF::io OpenSSL::SSL OpenSSL::Crypto) PRIVATE
endforeach() CAF::internal
endfunction() HEADERS
${CAF_OPENSSL_HEADERS}
# -- add library target -------------------------------------------------------- SOURCES
src/openssl/manager.cpp
add_library(libcaf_openssl_obj OBJECT ${CAF_OPENSSL_HEADERS} src/openssl/middleman_actor.cpp
src/openssl/manager.cpp src/openssl/publish.cpp
src/openssl/middleman_actor.cpp src/openssl/remote_actor.cpp
src/openssl/publish.cpp src/openssl/session.cpp
src/openssl/remote_actor.cpp TEST_SOURCES
src/openssl/session.cpp test/openssl-test.cpp
) TEST_SUITES
openssl.authentication
add_library(libcaf_openssl openssl.remote_actor)
"${PROJECT_SOURCE_DIR}/cmake/dummy.cpp"
$<TARGET_OBJECTS:libcaf_openssl_obj>)
caf_openssl_set_default_properties(libcaf_openssl_obj libcaf_openssl)
caf_export_and_install_lib(openssl)
# -- build unit tests ----------------------------------------------------------
if(NOT CAF_ENABLE_TESTING)
return()
endif()
add_executable(caf-openssl-test
test/openssl-test.cpp
${CAF_OPENSSL_TEST_SOURCES}
$<TARGET_OBJECTS:libcaf_openssl_obj>)
caf_openssl_set_default_properties(caf-openssl-test)
target_include_directories(caf-openssl-test PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/test")
target_link_libraries(caf-openssl-test PRIVATE CAF::test)
caf_add_test_suites(caf-openssl-test
openssl.authentication
openssl.remote_actor
)
...@@ -7,13 +7,13 @@ macro(add name) ...@@ -7,13 +7,13 @@ macro(add name)
endmacro() endmacro()
add(caf-vec) add(caf-vec)
target_link_libraries(caf-vec PRIVATE CAF::core) target_link_libraries(caf-vec PRIVATE CAF::internal CAF::core)
if(TARGET CAF::io) if(TARGET CAF::io)
if(WIN32) if(WIN32)
message(STATUS "skip caf-run (not supported on Windows)") message(STATUS "Skip caf-run (not supported on Windows)")
else() else()
add(caf-run) add(caf-run)
target_link_libraries(caf-run PRIVATE CAF::io CAF::core) target_link_libraries(caf-run PRIVATE CAF::internal CAF::io)
endif() endif()
endif() endif()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment