From 4f0d6a4a55262c402510947dd754f341e733da99 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 2 Mar 2019 09:12:54 -0800 Subject: [PATCH] tests use lib_beast for cmake --- Jamfile | 1 - test/CMakeLists.txt | 8 ++++++-- test/bench/wsload/CMakeLists.txt | 4 ++++ test/lib_asio.cpp | 15 --------------- test/lib_beast.cpp | 14 +++++++++++--- 5 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 test/lib_asio.cpp diff --git a/Jamfile b/Jamfile index 871bfcd7..46c00a29 100644 --- a/Jamfile +++ b/Jamfile @@ -53,7 +53,6 @@ path-constant TEST_MAIN : include/boost/beast/_experimental/unit_test/main.cpp ; lib static_beast : test/lib_beast.cpp - test/lib_asio.cpp : requirements [ requires cxx11_constexpr diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 28fd7db5..e5d1149f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,8 +15,6 @@ file (GLOB_RECURSE EXTRAS_FILES ${PROJECT_SOURCE_DIR}/test/extras/include/*.ipp ) -set (TEST_MAIN ${PROJECT_SOURCE_DIR}/include/boost/beast/_experimental/unit_test/main.cpp) - if (OPENSSL_FOUND) link_libraries (${OPENSSL_LIBRARIES}) endif() @@ -44,6 +42,12 @@ set (ZLIB_SOURCES ${CMAKE_CURRENT_LIST_DIR}/extern/zlib-1.2.11/zutil.c ) +set (TEST_MAIN ${PROJECT_SOURCE_DIR}/test/lib_beast.cpp) + +add_definitions (-DBOOST_BEAST_INCLUDE_TEST_MAIN) +add_definitions (-DBOOST_ASIO_SEPARATE_COMPILATION) +add_definitions (-DBOOST_BEAST_SPLIT_COMPILATION) + add_subdirectory (beast) add_subdirectory (bench) add_subdirectory (doc) diff --git a/test/bench/wsload/CMakeLists.txt b/test/bench/wsload/CMakeLists.txt index b937df0f..59e9398b 100644 --- a/test/bench/wsload/CMakeLists.txt +++ b/test/bench/wsload/CMakeLists.txt @@ -12,6 +12,10 @@ GroupSources (example/common common) GroupSources (test/extras/include/boost/beast extras) GroupSources (test/bench/wsload "/") +remove_definitions (-DBOOST_BEAST_INCLUDE_TEST_MAIN) +remove_definitions (-DBOOST_ASIO_SEPARATE_COMPILATION) +remove_definitions (-DBOOST_BEAST_SPLIT_COMPILATION) + add_executable (bench-wsload ${BOOST_BEAST_FILES} ${COMMON_FILES} diff --git a/test/lib_asio.cpp b/test/lib_asio.cpp deleted file mode 100644 index b89c37d7..00000000 --- a/test/lib_asio.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// Official repository: https://github.com/boostorg/beast -// - -// This file is used to build the asio static library, -// used with BOOST_ASIO_SEPARATE_COMPILATION which helps -// reduce compilation time - -#include -#include diff --git a/test/lib_beast.cpp b/test/lib_beast.cpp index 4b377eff..1cf5d5a8 100644 --- a/test/lib_beast.cpp +++ b/test/lib_beast.cpp @@ -7,9 +7,17 @@ // Official repository: https://github.com/boostorg/beast // -// This file is used to build the asio stbeastatic library, -// used with BOOST_BEAST_SPLIT_COMPILATION which helps -// reduce compilation time +// This file is used to build a static library with +// asio and beast definitions, to reduce compilation time. +// BOOST_ASIO_SEPARATE_COMPILATION for asio +#include +#include + +// BOOST_BEAST_SPLIT_COMPILATION for beast #include //#include + +#ifdef BOOST_BEAST_INCLUDE_TEST_MAIN +#include +#endif