Integrated Beast interface.

This commit is contained in:
Sacha
2017-06-15 15:01:51 +10:00
committed by Vinnie Falco
parent 104ec6be18
commit 0a2a03acfa
14 changed files with 19 additions and 96 deletions

View File

@@ -47,27 +47,8 @@ endif()
option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON)
set (Boost_USE_MULTITHREADED ON)
add_definitions (-DBOOST_COROUTINES_NO_DEPRECATION_WARNING=1) # for asio
unset (Boost_INCLUDE_DIR CACHE)
unset (Boost_LIBRARY_DIRS CACHE)
if (MSVC)
find_package (Boost REQUIRED)
else()
find_package (Boost REQUIRED COMPONENTS
coroutine
context
filesystem
program_options
system
thread
)
link_libraries (${Boost_LIBRARIES})
endif()
include_directories (SYSTEM ${Boost_INCLUDE_DIRS})
set (BOOST_COMPONENTS coroutine context filesystem program_options system thread)
find_package (Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if (MINGW)
link_libraries(ws2_32 mswsock)
@@ -143,7 +124,8 @@ target_link_libraries(${PROJECT_NAME} INTERFACE ${Boost_SYSTEM_LIBRARY})
if (NOT MSVC)
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
endif()
target_include_directories(${PROJECT_NAME} INTERFACE ${Boost_INCLUDE_DIRS})
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
target_compile_definitions(${PROJECT_NAME} INTERFACE BOOST_COROUTINES_NO_DEPRECATION_WARNING=1)
#-------------------------------------------------------------------------------

View File

@@ -10,8 +10,4 @@ add_executable (echo-op
echo_op.cpp
)
if (NOT WIN32)
target_link_libraries(echo-op ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(echo-op ${Boost_LIBRARIES})
endif()
target_link_libraries(echo-op Beast)

View File

@@ -11,8 +11,4 @@ add_executable (http-client
http_client.cpp
)
if (NOT WIN32)
target_link_libraries(http-client ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(http-client ${Boost_LIBRARIES})
endif()
target_link_libraries(http-client Beast)

View File

@@ -13,8 +13,4 @@ add_executable (http-crawl
http_crawl.cpp
)
if (NOT WIN32)
target_link_libraries(http-crawl ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(http-crawl ${Boost_LIBRARIES})
endif()
target_link_libraries(http-crawl Beast)

View File

@@ -15,8 +15,4 @@ add_executable (http-server
main.cpp
)
if (NOT WIN32)
target_link_libraries(http-server ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(http-server ${Boost_LIBRARIES})
endif()
target_link_libraries(http-server Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} )

View File

@@ -13,11 +13,7 @@ add_executable (http-ssl-example
http_ssl_example.cpp
)
target_link_libraries(http-ssl-example ${OPENSSL_LIBRARIES})
if (NOT WIN32)
target_link_libraries(http-ssl-example ${Boost_LIBRARIES} Threads::Threads)
endif()
target_link_libraries(http-ssl-example Beast ${OPENSSL_LIBRARIES})
add_executable (websocket-ssl-example
${BEAST_INCLUDES}
@@ -25,8 +21,4 @@ add_executable (websocket-ssl-example
websocket_ssl_example.cpp
)
target_link_libraries(websocket-ssl-example ${OPENSSL_LIBRARIES})
if (NOT WIN32)
target_link_libraries(websocket-ssl-example ${Boost_LIBRARIES} Threads::Threads)
endif()
target_link_libraries(websocket-ssl-example Beast ${OPENSSL_LIBRARIES})

View File

@@ -11,9 +11,4 @@ add_executable (websocket-client
websocket_client.cpp
)
if (NOT WIN32)
target_link_libraries(websocket-client ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(websocket-client ${Boost_LIBRARIES})
endif()
target_link_libraries(websocket-client Beast)

View File

@@ -12,8 +12,4 @@ add_executable (websocket-server
websocket_sync_echo_server.hpp
)
if (NOT WIN32)
target_link_libraries(websocket-server ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(websocket-server ${Boost_LIBRARIES})
endif()
target_link_libraries(websocket-server Beast)

View File

@@ -16,11 +16,7 @@ add_executable (lib-tests
zlib.cpp
)
if (NOT WIN32)
target_link_libraries(lib-tests ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(lib-tests ${Boost_LIBRARIES})
endif()
target_link_libraries(lib-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (MINGW)
set_target_properties(lib-tests PROPERTIES COMPILE_FLAGS "-Wa,-mbig-obj")

View File

@@ -40,6 +40,4 @@ add_executable (core-tests
sha1.cpp
)
if (NOT WIN32)
target_link_libraries(core-tests ${Boost_LIBRARIES} Threads::Threads)
endif()
target_link_libraries(core-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_COROUTINE_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY})

View File

@@ -35,11 +35,7 @@ add_executable (http-tests
write.cpp
)
if (NOT WIN32)
target_link_libraries(http-tests ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(http-tests ${Boost_LIBRARIES})
endif()
target_link_libraries(http-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_COROUTINE_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY})
add_executable (http-bench
${BEAST_INCLUDES}
@@ -51,8 +47,4 @@ add_executable (http-bench
parser_bench.cpp
)
if (NOT WIN32)
target_link_libraries(http-bench ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(http-bench ${Boost_LIBRARIES})
endif()
target_link_libraries(http-bench Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})

View File

@@ -21,11 +21,7 @@ add_executable (websocket-tests
utf8_checker.cpp
)
if (NOT WIN32)
target_link_libraries(websocket-tests ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(websocket-tests ${Boost_LIBRARIES})
endif()
target_link_libraries(websocket-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_COROUTINE_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY})
if (MINGW)
set_target_properties(websocket-tests PROPERTIES COMPILE_FLAGS "-Wa,-mbig-obj -Og")

View File

@@ -16,8 +16,4 @@ add_executable (websocket-ssl-tests
ssl_server.cpp
)
target_link_libraries(websocket-ssl-tests ${OPENSSL_LIBRARIES})
if (NOT WIN32)
target_link_libraries(websocket-ssl-tests ${Boost_LIBRARIES} Threads::Threads)
endif()
target_link_libraries(websocket-ssl-tests Beast ${OPENSSL_LIBRARIES} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})

View File

@@ -19,8 +19,4 @@ add_executable (zlib-tests
inflate_stream.cpp
)
if (NOT WIN32)
target_link_libraries(zlib-tests ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(zlib-tests ${Boost_LIBRARIES})
endif()
target_link_libraries(zlib-tests Beast ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})