From c370e930c5e4f38334101e7696dc2d711097c4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Sun, 18 Aug 2024 15:46:53 -0500 Subject: [PATCH] Add support for modular build structure. (#204) * Fixes issue 181. * Refactors add_hello and adds unit tests. * Adds endian to the list of dependencies * Make the library modular usable. * Some fixes in the article about the costs of async abstractions [skip ci] * Switch to library requirements instead of source. As source puts extra source in install targets. * Add missing import-search for cconfig/predef checks. * Add requires-b2 check to top-level build file. * Bump B2 require to 5.2 * Move inter-lib dependencies to a project variable and into the build targets. * Update build deps. * Fix spurious semi-colon. --------- Co-authored-by: Marcelo Zimbres --- build.jam | 28 ++++++++++++++++++++++++++++ test/Jamfile | 12 +++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 build.jam diff --git a/build.jam b/build.jam new file mode 100644 index 00000000..5c5c19b8 --- /dev/null +++ b/build.jam @@ -0,0 +1,28 @@ +# Copyright René Ferdinand Rivera Morell 2024 +# 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) + +require-b2 5.2 ; + +constant boost_dependencies : + /boost/asio//boost_asio + /boost/assert//boost_assert + /boost/core//boost_core + /boost/mp11//boost_mp11 + /boost/system//boost_system + /boost/throw_exception//boost_throw_exception ; + +project /boost/redis + : common-requirements + include + ; + +explicit + [ alias boost_redis : : : : $(boost_dependencies) ] + [ alias all : boost_redis test ] + ; + +call-if : boost-library redis + ; + diff --git a/test/Jamfile b/test/Jamfile index 81e1fd72..ad706b15 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -1,12 +1,14 @@ -import ../config/checks/config : requires ; +import-search /boost/config/checks ; +import config : requires ; import ac ; # Configure openssl if it hasn't been done yet using openssl ; # Use these requirements as both regular and usage requirements across all tests -local requirements = +local requirements = + /boost/redis//boost_redis BOOST_ASIO_NO_DEPRECATED=1 BOOST_ASIO_DISABLE_BOOST_ARRAY=1 BOOST_ASIO_DISABLE_BOOST_BIND=1 @@ -14,7 +16,6 @@ local requirements = BOOST_ASIO_DISABLE_BOOST_REGEX=1 msvc:"/bigobj" windows:_WIN32_WINNT=0x0601 - ../include [ requires cxx14_constexpr cxx14_generic_lambdas @@ -30,6 +31,7 @@ local requirements = ] [ ac.check-library /openssl//ssl : /openssl//ssl/shared : no ] [ ac.check-library /openssl//crypto : /openssl//crypto/shared : no ] + /boost/test//boost_unit_test_framework ; @@ -44,7 +46,7 @@ lib redis_test_common # B2 runs tests in parallel, and some tests rely on having exclusive # access to a Redis server, so we only run the ones that don't require a DB server. -local tests = +local tests = test_low_level_sync_sans_io test_low_level test_request @@ -54,7 +56,7 @@ local tests = # Build and run the tests for local test in $(tests) { - run + run $(test).cpp redis_test_common/static : target-name $(test)