Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
65a7dae4
Commit
65a7dae4
authored
Dec 16, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework libcaf_net CMakeLists.txt
parent
d6b9e2c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
47 deletions
+105
-47
libcaf_net/CMakeLists.txt
libcaf_net/CMakeLists.txt
+105
-47
No files found.
libcaf_net/CMakeLists.txt
View file @
65a7dae4
# get header files; only needed by CMake generators,
# e.g., for creating proper Xcode projects
file
(
GLOB_RECURSE LIBCAF_NET_HDRS
"caf/*.hpp"
)
# -- get header files for creating "proper" XCode projects ---------------------
file
(
GLOB_RECURSE CAF_NET_HEADERS
"caf/*.hpp"
)
# -- auto generate to_string for enum types ------------------------------------
enum_to_string
(
"caf/net/basp/connection_state.hpp"
"basp_conn_strings.cpp"
)
enum_to_string
(
"caf/net/basp/ec.hpp"
"basp_ec_strings.cpp"
)
enum_to_string
(
"caf/net/basp/message_type.hpp"
"basp_message_type_strings.cpp"
)
enum_to_string
(
"caf/net/operation.hpp"
"operation_strings.cpp"
)
# list cpp files excluding platform-dependent files
set
(
LIBCAF_NET_SRCS
"
${
CMAKE_CURRENT_BINARY_DIR
}
/basp_conn_strings.cpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/basp_ec_strings.cpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/basp_message_type_strings.cpp"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/operation_strings.cpp"
# -- list cpp files for caf::net -----------------------------------------------
set
(
CAF_NET_SOURCES
"
${
CMAKE_BINARY_DIR
}
/basp_conn_strings.cpp"
"
${
CMAKE_BINARY_DIR
}
/basp_ec_strings.cpp"
"
${
CMAKE_BINARY_DIR
}
/basp_message_type_strings.cpp"
"
${
CMAKE_BINARY_DIR
}
/operation_strings.cpp"
src/actor_proxy_impl.cpp
src/application.cpp
src/convert_ip_endpoint.cpp
...
...
@@ -43,44 +46,99 @@ set(LIBCAF_NET_SRCS
src/worker.cpp
)
add_custom_target
(
libcaf_net
)
# build shared library if not compiling static only
if
(
NOT CAF_BUILD_STATIC_ONLY
)
add_library
(
libcaf_net_shared SHARED
${
LIBCAF_NET_SRCS
}
${
LIBCAF_NET_HDRS
}
)
target_link_libraries
(
libcaf_net_shared
${
CAF_EXTRA_LDFLAGS
}
${
CAF_LIBRARY_CORE
}
)
target_include_directories
(
libcaf_net_shared PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
libcaf_net_shared
PROPERTIES
# -- list cpp files for caf-net-test ------------------------------------------
set
(
CAF_NET_TEST_SOURCES
test/net/basp/message_queue.cpp
test/net/basp/ping_pong.cpp
test/net/basp/worker.cpp
test/accept_socket.cpp
test/pipe_socket.cpp
test/application.cpp
test/socket.cpp
test/convert_ip_endpoint.cpp
test/socket_guard.cpp
test/datagram_socket.cpp
test/stream_application.cpp
test/datagram_transport.cpp
test/stream_socket.cpp
test/doorman.cpp
test/stream_transport.cpp
test/endpoint_manager.cpp
test/string_application.cpp
test/header.cpp
test/tcp_sockets.cpp
test/ip.cpp
test/transport_worker.cpp
test/multiplexer.cpp
test/transport_worker_dispatcher.cpp
test/udp_datagram_socket.cpp
test/network_socket.cpp
)
# -- add library target --------------------------------------------------------
add_library
(
libcaf_net_obj OBJECT
${
CAF_NET_SOURCES
}
${
CAF_NET_HEADERS
}
)
add_library
(
libcaf_net $<TARGET_OBJECTS:libcaf_net_obj>
)
add_library
(
caf::net ALIAS libcaf_net
)
if
(
BUILD_SHARED_LIBS AND NOT WIN32
)
target_compile_options
(
libcaf_net PRIVATE -fPIC
)
target_compile_options
(
libcaf_net_obj PRIVATE -fPIC
)
endif
()
target_link_libraries
(
libcaf_net PUBLIC
${
CAF_EXTRA_LDFLAGS
}
)
generate_export_header
(
libcaf_net
EXPORT_MACRO_NAME CAF_NET_EXPORT
EXPORT_FILE_NAME
"
${
CMAKE_BINARY_DIR
}
/caf/detail/net_export.hpp"
STATIC_DEFINE CAF_STATIC_BUILD
)
target_compile_definitions
(
libcaf_net_obj PRIVATE libcaf_net_EXPORTS
)
set_target_properties
(
libcaf_net PROPERTIES
EXPORT_NAME net
SOVERSION
${
CAF_VERSION
}
VERSION
${
CAF_LIB_VERSION
}
OUTPUT_NAME caf_net
)
install
(
TARGETS libcaf_net_shared
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
)
add_dependencies
(
libcaf_net_shared libcaf_net
)
endif
()
# build static library only if --build-static or --build-static-only was set
if
(
CAF_BUILD_STATIC_ONLY OR CAF_BUILD_STATIC
)
add_library
(
libcaf_net_static STATIC
${
LIBCAF_NET_HDRS
}
${
LIBCAF_NET_SRCS
}
)
target_link_libraries
(
libcaf_net_static
${
CAF_EXTRA_LDFLAGS
}
${
CAF_LIBRARY_CORE_STATIC
}
)
target_include_directories
(
libcaf_net_static PUBLIC
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_BINARY_DIR
}
>
$<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
>
$<INSTALL_INTERFACE:include>
)
set_target_properties
(
libcaf_net_static PROPERTIES OUTPUT_NAME caf_net_static
)
install
(
TARGETS libcaf_net_static ARCHIVE DESTINATION lib
)
add_dependencies
(
libcaf_net_static libcaf_net
)
endif
()
OUTPUT_NAME caf_net
)
# -- install library and header files ------------------------------------------
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/caf/detail/build_config.hpp"
"
${
CMAKE_BINARY_DIR
}
/caf/detail/net_export.hpp"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/caf/detail"
)
install
(
TARGETS libcaf_net
EXPORT CAFTargets
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT net
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
COMPONENT net
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT net
)
install
(
DIRECTORY
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/caf"
DESTINATION include
DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
COMPONENT net
FILES_MATCHING PATTERN
"*.hpp"
)
# -- build unit tests ----------------------------------------------------------
if
(
NOT CAF_NO_UNIT_TESTS
)
add_executable
(
caf-net-test
"
${
CAF_ROOT_DIR
}
/../libcaf_test/src/caf-test.cpp"
"
${
CAF_ROOT_DIR
}
/../libcaf_test/caf/test/unit_test.hpp"
"
${
CAF_ROOT_DIR
}
/../libcaf_test/caf/test/unit_test_impl.hpp"
${
CAF_NET_TEST_SOURCES
}
$<TARGET_OBJECTS:libcaf_net_obj>
)
target_compile_definitions
(
caf-net-test PRIVATE libcaf_net_EXPORTS
)
target_link_libraries
(
caf-net-test
${
CAF_EXTRA_LDFLAGS
}
)
add_test_suites
(
caf-net-test
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
${
CAF_NET_TEST_SOURCES
}
)
endif
()
# -- add this library to the global CAF_LIBRARIES ------------------------------
list
(
APPEND CAF_LIBRARIES libcaf_net
)
set
(
CAF_LIBRARIES
${
CAF_LIBRARIES
}
PARENT_SCOPE
)
\ No newline at end of file
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