diff --git a/asio/CMakeLists.txt b/asio/CMakeLists.txt new file mode 100644 index 0000000000..d51f8192a0 --- /dev/null +++ b/asio/CMakeLists.txt @@ -0,0 +1,189 @@ +# Minimum supported CMake version +cmake_minimum_required(VERSION 3.1.2 FATAL_ERROR) + +if(CONAN_COMPILER) + + # ======================================== + project(asio VERSION ${CONAN_PACKAGE_VERSION} LANGUAGES CXX) + # ======================================== + + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_basic_setup(TARGETS) # this set CONAN_TARGETS + +else() + + # use ccache and clang++ if found + find_program(CCACHE_EXECUTABLE "ccache" HINTS /opt/local/bin) + if(CCACHE_EXECUTABLE AND NOT CMAKE_TOOLCHAIN_FILE) + message(STATUS "use ccache") + find_program(CLANGXX_EXECUTABLE "clang++" HINTS /opt/local/bin) + if(CLANGXX_EXECUTABLE) + set(GXX_EXECUTABLE ${CLANGXX_EXECUTABLE}) + else() + find_program(GXX_EXECUTABLE "g++" HINTS /opt/local/bin) + set(CMAKE_COMPILER_IS_GNUCXX yes) + endif() + if(GXX_EXECUTABLE) + set(CMAKE_CXX_COMPILER "${CCACHE_EXECUTABLE}" CACHE PATH "ccache" FORCE) + set(CMAKE_CXX_COMPILER_ARG1 ${GXX_EXECUTABLE} CACHE PATH "the real c++" FORCE) + endif() + endif() + + # ======================================== + project(asio VERSION 1.11.0 LANGUAGES CXX) + # ======================================== + +endif() + + +# ======================================== +# ASIO Options +# ======================================== +option(ASIO_NO_DEPRECATED "Build asio without deprecated interfaces" OFF) +option(ASIO_STANDALONE "Build asio without boost" ON) +option(ASIO_BUILD_TESTS "Build asio unittest too" OFF) +option(ASIO_BUILD_EXAMPLES "Build asio examples too" OFF) +option(ASIO_ENABLE_HANDLER_TRACKING "enable handler tracking" ON) +option(ASIO_DISABLE_KQUEUE "disable kqueue" OFF) +option(ASIO_DISABLE_EPOLL "disable epoll" OFF) +option(ASIO_USE_CLANG_TIDY "use clang-tidy if found" OFF) + + +# +# Where to put all the RUNTIME targets when built. This variable is used to +# initialize the RUNTIME_OUTPUT_DIRECTORY property on all the targets. +# +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) + + +if(NOT CONAN_COMPILER AND WIN32) + add_definitions(-D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS + -DASIO_HAS_VARIADIC_TEMPLATES -DASIO_DISABLE_CONSTEXPR) + set(EXTRA_LIBS wsock32 ws2_32) +else() + set(EXTRA_LIBS ${CONAN_TARGETS}) +endif() + + +if(NOT CONAN_COMPILER AND ${CMAKE_HOST_SYSTEM_NAME} MATCHES "MINGW.*") + add_definitions(-D_WIN32_WINNT=0x0501 -D__USE_W32_SOCKETS) +endif() + +if (ASIO_ENABLE_HANDLER_TRACKING) + message(STATUS "enable handler tracking") + add_definitions(-DASIO_ENABLE_HANDLER_TRACKING) +endif() + +if (ASIO_DISABLE_KQUEUE) + message(STATUS "disble queue") + add_definitions(-DASIO_DISABLE_KQUEUE) +endif() + +if (ASIO_DISABLE_EPOLL) + message(STATUS "disable epoll") + add_definitions(-DASIO_DISABLE_EPOLL) +endif() + +if (ASIO_USE_CLANG_TIDY) + message(STATUS "use clang-tidy") + find_program(CMAKE_CXX_CLANG_TIDY "clang-tidy" HINTS /opt/local/bin) +endif() + +if(NOT CONAN_COMPILER) + if(CMAKE_COMPILER_IS_GNUCXX OR __COMPILER_CLANG) + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -Wextra) + endif() + + + if(NOT ASIO_STANDALONE) + ####################################################################### + # use boost if found + option(Boost_USE_MULTITHREADED "Set to OFF to use the non-multithreaded" ON) + option(Boost_DEBUG "Set to ON to enable debug output from FindBoost." OFF) + option(Boost_DETAILED_FAILURE_MSG "Set to ON to get detailed information" ON) + # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. + set(Boost_NO_BOOST_CMAKE ON) + set(BOOST_ROOT "/opt/local" CACHE FILEPATH "path to the boost lib") + set(Boost_USE_STATIC_LIBS OFF) + if(WIN32) + set(Boost_USE_STATIC_RUNTIME OFF) + endif() + find_package(Boost 1.65 COMPONENTS atomic chrono coroutine context date_time + thread system) + ####################################################################### + + if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) + link_directories(${Boost_LIBRARY_DIRS}) + add_definitions(-DBOOST_ALL_NO_LIB=1 + -DBOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + ###TBD### -DASIO_HAS_BOOST_DATE_TIME=1 + ) + set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} ) + endif() + ####################################################################### + endif() + + + ####################################################################### + # use openssl if found + set(OpenSSL_ROOT_DIR "/opt/local" CACHE FILEPATH "path to the openssl lib") + find_package(OpenSSL QUIET NO_MODULE HINTS ${OpenSSL_ROOT_DIR}) + ####################################################################### + + if(OpenSSL_FOUND) + set(EXTRA_LIBS ${EXTRA_LIBS} ${openSSL_LIBRARIES}) + message(STATUS "HAVE_OPENSSL") + add_definitions(-DHAVE_OPENSSL) + include_directories(BEFORE ${openSSL_INCLUDE_DIR}) + else() + find_library(OpenSSL_LIBRARY ssl HINTS ${OpenSSL_ROOT_DIR}/lib ) + find_library(CRYPTO_LIBRARY crypto HINTS ${OpenSSL_ROOT_DIR}/lib ) + if(OpenSSL_LIBRARY AND CRYPTO_LIBRARY ) + set(OpenSSL_FOUND ON) + message(STATUS "USE CRYPTO_LIBRARY") + add_definitions(-DHAVE_OPENSSL) + set(EXTRA_LIBS ${EXTRA_LIBS} ${OpenSSL_LIBRARY} ${CRYPTO_LIBRARY}) + include_directories(BEFORE ${OpenSSL_ROOT_DIR}/include) + endif() + endif() + ####################################################################### +else() + message(STATUS "ASIO USE CONAN_TARGETS") + add_definitions(-DHAVE_OPENSSL) +endif() + + +# Installation configuration +include(GNUInstallDirs) +set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/asio) + +# Interface library +add_subdirectory(include) + + +if($ENV{CONAN_RUN_TESTS}) + set(ASIO_BUILD_TESTS ON CACHE BOOL "" FORCE) + message(STATUS "ASIO CONAN_RUN_TESTS") +endif() + +if(ASIO_BUILD_EXAMPLES OR ASIO_BUILD_TESTS) + # enable ctest + enable_testing() + + # Sources: examples, tests + add_subdirectory(src) +endif() + + +# Installation +configure_file(asio-config-version.cmake.in asio-config-version.cmake @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asio-config-version.cmake + DESTINATION ${ConfigPackageLocation}) +install(EXPORT asio-targets + DESTINATION ${ConfigPackageLocation} + NAMESPACE asio::) +install(FILES asio-config.cmake DESTINATION ${ConfigPackageLocation}) + diff --git a/asio/asio-config-version.cmake.in b/asio/asio-config-version.cmake.in new file mode 100644 index 0000000000..f0c23a1d6c --- /dev/null +++ b/asio/asio-config-version.cmake.in @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION "@asio_VERSION@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/asio/asio-config.cmake b/asio/asio-config.cmake new file mode 100644 index 0000000000..57659c2434 --- /dev/null +++ b/asio/asio-config.cmake @@ -0,0 +1 @@ +include(${CMAKE_CURRENT_LIST_DIR}/asio-targets.cmake) diff --git a/asio/include/CMakeLists.txt b/asio/include/CMakeLists.txt new file mode 100644 index 0000000000..3ffb6ab8cb --- /dev/null +++ b/asio/include/CMakeLists.txt @@ -0,0 +1,516 @@ +# List of public headers +# find . -name "*.*pp" | sed -e 's/^\.\///' | sed -e 's/^.*\/src.cpp$/#NO! &/' | sort > header-sorted.txt +set(asio_PUBLIC_HEADERS +asio.hpp +asio/associated_allocator.hpp +asio/associated_executor.hpp +asio/async_result.hpp +asio/basic_datagram_socket.hpp +asio/basic_deadline_timer.hpp +asio/basic_io_object.hpp +asio/basic_raw_socket.hpp +asio/basic_seq_packet_socket.hpp +asio/basic_serial_port.hpp +asio/basic_signal_set.hpp +asio/basic_socket.hpp +asio/basic_socket_acceptor.hpp +asio/basic_socket_iostream.hpp +asio/basic_socket_streambuf.hpp +asio/basic_stream_socket.hpp +asio/basic_streambuf.hpp +asio/basic_streambuf_fwd.hpp +asio/basic_waitable_timer.hpp +asio/bind_executor.hpp +asio/buffer.hpp +asio/buffered_read_stream.hpp +asio/buffered_read_stream_fwd.hpp +asio/buffered_stream.hpp +asio/buffered_stream_fwd.hpp +asio/buffered_write_stream.hpp +asio/buffered_write_stream_fwd.hpp +asio/buffers_iterator.hpp +asio/completion_condition.hpp +asio/connect.hpp +asio/coroutine.hpp +asio/datagram_socket_service.hpp +asio/deadline_timer.hpp +asio/deadline_timer_service.hpp +asio/defer.hpp +asio/detail/array.hpp +asio/detail/array_fwd.hpp +asio/detail/assert.hpp +asio/detail/atomic_count.hpp +asio/detail/base_from_completion_cond.hpp +asio/detail/bind_handler.hpp +asio/detail/buffer_resize_guard.hpp +asio/detail/buffer_sequence_adapter.hpp +asio/detail/buffered_stream_storage.hpp +asio/detail/call_stack.hpp +asio/detail/chrono.hpp +asio/detail/chrono_time_traits.hpp +asio/detail/completion_handler.hpp +asio/detail/concurrency_hint.hpp +asio/detail/conditionally_enabled_event.hpp +asio/detail/conditionally_enabled_mutex.hpp +asio/detail/config.hpp +asio/detail/consuming_buffers.hpp +asio/detail/cstddef.hpp +asio/detail/cstdint.hpp +asio/detail/date_time_fwd.hpp +asio/detail/deadline_timer_service.hpp +asio/detail/dependent_type.hpp +asio/detail/descriptor_ops.hpp +asio/detail/descriptor_read_op.hpp +asio/detail/descriptor_write_op.hpp +asio/detail/dev_poll_reactor.hpp +asio/detail/epoll_reactor.hpp +asio/detail/event.hpp +asio/detail/eventfd_select_interrupter.hpp +asio/detail/executor_op.hpp +asio/detail/fd_set_adapter.hpp +asio/detail/fenced_block.hpp +asio/detail/functional.hpp +asio/detail/gcc_arm_fenced_block.hpp +asio/detail/gcc_hppa_fenced_block.hpp +asio/detail/gcc_sync_fenced_block.hpp +asio/detail/gcc_x86_fenced_block.hpp +asio/detail/global.hpp +asio/detail/handler_alloc_helpers.hpp +asio/detail/handler_cont_helpers.hpp +asio/detail/handler_invoke_helpers.hpp +asio/detail/handler_tracking.hpp +asio/detail/handler_type_requirements.hpp +asio/detail/handler_work.hpp +asio/detail/hash_map.hpp +asio/detail/impl/buffer_sequence_adapter.ipp +asio/detail/impl/descriptor_ops.ipp +asio/detail/impl/dev_poll_reactor.hpp +asio/detail/impl/dev_poll_reactor.ipp +asio/detail/impl/epoll_reactor.hpp +asio/detail/impl/epoll_reactor.ipp +asio/detail/impl/eventfd_select_interrupter.ipp +asio/detail/impl/handler_tracking.ipp +asio/detail/impl/kqueue_reactor.hpp +asio/detail/impl/kqueue_reactor.ipp +asio/detail/impl/null_event.ipp +asio/detail/impl/pipe_select_interrupter.ipp +asio/detail/impl/posix_event.ipp +asio/detail/impl/posix_mutex.ipp +asio/detail/impl/posix_thread.ipp +asio/detail/impl/posix_tss_ptr.ipp +asio/detail/impl/reactive_descriptor_service.ipp +asio/detail/impl/reactive_serial_port_service.ipp +asio/detail/impl/reactive_socket_service_base.ipp +asio/detail/impl/resolver_service_base.ipp +asio/detail/impl/scheduler.ipp +asio/detail/impl/select_reactor.hpp +asio/detail/impl/select_reactor.ipp +asio/detail/impl/service_registry.hpp +asio/detail/impl/service_registry.ipp +asio/detail/impl/signal_set_service.ipp +asio/detail/impl/socket_ops.ipp +asio/detail/impl/socket_select_interrupter.ipp +asio/detail/impl/strand_executor_service.hpp +asio/detail/impl/strand_executor_service.ipp +asio/detail/impl/strand_service.hpp +asio/detail/impl/strand_service.ipp +asio/detail/impl/throw_error.ipp +asio/detail/impl/timer_queue_ptime.ipp +asio/detail/impl/timer_queue_set.ipp +asio/detail/impl/win_event.ipp +asio/detail/impl/win_iocp_handle_service.ipp +asio/detail/impl/win_iocp_io_context.hpp +asio/detail/impl/win_iocp_io_context.ipp +asio/detail/impl/win_iocp_serial_port_service.ipp +asio/detail/impl/win_iocp_socket_service_base.ipp +asio/detail/impl/win_mutex.ipp +asio/detail/impl/win_object_handle_service.ipp +asio/detail/impl/win_static_mutex.ipp +asio/detail/impl/win_thread.ipp +asio/detail/impl/win_tss_ptr.ipp +asio/detail/impl/winrt_ssocket_service_base.ipp +asio/detail/impl/winrt_timer_scheduler.hpp +asio/detail/impl/winrt_timer_scheduler.ipp +asio/detail/impl/winsock_init.ipp +asio/detail/io_control.hpp +asio/detail/is_buffer_sequence.hpp +asio/detail/is_executor.hpp +asio/detail/keyword_tss_ptr.hpp +asio/detail/kqueue_reactor.hpp +asio/detail/limits.hpp +asio/detail/local_free_on_block_exit.hpp +asio/detail/macos_fenced_block.hpp +asio/detail/memory.hpp +asio/detail/mutex.hpp +asio/detail/noncopyable.hpp +asio/detail/null_event.hpp +asio/detail/null_fenced_block.hpp +asio/detail/null_global.hpp +asio/detail/null_mutex.hpp +asio/detail/null_reactor.hpp +asio/detail/null_signal_blocker.hpp +asio/detail/null_socket_service.hpp +asio/detail/null_static_mutex.hpp +asio/detail/null_thread.hpp +asio/detail/null_tss_ptr.hpp +asio/detail/object_pool.hpp +asio/detail/old_win_sdk_compat.hpp +asio/detail/op_queue.hpp +asio/detail/operation.hpp +asio/detail/pipe_select_interrupter.hpp +asio/detail/pop_options.hpp +asio/detail/posix_event.hpp +asio/detail/posix_fd_set_adapter.hpp +asio/detail/posix_global.hpp +asio/detail/posix_mutex.hpp +asio/detail/posix_signal_blocker.hpp +asio/detail/posix_static_mutex.hpp +asio/detail/posix_thread.hpp +asio/detail/posix_tss_ptr.hpp +asio/detail/push_options.hpp +asio/detail/reactive_descriptor_service.hpp +asio/detail/reactive_null_buffers_op.hpp +asio/detail/reactive_serial_port_service.hpp +asio/detail/reactive_socket_accept_op.hpp +asio/detail/reactive_socket_connect_op.hpp +asio/detail/reactive_socket_recv_op.hpp +asio/detail/reactive_socket_recvfrom_op.hpp +asio/detail/reactive_socket_recvmsg_op.hpp +asio/detail/reactive_socket_send_op.hpp +asio/detail/reactive_socket_sendto_op.hpp +asio/detail/reactive_socket_service.hpp +asio/detail/reactive_socket_service_base.hpp +asio/detail/reactive_wait_op.hpp +asio/detail/reactor.hpp +asio/detail/reactor_fwd.hpp +asio/detail/reactor_op.hpp +asio/detail/reactor_op_queue.hpp +asio/detail/recycling_allocator.hpp +asio/detail/regex_fwd.hpp +asio/detail/resolve_endpoint_op.hpp +asio/detail/resolve_op.hpp +asio/detail/resolve_query_op.hpp +asio/detail/resolver_service.hpp +asio/detail/resolver_service_base.hpp +asio/detail/scheduler.hpp +asio/detail/scheduler_operation.hpp +asio/detail/scheduler_thread_info.hpp +asio/detail/scoped_lock.hpp +asio/detail/scoped_ptr.hpp +asio/detail/select_interrupter.hpp +asio/detail/select_reactor.hpp +asio/detail/service_registry.hpp +asio/detail/signal_blocker.hpp +asio/detail/signal_handler.hpp +asio/detail/signal_init.hpp +asio/detail/signal_op.hpp +asio/detail/signal_set_service.hpp +asio/detail/socket_holder.hpp +asio/detail/socket_ops.hpp +asio/detail/socket_option.hpp +asio/detail/socket_select_interrupter.hpp +asio/detail/socket_types.hpp +asio/detail/solaris_fenced_block.hpp +asio/detail/static_mutex.hpp +asio/detail/std_event.hpp +asio/detail/std_fenced_block.hpp +asio/detail/std_global.hpp +asio/detail/std_mutex.hpp +asio/detail/std_static_mutex.hpp +asio/detail/std_thread.hpp +asio/detail/strand_executor_service.hpp +asio/detail/strand_service.hpp +asio/detail/string_view.hpp +asio/detail/thread.hpp +asio/detail/thread_context.hpp +asio/detail/thread_group.hpp +asio/detail/thread_info_base.hpp +asio/detail/throw_error.hpp +asio/detail/throw_exception.hpp +asio/detail/timer_queue.hpp +asio/detail/timer_queue_base.hpp +asio/detail/timer_queue_ptime.hpp +asio/detail/timer_queue_set.hpp +asio/detail/timer_scheduler.hpp +asio/detail/timer_scheduler_fwd.hpp +asio/detail/tss_ptr.hpp +asio/detail/type_traits.hpp +asio/detail/variadic_templates.hpp +asio/detail/wait_handler.hpp +asio/detail/wait_op.hpp +asio/detail/win_event.hpp +asio/detail/win_fd_set_adapter.hpp +asio/detail/win_fenced_block.hpp +asio/detail/win_global.hpp +asio/detail/win_iocp_handle_read_op.hpp +asio/detail/win_iocp_handle_service.hpp +asio/detail/win_iocp_handle_write_op.hpp +asio/detail/win_iocp_io_context.hpp +asio/detail/win_iocp_null_buffers_op.hpp +asio/detail/win_iocp_operation.hpp +asio/detail/win_iocp_overlapped_op.hpp +asio/detail/win_iocp_overlapped_ptr.hpp +asio/detail/win_iocp_serial_port_service.hpp +asio/detail/win_iocp_socket_accept_op.hpp +asio/detail/win_iocp_socket_connect_op.hpp +asio/detail/win_iocp_socket_recv_op.hpp +asio/detail/win_iocp_socket_recvfrom_op.hpp +asio/detail/win_iocp_socket_recvmsg_op.hpp +asio/detail/win_iocp_socket_send_op.hpp +asio/detail/win_iocp_socket_service.hpp +asio/detail/win_iocp_socket_service_base.hpp +asio/detail/win_iocp_thread_info.hpp +asio/detail/win_iocp_wait_op.hpp +asio/detail/win_mutex.hpp +asio/detail/win_object_handle_service.hpp +asio/detail/win_static_mutex.hpp +asio/detail/win_thread.hpp +asio/detail/win_tss_ptr.hpp +asio/detail/winapp_thread.hpp +asio/detail/wince_thread.hpp +asio/detail/winrt_async_manager.hpp +asio/detail/winrt_async_op.hpp +asio/detail/winrt_resolve_op.hpp +asio/detail/winrt_resolver_service.hpp +asio/detail/winrt_socket_connect_op.hpp +asio/detail/winrt_socket_recv_op.hpp +asio/detail/winrt_socket_send_op.hpp +asio/detail/winrt_ssocket_service.hpp +asio/detail/winrt_ssocket_service_base.hpp +asio/detail/winrt_timer_scheduler.hpp +asio/detail/winrt_utils.hpp +asio/detail/winsock_init.hpp +asio/detail/work_dispatcher.hpp +asio/detail/wrapped_handler.hpp +asio/dispatch.hpp +asio/error.hpp +asio/error_code.hpp +asio/execution_context.hpp +asio/executor.hpp +asio/executor_work_guard.hpp +asio/generic/basic_endpoint.hpp +asio/generic/datagram_protocol.hpp +asio/generic/detail/endpoint.hpp +asio/generic/detail/impl/endpoint.ipp +asio/generic/raw_protocol.hpp +asio/generic/seq_packet_protocol.hpp +asio/generic/stream_protocol.hpp +asio/handler_alloc_hook.hpp +asio/handler_continuation_hook.hpp +asio/handler_invoke_hook.hpp +asio/handler_type.hpp +asio/high_resolution_timer.hpp +asio/impl/buffered_read_stream.hpp +asio/impl/buffered_write_stream.hpp +asio/impl/connect.hpp +asio/impl/defer.hpp +asio/impl/dispatch.hpp +asio/impl/error.ipp +asio/impl/error_code.ipp +asio/impl/execution_context.hpp +asio/impl/execution_context.ipp +asio/impl/executor.hpp +asio/impl/executor.ipp +asio/impl/handler_alloc_hook.ipp +asio/impl/io_context.hpp +asio/impl/io_context.ipp +asio/impl/post.hpp +asio/impl/read.hpp +asio/impl/read_at.hpp +asio/impl/read_until.hpp +asio/impl/serial_port_base.hpp +asio/impl/serial_port_base.ipp +asio/impl/spawn.hpp +#NO! asio/impl/src.cpp +asio/impl/src.hpp +asio/impl/system_context.hpp +asio/impl/system_context.ipp +asio/impl/system_executor.hpp +asio/impl/thread_pool.hpp +asio/impl/thread_pool.ipp +asio/impl/use_future.hpp +asio/impl/write.hpp +asio/impl/write_at.hpp +asio/io_context.hpp +asio/io_context_strand.hpp +asio/io_service.hpp +asio/io_service_strand.hpp +asio/ip/address.hpp +asio/ip/address_v4.hpp +asio/ip/address_v4_iterator.hpp +asio/ip/address_v4_range.hpp +asio/ip/address_v6.hpp +asio/ip/address_v6_iterator.hpp +asio/ip/address_v6_range.hpp +asio/ip/bad_address_cast.hpp +asio/ip/basic_endpoint.hpp +asio/ip/basic_resolver.hpp +asio/ip/basic_resolver_entry.hpp +asio/ip/basic_resolver_iterator.hpp +asio/ip/basic_resolver_query.hpp +asio/ip/basic_resolver_results.hpp +asio/ip/detail/endpoint.hpp +asio/ip/detail/impl/endpoint.ipp +asio/ip/detail/socket_option.hpp +asio/ip/host_name.hpp +asio/ip/icmp.hpp +asio/ip/impl/address.hpp +asio/ip/impl/address.ipp +asio/ip/impl/address_v4.hpp +asio/ip/impl/address_v4.ipp +asio/ip/impl/address_v6.hpp +asio/ip/impl/address_v6.ipp +asio/ip/impl/basic_endpoint.hpp +asio/ip/impl/host_name.ipp +asio/ip/impl/network_v4.hpp +asio/ip/impl/network_v4.ipp +asio/ip/impl/network_v6.hpp +asio/ip/impl/network_v6.ipp +asio/ip/multicast.hpp +asio/ip/network_v4.hpp +asio/ip/network_v6.hpp +asio/ip/resolver_base.hpp +asio/ip/resolver_query_base.hpp +asio/ip/resolver_service.hpp +asio/ip/tcp.hpp +asio/ip/udp.hpp +asio/ip/unicast.hpp +asio/ip/v6_only.hpp +asio/is_executor.hpp +asio/is_read_buffered.hpp +asio/is_write_buffered.hpp +asio/local/basic_endpoint.hpp +asio/local/connect_pair.hpp +asio/local/datagram_protocol.hpp +asio/local/detail/endpoint.hpp +asio/local/detail/impl/endpoint.ipp +asio/local/stream_protocol.hpp +asio/packaged_task.hpp +asio/placeholders.hpp +asio/posix/basic_descriptor.hpp +asio/posix/basic_stream_descriptor.hpp +asio/posix/descriptor.hpp +asio/posix/descriptor_base.hpp +asio/posix/stream_descriptor.hpp +asio/posix/stream_descriptor_service.hpp +asio/post.hpp +asio/raw_socket_service.hpp +asio/read.hpp +asio/read_at.hpp +asio/read_until.hpp +asio/seq_packet_socket_service.hpp +asio/serial_port.hpp +asio/serial_port_base.hpp +asio/serial_port_service.hpp +asio/signal_set.hpp +asio/signal_set_service.hpp +asio/socket_acceptor_service.hpp +asio/socket_base.hpp +asio/spawn.hpp +asio/ssl.hpp +asio/ssl/context.hpp +asio/ssl/context_base.hpp +asio/ssl/detail/buffered_handshake_op.hpp +asio/ssl/detail/engine.hpp +asio/ssl/detail/handshake_op.hpp +asio/ssl/detail/impl/engine.ipp +asio/ssl/detail/impl/openssl_init.ipp +asio/ssl/detail/io.hpp +asio/ssl/detail/openssl_init.hpp +asio/ssl/detail/openssl_types.hpp +asio/ssl/detail/password_callback.hpp +asio/ssl/detail/read_op.hpp +asio/ssl/detail/shutdown_op.hpp +asio/ssl/detail/stream_core.hpp +asio/ssl/detail/verify_callback.hpp +asio/ssl/detail/write_op.hpp +asio/ssl/error.hpp +asio/ssl/impl/context.hpp +asio/ssl/impl/context.ipp +asio/ssl/impl/error.ipp +asio/ssl/impl/rfc2818_verification.ipp +asio/ssl/impl/src.hpp +asio/ssl/rfc2818_verification.hpp +asio/ssl/stream.hpp +asio/ssl/stream_base.hpp +asio/ssl/verify_context.hpp +asio/ssl/verify_mode.hpp +asio/steady_timer.hpp +asio/strand.hpp +asio/stream_socket_service.hpp +asio/streambuf.hpp +asio/system_context.hpp +asio/system_error.hpp +asio/system_executor.hpp +asio/system_timer.hpp +asio/thread.hpp +asio/thread_pool.hpp +asio/time_traits.hpp +asio/ts/buffer.hpp +asio/ts/executor.hpp +asio/ts/internet.hpp +asio/ts/io_context.hpp +asio/ts/net.hpp +asio/ts/netfwd.hpp +asio/ts/socket.hpp +asio/ts/timer.hpp +asio/unyield.hpp +asio/use_future.hpp +asio/uses_executor.hpp +asio/version.hpp +asio/wait_traits.hpp +asio/waitable_timer_service.hpp +asio/windows/basic_handle.hpp +asio/windows/basic_object_handle.hpp +asio/windows/basic_random_access_handle.hpp +asio/windows/basic_stream_handle.hpp +asio/windows/object_handle.hpp +asio/windows/object_handle_service.hpp +asio/windows/overlapped_handle.hpp +asio/windows/overlapped_ptr.hpp +asio/windows/random_access_handle.hpp +asio/windows/random_access_handle_service.hpp +asio/windows/stream_handle.hpp +asio/windows/stream_handle_service.hpp +asio/write.hpp +asio/write_at.hpp +asio/yield.hpp +) + + +option(ASIO_SEPARATE_COMPILATION "build asio lib too" ON) + +if(ASIO_SEPARATE_COMPILATION) + set(libasio_SOURCES ../src/asio.cpp) + if(OpenSSL_FOUND) + set(libasio_SOURCES ${libasio_SOURCES} ../src/asio_ssl.cpp) + endif() + + add_definitions(-DASIO_SEPARATE_COMPILATION=1) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + add_library(asio ${libasio_SOURCES} ${asio_PUBLIC_HEADERS}) +endif() + + +# Standalone library +add_library(standalone INTERFACE) + +target_include_directories(standalone INTERFACE + $ + $) +if(Boost_FOUND AND NOT ASIO_STANDALONE) + target_compile_definitions(standalone INTERFACE BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING) +else() + target_compile_definitions(standalone INTERFACE ASIO_STANDALONE) + if (ASIO_NO_DEPRECATED) + target_compile_definitions(standalone INTERFACE ASIO_NO_DEPRECATED) + endif() +endif() + +install(TARGETS standalone EXPORT asio-targets) + +foreach(header ${asio_PUBLIC_HEADERS}) + get_filename_component(path ${header} PATH) + install(FILES ${header} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${path}) +endforeach() + diff --git a/asio/src/CMakeLists.txt b/asio/src/CMakeLists.txt new file mode 100644 index 0000000000..bfa9e333c2 --- /dev/null +++ b/asio/src/CMakeLists.txt @@ -0,0 +1,10 @@ +# build unit tests +if(ASIO_BUILD_TESTS) + add_subdirectory(tests/unit) +endif() + +# Examples +if(ASIO_BUILD_EXAMPLES) + add_subdirectory(examples) +endif() + diff --git a/asio/src/examples/CMakeLists.txt b/asio/src/examples/CMakeLists.txt new file mode 100644 index 0000000000..c39e65f1f6 --- /dev/null +++ b/asio/src/examples/CMakeLists.txt @@ -0,0 +1,41 @@ +# Minimum supported CMake version +cmake_minimum_required(VERSION 3.9 FATAL_ERROR) + +# ================================================= +project(asio_examples VERSION 1.11.0 LANGUAGES CXX) +# ================================================= + +# Options +set(ASIO_BUILD_EXAMPLES_CPP11 ON CACHE BOOL "Build asio C++11 examples") +set(ASIO_BUILD_EXAMPLES_CPP14 ON CACHE BOOL "Build asio C++14 examples") + +# Check asio targets +if(TARGET standalone) + add_library(asio::standalone ALIAS standalone) + set(ASIO_FOUND TRUE) +endif() + +# Find asio package +if(NOT ASIO_FOUND) + find_package(asio CONFIG REQUIRED) +endif() + +# Installation configuration +include(GNUInstallDirs) + +#NOTE: examples and tutorial needs boost date_time! CK +if(Boost_FOUND) + add_subdirectory(cpp03) +else() + message(WARNING "examples/cpp03 needs boost::date_time!") +endif() + +# C++11 only examples +if(ASIO_BUILD_EXAMPLES_CPP11) + add_subdirectory(cpp11) +endif() + +# C++14 only examples +if(ASIO_BUILD_EXAMPLES_CPP14) + add_subdirectory(cpp14) +endif() diff --git a/asio/src/examples/cpp03/CMakeLists.txt b/asio/src/examples/cpp03/CMakeLists.txt new file mode 100644 index 0000000000..7a0a68e39d --- /dev/null +++ b/asio/src/examples/cpp03/CMakeLists.txt @@ -0,0 +1,152 @@ +set(target_prefix asio_cpp03_) + +set(noinst_PROGRAMS + allocation/server + buffers/reference_counted + chat/chat_client + chat/chat_server + echo/async_tcp_echo_server + echo/async_udp_echo_server + echo/blocking_tcp_echo_client + echo/blocking_tcp_echo_server + echo/blocking_udp_echo_client + echo/blocking_udp_echo_server + http/client/async_client + http/client/sync_client + http/server/http_server + http/server2/http_server + http/server3/http_server + http/server4/http_server + icmp/ping + invocation/prioritised_handlers + iostreams/daytime_client + iostreams/daytime_server + iostreams/http_client + multicast/receiver + multicast/sender + nonblocking/third_party_lib + porthopper/client + porthopper/server + services/daytime_client + socks4/sync_client + timeouts/async_tcp_client + timeouts/blocking_tcp_client + timeouts/blocking_udp_client + timeouts/server + timers/time_t_timer + tutorial/timer1/timer + tutorial/timer2/timer + tutorial/timer3/timer + tutorial/timer4/timer + tutorial/timer5/timer + tutorial/daytime1/client + tutorial/daytime2/server + tutorial/daytime3/server + tutorial/daytime4/client + tutorial/daytime5/server + tutorial/daytime6/server + tutorial/daytime7/server +) + +if(OpenSSL_FOUND) + set(noinst_PROGRAMS ${noinst_PROGRAMS} + ssl/client + ssl/server + ) +endif() + +set(allocation_server_SOURCES allocation/server) +set(buffers_reference_counted_SOURCES buffers/reference_counted) +set(chat_chat_client_SOURCES chat/chat_client) +set(chat_chat_server_SOURCES chat/chat_server) +set(echo_async_tcp_echo_server_SOURCES echo/async_tcp_echo_server) +set(echo_async_udp_echo_server_SOURCES echo/async_udp_echo_server) +set(echo_blocking_tcp_echo_client_SOURCES echo/blocking_tcp_echo_client) +set(echo_blocking_tcp_echo_server_SOURCES echo/blocking_tcp_echo_server) +set(echo_blocking_udp_echo_client_SOURCES echo/blocking_udp_echo_client) +set(echo_blocking_udp_echo_server_SOURCES echo/blocking_udp_echo_server) +set(http_client_async_client_SOURCES http/client/async_client) +set(http_client_sync_client_SOURCES http/client/sync_client) +set(http_server_http_server_SOURCES + http/server/connection + http/server/connection_manager + http/server/main + http/server/mime_types + http/server/reply + http/server/request_handler + http/server/request_parser + http/server/server) +set(http_server2_http_server_SOURCES + http/server2/connection + http/server2/io_context_pool + http/server2/main + http/server2/mime_types + http/server2/reply + http/server2/request_handler + http/server2/request_parser + http/server2/server) +set(http_server3_http_server_SOURCES + http/server3/connection + http/server3/main + http/server3/mime_types + http/server3/reply + http/server3/request_handler + http/server3/request_parser + http/server3/server) +set(http_server4_http_server_SOURCES + http/server4/file_handler + http/server4/main + http/server4/mime_types + http/server4/reply + http/server4/request_parser + http/server4/server) +set(icmp_ping_SOURCES icmp/ping) +set(invocation_prioritised_handlers_SOURCES invocation/prioritised_handlers) +set(iostreams_daytime_client_SOURCES iostreams/daytime_client) +set(iostreams_daytime_server_SOURCES iostreams/daytime_server) +set(iostreams_http_client_SOURCES iostreams/http_client) +set(multicast_receiver_SOURCES multicast/receiver) +set(multicast_sender_SOURCES multicast/sender) +set(nonblocking_third_party_lib_SOURCES nonblocking/third_party_lib) +set(porthopper_client_SOURCES porthopper/client) +set(porthopper_server_SOURCES porthopper/server) +set(services_daytime_client_SOURCES + services/daytime_client + services/logger_service) +set(socks4_sync_client_SOURCES socks4/sync_client) +set(timeouts_async_tcp_client_SOURCES timeouts/async_tcp_client) +set(timeouts_blocking_tcp_client_SOURCES timeouts/blocking_tcp_client) +set(timeouts_blocking_udp_client_SOURCES timeouts/blocking_udp_client) +set(timeouts_server_SOURCES timeouts/server) +set(timers_time_t_timer_SOURCES timers/time_t_timer) +set(tutorial_timer1_timer_SOURCES tutorial/timer1/timer) +set(tutorial_timer2_timer_SOURCES tutorial/timer2/timer) +set(tutorial_timer3_timer_SOURCES tutorial/timer3/timer) +set(tutorial_timer4_timer_SOURCES tutorial/timer4/timer) +set(tutorial_timer5_timer_SOURCES tutorial/timer5/timer) +set(tutorial_daytime1_client_SOURCES tutorial/daytime1/client) +set(tutorial_daytime2_server_SOURCES tutorial/daytime2/server) +set(tutorial_daytime3_server_SOURCES tutorial/daytime3/server) +set(tutorial_daytime4_client_SOURCES tutorial/daytime4/client) +set(tutorial_daytime5_server_SOURCES tutorial/daytime5/server) +set(tutorial_daytime6_server_SOURCES tutorial/daytime6/server) +set(tutorial_daytime7_server_SOURCES tutorial/daytime7/server) + +set(ssl_client_SOURCES ssl/client) +set(ssl_server_SOURCES ssl/server) + + +foreach(program ${noinst_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + add_executable(${target_prefix}${target} ${${target}_SOURCES}) + set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 98 + #FIXME CXX_STANDARD 03 + #cmake error: CXX_STANDARD is set to invalid value '03' + ) + target_link_libraries(${target_prefix}${target} asio::standalone) + + if(EXTRA_LIBS) + target_link_libraries(${target_prefix}${target} ${EXTRA_LIBS}) + endif() +endforeach() + diff --git a/asio/src/examples/cpp11/CMakeLists.txt b/asio/src/examples/cpp11/CMakeLists.txt new file mode 100644 index 0000000000..b47a910f75 --- /dev/null +++ b/asio/src/examples/cpp11/CMakeLists.txt @@ -0,0 +1,75 @@ +set(target_prefix asio_cpp11_) + +set(noinst_PROGRAMS + allocation/server + buffers/reference_counted + chat/chat_client + chat/chat_server + echo/async_tcp_echo_server + echo/async_udp_echo_server + echo/blocking_tcp_echo_client + echo/blocking_tcp_echo_server + echo/blocking_udp_echo_client + echo/blocking_udp_echo_server + executors/actor + executors/bank_account_1 + executors/bank_account_2 + executors/fork_join + executors/pipeline + executors/priority_scheduler + futures/daytime_client + http/server/http_server + iostreams/http_client) + + +if(Boost_FOUND) + set(noinst_PROGRAMS ${noinst_PROGRAMS} + spawn/echo_server + spawn/parallel_grep) + set(spawn_echo_server_SOURCES spawn/echo_server) + #XXX spawn_echo_server_LDADD = $(LDADD) -lboost_coroutine -lboost_context -lboost_thread -lboost_chrono -lboost_system + set(spawn_parallel_grep_SOURCES spawn/parallel_grep) + #XXX spawn_parallel_grep_LDADD = $(LDADD) -lboost_coroutine -lboost_context -lboost_thread -lboost_chrono -lboost_system +endif() + + +set(allocation_server_SOURCES allocation/server.cpp) +set(buffers_reference_counted_SOURCES buffers/reference_counted.cpp) +set(chat_chat_client_SOURCES chat/chat_client.cpp) +set(chat_chat_server_SOURCES chat/chat_server.cpp) +set(echo_async_tcp_echo_server_SOURCES echo/async_tcp_echo_server.cpp) +set(echo_async_udp_echo_server_SOURCES echo/async_udp_echo_server.cpp) +set(echo_blocking_tcp_echo_client_SOURCES echo/blocking_tcp_echo_client.cpp) +set(echo_blocking_tcp_echo_server_SOURCES echo/blocking_tcp_echo_server.cpp) +set(echo_blocking_udp_echo_client_SOURCES echo/blocking_udp_echo_client.cpp) +set(echo_blocking_udp_echo_server_SOURCES echo/blocking_udp_echo_server.cpp) +set(executors_actor_SOURCES executors/actor.cpp) +set(executors_bank_account_1_SOURCES executors/bank_account_1.cpp) +set(executors_bank_account_2_SOURCES executors/bank_account_2.cpp) +set(executors_fork_join_SOURCES executors/fork_join.cpp) +set(executors_pipeline_SOURCES executors/pipeline.cpp) +set(executors_priority_scheduler_SOURCES executors/priority_scheduler.cpp) +set(futures_daytime_client_SOURCES futures/daytime_client.cpp) +set(http_server_http_server_SOURCES + http/server/connection.cpp + http/server/connection_manager.cpp + http/server/main.cpp + http/server/mime_types.cpp + http/server/reply.cpp + http/server/request_handler.cpp + http/server/request_parser.cpp + http/server/server.cpp) +set(iostreams_http_client_SOURCES iostreams/http_client.cpp) + +foreach(program ${noinst_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + add_executable(${target_prefix}${target} ${${target}_SOURCES}) + set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 11) + target_link_libraries(${target_prefix}${target} asio::standalone) + + if(EXTRA_LIBS) + target_link_libraries(${target_prefix}${target} ${EXTRA_LIBS}) + endif() +endforeach() + +#TODO: target_compile_features(${target_prefix}executors_priority_scheduler PRIVATE cxx_std_11) diff --git a/asio/src/examples/cpp14/CMakeLists.txt b/asio/src/examples/cpp14/CMakeLists.txt new file mode 100644 index 0000000000..6792979f47 --- /dev/null +++ b/asio/src/examples/cpp14/CMakeLists.txt @@ -0,0 +1,34 @@ +set(target_prefix asio_cpp14_) + +set(noinst_PROGRAMS + echo/async_tcp_echo_server + echo/async_udp_echo_server + echo/blocking_tcp_echo_client + echo/blocking_tcp_echo_server + echo/blocking_udp_echo_client + echo/blocking_udp_echo_server + executors/actor + executors/async_1 + executors/async_2 + executors/bank_account_1 + executors/bank_account_2 + executors/fork_join + executors/pipeline + executors/priority_scheduler + iostreams/http_client) + +foreach(program ${noinst_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + add_executable(${target_prefix}${target} ${program}.cpp) + set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 14) + + target_link_libraries(${target_prefix}${target} asio::standalone) + if(EXTRA_LIBS) + target_link_libraries(${target_prefix}${target} ${EXTRA_LIBS}) + endif() + + # install(TARGETS ${target_prefix}${target} + # RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endforeach() + +#TODO: target_compile_features(${target_prefix}executors_priority_scheduler PRIVATE cxx_std_14) diff --git a/asio/src/tests/unit/CMakeLists.txt b/asio/src/tests/unit/CMakeLists.txt new file mode 100644 index 0000000000..9c71c8bfc7 --- /dev/null +++ b/asio/src/tests/unit/CMakeLists.txt @@ -0,0 +1,180 @@ +set(target_prefix asio_unit_) + +add_library(asio::standalone ALIAS standalone) + +set(null_test_PROGRAMS + associated_allocator + associated_executor + async_result + basic_datagram_socket + basic_deadline_timer + basic_raw_socket + basic_seq_packet_socket + basic_serial_port + basic_signal_set + basic_socket_acceptor + basic_stream_socket + basic_streambuf + basic_waitable_timer + bind_executor + completion_condition + connect + datagram_socket_service + deadline_timer + deadline_timer_service + defer + dispatch + execution_context + executor + executor_work_guard + high_resolution_timer + ip/address_v4_iterator + ip/address_v4_range + ip/address_v6_iterator + ip/address_v6_range + ip/basic_endpoint + ip/basic_resolver + ip/basic_resolver_entry + ip/basic_resolver_iterator + ip/basic_resolver_query + ip/resolver_query_base + ip/resolver_service + local/basic_endpoint + packaged_task + placeholders + posix/basic_descriptor + posix/basic_stream_descriptor + posix/descriptor + posix/descriptor_base + posix/stream_descriptor_service + post + raw_socket_service + seq_packet_socket_service + serial_port_service + signal_set_service + socket_acceptor_service + steady_timer + stream_socket_service + thread + time_traits + uses_executor + wait_traits + waitable_timer_service + windows/basic_handle + windows/basic_object_handle + windows/basic_random_access_handle + windows/basic_stream_handle + windows/object_handle_service + windows/overlapped_handle + windows/random_access_handle_service + windows/stream_handle_service +) + +set(noinst_PROGRAMS + buffer + buffered_read_stream + buffered_stream + buffered_write_stream + buffers_iterator + coroutine + error + generic/datagram_protocol + generic/raw_protocol + generic/seq_packet_protocol + generic/stream_protocol + io_context + ip/address + ip/address_v4 + ip/address_v6 + ip/host_name + ip/icmp + ip/multicast + ip/network_v4 + ip/network_v6 + ip/tcp + ip/udp + ip/unicast + ip/v6_only + is_read_buffered + is_write_buffered + local/connect_pair + local/datagram_protocol + local/stream_protocol + posix/stream_descriptor + read + read_at + read_until + serial_port + serial_port_base + signal_set + socket_base + strand + streambuf + system_timer + use_future + windows/object_handle + windows/overlapped_ptr + windows/random_access_handle + windows/stream_handle + write + write_at +) + +if(OpenSSL_FOUND) + set(null_test_PROGRAMS ${null_test_PROGRAMS} + ssl/context + ssl/context_base + ssl/error + ssl/rfc2818_verification + ssl/stream_base + ) + set(noinst_PROGRAMS ${noinst_PROGRAMS} + ssl/stream + ) +endif() + +foreach(program ${noinst_PROGRAMS} ${null_test_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + add_executable(${target_prefix}${target} ${program}.cpp unit_test.hpp) + set_target_properties(${target_prefix}${target} PROPERTIES CXX_STANDARD 11) + + target_link_libraries(${target_prefix}${target} asio::standalone) + #NOTE: same as: conan_target_link_libraries(${target_prefix}${target}) + if(EXTRA_LIBS) + target_link_libraries(${target_prefix}${target} ${EXTRA_LIBS}) + endif() +endforeach() + +if(MSVC) + target_compile_features(${target_prefix}use_future PRIVATE + cxx_std_11 # OK + cxx_contextual_conversions # OK + cxx_final # OK + cxx_override # OK + cxx_variadic_templates # OK + #FIXME: missing features at MS VS12 2013: + cxx_aggregate_default_initializers + cxx_attribute_deprecated + cxx_binary_literals + cxx_constexpr + cxx_decltype_auto + cxx_decltype_incomplete_return_types + cxx_defaulted_move_initializers + cxx_digit_separators + cxx_generic_lambdas + cxx_lambda_init_captures + cxx_noexcept + cxx_relaxed_constexpr + cxx_return_type_deduction + cxx_variable_templates + ) +endif() + +### enable_testing() with ctest +foreach(program ${noinst_PROGRAMS}) + string(REPLACE "/" "_" target ${program}) + add_test(NAME ${target_prefix}${target} + COMMAND "${target_prefix}${target}" + ) +endforeach() + diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000000..03c98f4741 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,46 @@ +from conans import ConanFile, CMake, tools + + +class AsioConan(ConanFile): + name = "asio" + version = "1.11.0" + license = "Boost Software License - Version 1.0" + url = "https://github.com/chriskohlhoff/asio/issues" + description = "Asio C++ Library" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "force_openssl": [True, False], + "cxx_14": [True, False] + } + default_options = ''' +shared=False +force_openssl=True +cxx_14=True +''' + generators = "cmake" + exports_sources = "asio/*" + + def requirements(self): + if self.options.force_openssl: + self.requires.add("OpenSSL/1.0.2n@conan/stable", private=False) + + def build(self): + cmake = CMake(self) + cmake.configure(source_folder="asio") + cmake.build() + if tools.get_env("CONAN_RUN_TESTS", True): + cmake.test() + cmake.install() + + def package(self): + self.copy("*.hpp", dst="include", src="asio/include") + self.copy("*.ipp", dst="include", src="asio/include") + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.dll", dst="bin", keep_path=False) + self.copy("*.dylib*", dst="lib", keep_path=False) + self.copy("*.so", dst="lib", keep_path=False) + self.copy("*.a", dst="lib", keep_path=False) + + def package_info(self): + self.cpp_info.libs = ["asio"]