Skip to content

Commit a0e31a2

Browse files
grafikrobotklemens-morgenstern13steinj
authored
Add support for modular build structure. (#192)
* Make the library modular usable. * Switch to library requirements instead of source. As source puts extra source in install targets. * fix promise & generator operator= * added fno-exceptions support. * added experimental context support. * support for asio::yield_context * Add missing NO_LIB usage requirements. * added noop utility closes #3 * added support for __cpp_sized_deallocation in custom coroutine allocations. (non-apple) clang is weird, as it allowed sized deallocations on coroutine promises even when not enabled otherwise. Since apple does not, this should fix using cobalt on apple. * Add missing import-search for cconfig/predef checks. * Add requires-b2 check to top-level build file. * Update dependencies. * Fix -Wreorder flagging If using -Werror=reorder via some cmake build or otherwise, this gets flagged. * added move support for channels Closes #183 * fixed ctor so any works. Closes #182 * added noinline ot channel functions when compiling for windows. * removed move_only template inst from channel.cpp * Declared test targets with EXCLUDE_FROM_ALL Closes #181. * added generate-diagram option & cache * Cleaned up CML. Closes #135. * Bump B2 require to 5.2 * Move inter-lib dependencies to a project variable and into the build targets. * Move custom features to importable jam. --------- Co-authored-by: Klemens Morgenstern <[email protected]> Co-authored-by: Jonathan Stein <[email protected]>
1 parent b74d61e commit a0e31a2

File tree

5 files changed

+80
-31
lines changed

5 files changed

+80
-31
lines changed

boost-cobalt.jam

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2023 Klemens D. Morgenstern
2+
#
3+
# Distributed under the Boost Software License, Version 1.0. (See accompanying
4+
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
7+
import feature ;
8+
9+
10+
feature.feature boost.cobalt.pmr : std boost-container custom no : propagated composite ;
11+
feature.compose <boost.cobalt.pmr>std : <define>BOOST_COBALT_USE_STD_PMR=1 ;
12+
feature.compose <boost.cobalt.pmr>boost-container : <define>BOOST_COBALT_USE_BOOST_CONTAINER_PMR=1 ;
13+
feature.compose <boost.cobalt.pmr>custom : <define>BOOST_COBALT_USE_CUSTOM_PMR=1 ;
14+
feature.compose <boost.cobalt.pmr>no : <define>BOOST_COBALT_NO_PMR=1 ;
15+
16+
feature.feature boost.cobalt.executor : any_io_executor use_io_context custom : propagated composite ;
17+
feature.compose <boost.cobalt.executor>any_io_executor : ;
18+
feature.compose <boost.cobalt.executor>use_io_context : <define>BOOST_COBALT_USE_IO_CONTEXT=1 ;
19+
feature.compose <boost.cobalt.executor>custom_executor : <define>BOOST_COBALT_CUSTOM_EXECUTOR=1 ;

build.jam

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright René Ferdinand Rivera Morell 2024
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# (See accompanying file LICENSE_1_0.txt or copy at
4+
# http://www.boost.org/LICENSE_1_0.txt)
5+
6+
require-b2 5.2 ;
7+
8+
constant boost_dependencies :
9+
/boost/asio//boost_asio
10+
/boost/callable_traits//boost_callable_traits
11+
/boost/circular_buffer//boost_circular_buffer
12+
/boost/config//boost_config
13+
/boost/container//boost_container
14+
/boost/context//boost_context
15+
/boost/core//boost_core
16+
/boost/intrusive//boost_intrusive
17+
/boost/leaf//boost_leaf
18+
/boost/mp11//boost_mp11
19+
/boost/preprocessor//boost_preprocessor
20+
/boost/smart_ptr//boost_smart_ptr
21+
/boost/system//boost_system
22+
/boost/throw_exception//boost_throw_exception
23+
/boost/variant2//boost_variant2 ;
24+
25+
project /boost/cobalt
26+
: common-requirements
27+
<include>include
28+
;
29+
30+
explicit
31+
[ alias boost_cobalt : build//boost_cobalt ]
32+
[ alias all : boost_cobalt test example ]
33+
;
34+
35+
call-if : boost-library cobalt
36+
;
37+

build/Jamfile

+9-19
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55

66

77
import os ;
8-
import feature ;
9-
import ../../config/checks/config : requires ;
8+
import-search /boost/config/checks ;
9+
import config : requires ;
10+
import-search /boost/cobalt ;
11+
import boost-cobalt ;
1012

1113

1214
project : requirements
@@ -17,20 +19,10 @@ project : requirements
1719
<target-os>windows:<define>WIN32_LEAN_AND_MEAN
1820
<target-os>linux:<linkflags>-lpthread
1921
: source-location ../src
22+
: common-requirements <library>$(boost_dependencies)
2023
;
2124

2225

23-
feature.feature boost.cobalt.pmr : std boost-container custom no : propagated composite ;
24-
feature.compose <boost.cobalt.pmr>std : <define>BOOST_COBALT_USE_STD_PMR=1 ;
25-
feature.compose <boost.cobalt.pmr>boost-container : <define>BOOST_COBALT_USE_BOOST_CONTAINER_PMR=1 ;
26-
feature.compose <boost.cobalt.pmr>custom : <define>BOOST_COBALT_USE_CUSTOM_PMR=1 ;
27-
feature.compose <boost.cobalt.pmr>no : <define>BOOST_COBALT_NO_PMR=1 ;
28-
29-
feature.feature boost.cobalt.executor : any_io_executor use_io_context custom : propagated composite ;
30-
feature.compose <boost.cobalt.executor>any_io_executor : ;
31-
feature.compose <boost.cobalt.executor>use_io_context : <define>BOOST_COBALT_USE_IO_CONTEXT=1 ;
32-
feature.compose <boost.cobalt.executor>custom_executor : <define>BOOST_COBALT_CUSTOM_EXECUTOR=1 ;
33-
3426
local config-binding = [ modules.binding config ] ;
3527
config-binding ?= "" ;
3628

@@ -50,10 +42,10 @@ lib boost_cobalt
5042
: cobalt_sources
5143
: requirements <define>BOOST_COBALT_SOURCE=1
5244
<link>shared:<define>BOOST_COBALT_DYN_LINK=1
53-
[ requires
45+
[ requires
5446
cxx20_hdr_concepts
5547
]
56-
<boost.cobalt.pmr>boost-container:<library>/boost//container
48+
<boost.cobalt.pmr>boost-container:<library>/boost/container//boost_container
5749
[ check-target-builds
5850
$(config-binding:D)//cpp_lib_memory_resource
5951
cpp_lib_memory_resource
@@ -62,8 +54,9 @@ lib boost_cobalt
6254
]
6355

6456
: usage-requirements
65-
<boost.cobalt.pmr>boost-container:<library>/boost//container
57+
<boost.cobalt.pmr>boost-container:<library>/boost/container//boost_container
6658
<link>shared:<define>BOOST_COBALT_DYN_LINK=1
59+
<define>BOOST_COBALT_NO_LINK=1
6760
[ check-target-builds
6861
$(config-binding:D)//cpp_lib_memory_resource
6962
cpp_lib_memory_resource
@@ -97,6 +90,3 @@ rule set-pmr-std ( props * )
9790
return <boost.cobalt.pmr>std ;
9891
}
9992
}
100-
101-
boost-install boost_cobalt ;
102-

example/Jamfile

+10-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66

77
import os ;
8+
import-search /boost/cobalt ;
9+
import boost-cobalt ;
810

911

1012
project : requirements
@@ -18,12 +20,11 @@ project : requirements
1820
<toolset>clang-14:<boost.cobalt.pmr>boost-container
1921
;
2022

21-
exe channel : channel.cpp /boost//cobalt ;
22-
exe delay : delay.cpp /boost//cobalt ;
23-
exe delay_op : delay_op.cpp /boost//cobalt ;
24-
exe echo_server : echo_server.cpp /boost//cobalt ;
25-
exe outcome : outcome.cpp /boost//cobalt ;
26-
exe thread : thread.cpp /boost//cobalt ;
27-
exe thread_pool : thread_pool.cpp /boost//cobalt ;
28-
# exe ticker : ticker.cpp /boost//json /boost//cobalt ;
29-
23+
exe channel : channel.cpp /boost/cobalt//boost_cobalt ;
24+
exe delay : delay.cpp /boost/cobalt//boost_cobalt ;
25+
exe delay_op : delay_op.cpp /boost/cobalt//boost_cobalt ;
26+
exe echo_server : echo_server.cpp /boost/cobalt//boost_cobalt ;
27+
exe outcome : outcome.cpp /boost/cobalt//boost_cobalt /boost/outcome//boost_outcome ;
28+
exe thread : thread.cpp /boost/cobalt//boost_cobalt ;
29+
exe thread_pool : thread_pool.cpp /boost/cobalt//boost_cobalt ;
30+
# exe ticker : ticker.cpp /boost/cobalt//boost_cobalt /boost/json//boost_json ;

test/Jamfile.jam

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66

77
import os ;
8+
import-search /boost/cobalt ;
9+
import boost-cobalt ;
810

911

1012
project : requirements
@@ -20,12 +22,12 @@ project : requirements
2022

2123
import testing ;
2224

23-
lib test_impl : test_main.cpp /boost//cobalt /boost//unit_test_framework :
25+
lib test_impl : test_main.cpp /boost/cobalt//boost_cobalt /boost/test//boost_unit_test_framework :
2426
<link>static
2527
;
2628

27-
run main.cpp /boost//cobalt ;
28-
run main_compile.cpp /boost//cobalt util.cpp concepts.cpp ;
29+
run main.cpp /boost/cobalt//boost_cobalt ;
30+
run main_compile.cpp /boost/cobalt//boost_cobalt util.cpp concepts.cpp ;
2931

3032
for local src in [ glob *.cpp : main.cpp main_compile.cpp test_main.cpp concepts.cpp util.cpp ]
3133
{

0 commit comments

Comments
 (0)