Skip to content

Commit a1f89c9

Browse files
authored
Merge pull request #403 from grafikrobot/modular
Add support for modular build structure.
2 parents 5d68c9c + 28d5885 commit a1f89c9

File tree

4 files changed

+76
-21
lines changed

4 files changed

+76
-21
lines changed

build.jam

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright René Ferdinand Rivera Morell 2023-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/assert//boost_assert
10+
/boost/atomic//boost_atomic
11+
/boost/bind//boost_bind
12+
/boost/chrono//boost_chrono
13+
/boost/concept_check//boost_concept_check
14+
/boost/config//boost_config
15+
/boost/container//boost_container
16+
/boost/container_hash//boost_container_hash
17+
/boost/core//boost_core
18+
/boost/date_time//boost_date_time
19+
/boost/exception//boost_exception
20+
/boost/function//boost_function
21+
/boost/io//boost_io
22+
/boost/move//boost_move
23+
/boost/optional//boost_optional
24+
/boost/predef//boost_predef
25+
/boost/preprocessor//boost_preprocessor
26+
/boost/smart_ptr//boost_smart_ptr
27+
/boost/static_assert//boost_static_assert
28+
/boost/system//boost_system
29+
/boost/throw_exception//boost_throw_exception
30+
/boost/tuple//boost_tuple
31+
/boost/type_traits//boost_type_traits
32+
/boost/utility//boost_utility
33+
/boost/winapi//boost_winapi ;
34+
35+
project /boost/thread
36+
;
37+
38+
explicit
39+
[ alias boost_thread : build//boost_thread ]
40+
[ alias all : boost_thread example test ]
41+
;
42+
43+
call-if : boost-library thread
44+
: install boost_thread
45+
;
46+

build/Jamfile.v2

+20-10
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,22 @@
3535
import os ;
3636
import indirect ;
3737
import path ;
38-
import configure ;
38+
import configure ;
3939
import threadapi-feature ;
4040

4141
exe has_atomic_flag_lockfree : ../build/has_atomic_flag_lockfree_test.cpp ;
4242

43-
project boost/thread
43+
project
4444
: source-location ../src
45+
: common-requirements
46+
<library>$(boost_dependencies)
47+
<include>../include
4548
: requirements <threading>multi
4649
#<link>static:<define>BOOST_THREAD_STATIC_LINK=1
4750
#<link>shared:<define>BOOST_THREAD_DYN_LINK=1
4851
<link>static:<define>BOOST_THREAD_BUILD_LIB=1
4952
<link>shared:<define>BOOST_THREAD_BUILD_DLL=1
53+
-<tag>@%boostcpp.tag
5054
-<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
5155
<tag>@$(__name__).tag
5256
<toolset>gcc:<cxxflags>-Wno-long-long
@@ -139,6 +143,7 @@ project boost/thread
139143
#<define>BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
140144
#<define>BOOST_SYSTEM_NO_DEPRECATED
141145
#<define>BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
146+
<define>BOOST_THREAD_NO_LIB=1
142147
;
143148

144149
rule tag ( name : type ? : property-set )
@@ -156,8 +161,15 @@ rule tag ( name : type ? : property-set )
156161
}
157162

158163
# forward to the boost tagging rule
159-
return [ indirect.call $(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
160-
$(result) : $(type) : $(property-set) ] ;
164+
if $(BOOST_JAMROOT_MODULE)
165+
{
166+
return [ indirect.call $(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
167+
$(result) : $(type) : $(property-set) ] ;
168+
}
169+
else
170+
{
171+
return $(result) ;
172+
}
161173
}
162174

163175
rule win32_pthread_paths ( properties * )
@@ -269,10 +281,10 @@ rule requirements ( properties * )
269281
}
270282
}
271283
result += <define>BOOST_THREAD_DONT_USE_CHRONO ;
272-
if ! [ configure.builds has_atomic_flag_lockfree
273-
: $(properties) : "lockfree boost::atomic_flag" ] {
274-
result += <library>/boost/atomic//boost_atomic ;
275-
}
284+
if ! [ configure.builds has_atomic_flag_lockfree
285+
: $(properties) : "lockfree boost::atomic_flag" ] {
286+
result += <library>/boost/atomic//boost_atomic ;
287+
}
276288
} else {
277289
if <threadapi>win32 in $(properties)
278290
{
@@ -315,5 +327,3 @@ lib boost_thread
315327
<link>static:<define>BOOST_THREAD_USE_LIB=1
316328
<conditional>@usage-requirements
317329
;
318-
319-
boost-install boost_thread ;

example/Jamfile.v2

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Distributed under the Boost Software License, Version 1.0. (See accompanying
55
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
66

7-
project boost/thread/example
7+
project
88
: requirements <library>../build//boost_thread <threading>multi
99
;
1010

test/Jamfile.v2

+9-10
Original file line numberDiff line numberDiff line change
@@ -268,16 +268,15 @@ rule generate_self_contained_header_tests
268268

269269
if ! [ os.environ BOOST_THREAD_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS ]
270270
{
271-
local headers_path = [ path.make $(BOOST_ROOT)/libs/thread/include/boost/thread ] ;
272-
for file in [ path.glob-tree $(headers_path) : *.hpp : detail pthread win32 ]
271+
for file in [ glob-tree-ex ../include/boost/thread : *.hpp : detail pthread win32 ]
273272
{
274-
local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
273+
local rel_file = [ path.relative-to ../include/boost/thread $(file) ] ;
275274
# Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.
276275
# All '/' are replaced with '-' because apparently test scripts have a problem with test names containing slashes.
277276
local test_name = [ regex.replace ~hdr/$(rel_file) "/" "-" ] ;
278277
#ECHO $(rel_file) ;
279-
all_rules += [ compile self_contained_header.cpp : <define>"BOOST_THREAD_TEST_HEADER=$(rel_file)" <dependency>$(file) : $(test_name) ] ;
280-
all_rules += [ compile self_contained_header.cpp : <define>"BOOST_THREAD_TEST_HEADER=$(rel_file)" <define>"BOOST_THREAD_TEST_POST_WINDOWS_H" <dependency>$(file) <conditional>@windows-cygwin-specific : $(test_name)-post_winh ] ;
278+
all_rules += [ compile self_contained_header.cpp : <define>"BOOST_THREAD_TEST_HEADER=$(rel_file)" <dependency>$(file) <use>../build//boost_thread : $(test_name) ] ;
279+
all_rules += [ compile self_contained_header.cpp : <define>"BOOST_THREAD_TEST_HEADER=$(rel_file)" <define>"BOOST_THREAD_TEST_POST_WINDOWS_H" <dependency>$(file) <conditional>@windows-cygwin-specific <use>../build//boost_thread : $(test_name)-post_winh ] ;
281280
}
282281
}
283282

@@ -1012,7 +1011,7 @@ rule generate_self_contained_header_tests
10121011
#[ thread-run test_10128.cpp ]
10131012
#[ thread-run test_10340.cpp ]
10141013
;
1015-
1014+
10161015
explicit ts_more_cpp11 ;
10171016
test-suite ts_more_cpp11
10181017
:
@@ -1033,13 +1032,13 @@ rule generate_self_contained_header_tests
10331032
:
10341033
[ thread-run2-noit ./experimental/parallel/v1/exception_list_pass.cpp : exception_list_p ]
10351034
;
1036-
1035+
10371036
#explicit ts_task_region ;
10381037
test-suite ts_task_region
10391038
:
10401039
[ thread-run2-noit ./experimental/parallel/v2/task_region_pass.cpp : task_region_p ]
10411040
;
1042-
1041+
10431042
explicit ts_other ;
10441043
test-suite ts_other
10451044
:
@@ -1050,7 +1049,7 @@ rule generate_self_contained_header_tests
10501049
explicit ts_ ;
10511050
test-suite ts_
10521051
:
1053-
#[ thread-run test_11256.cpp ]
1052+
#[ thread-run test_11256.cpp ]
10541053
#[ thread-run test_11256.cpp ]
10551054
#[ thread-run test_11499.cpp ]
10561055
#[ thread-run test_11611.cpp ]
@@ -1060,7 +1059,7 @@ rule generate_self_contained_header_tests
10601059
#[ thread-run test_12949.cpp ]
10611060
#[ thread-run test_13480b.cpp ]
10621061
[ thread-run test_13561.cpp ]
1063-
1062+
10641063
;
10651064

10661065
explicit test_time_jumps_1_obj ;

0 commit comments

Comments
 (0)