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) option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON)
set (Boost_USE_MULTITHREADED ON) set (BOOST_COMPONENTS coroutine context filesystem program_options system thread)
find_package (Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
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})
if (MINGW) if (MINGW)
link_libraries(ws2_32 mswsock) link_libraries(ws2_32 mswsock)
@@ -143,7 +124,8 @@ target_link_libraries(${PROJECT_NAME} INTERFACE ${Boost_SYSTEM_LIBRARY})
if (NOT MSVC) if (NOT MSVC)
target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads) target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads)
endif() 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) 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 echo_op.cpp
) )
if (NOT WIN32) target_link_libraries(echo-op Beast)
target_link_libraries(echo-op ${Boost_LIBRARIES} Threads::Threads)
else()
target_link_libraries(echo-op ${Boost_LIBRARIES})
endif()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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