Skip to content

Commit 5746b3f

Browse files
authored
Add support for modular build structure. (boostorg#318)
* Make the library modular usable. * Use searched-lib targets for external/OS/Windows libraries to avoid trying to refer to mangled names for them. And hence failing to find them. * Use the OS temp dir for creating test dir to avoid putting dirs in random location based on where one runs tests from. * Switch to library requirements instead of source. As source puts extra source in install targets. * Updated dependencies. * Add missing NO_LIB usage requirements. * Add missing import-search for cconfig/predef checks. * Add requires-b2 check to top-level build file. * Bump B2 require to 5.2 * Change all <source> references to <library>. * Update copyright dates. * Move inter-lib dependencies to a project variable and into the build targets. * Split b2 dependencies into public and private. * Undo temp dir for test change. * Make winapi dep target-os specific. And remove direct atomic dep as it is already handled by conditional rule. * Remove bug targets from all build as that's not a regular project.
1 parent dc94c80 commit 5746b3f

File tree

4 files changed

+46
-9
lines changed

4 files changed

+46
-9
lines changed

build.jam

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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/config//boost_config
11+
/boost/container_hash//boost_container_hash
12+
/boost/detail//boost_detail
13+
/boost/io//boost_io
14+
/boost/iterator//boost_iterator
15+
/boost/smart_ptr//boost_smart_ptr
16+
/boost/system//boost_system
17+
/boost/type_traits//boost_type_traits ;
18+
19+
project /boost/filesystem
20+
: common-requirements
21+
<include>include
22+
;
23+
24+
explicit
25+
[ alias boost_filesystem : build//boost_filesystem ]
26+
[ alias all : boost_filesystem example test ]
27+
;
28+
29+
call-if : boost-library filesystem
30+
: install boost_filesystem
31+
;
32+

build/Jamfile.v2

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
import project ;
1111
import configure ;
12+
import-search /boost/config/checks ;
1213
import config : requires ;
1314

14-
lib bcrypt ;
15-
lib advapi32 ;
16-
lib coredll ;
15+
searched-lib bcrypt ;
16+
searched-lib advapi32 ;
17+
searched-lib coredll ;
1718
explicit bcrypt advapi32 coredll ;
1819

1920
# The rule checks if a config macro is defined in the command line or build properties
@@ -136,8 +137,13 @@ local cxx_requirements = [ requires
136137
cxx11_override
137138
] ;
138139

139-
project boost/filesystem
140+
project
141+
: common-requirements <library>$(boost_dependencies)
140142
: requirements
143+
<library>/boost/core//boost_core
144+
<library>/boost/predef//boost_predef
145+
<library>/boost/scope//boost_scope
146+
<target-os>windows:<library>/boost/winapi//boost_winapi
141147
<host-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901
142148
[ check-target-builds ../config//has_attribute_init_priority "has init_priority attribute" : <define>BOOST_FILESYSTEM_HAS_INIT_PRIORITY ]
143149
[ check-target-builds ../config//has_stat_st_mtim "has stat::st_blksize" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE ]
@@ -177,6 +183,7 @@ project boost/filesystem
177183
: usage-requirements # pass these requirement to dependents (i.e. users)
178184
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
179185
<link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
186+
<define>BOOST_FILESYSTEM_NO_LIB=1
180187
;
181188

182189
SOURCES =
@@ -216,5 +223,3 @@ lib boost_filesystem
216223
: usage-requirements
217224
$(cxx_requirements)
218225
;
219-
220-
boost-install boost_filesystem ;

config/Jamfile.v2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ explicit has_posix_at_apis ;
3636
obj has_fallocate : has_fallocate.cpp : <include>../src ;
3737
explicit has_fallocate ;
3838

39-
lib bcrypt ;
39+
searched-lib bcrypt ;
4040
explicit bcrypt ;
4141

4242
exe has_bcrypt : has_bcrypt.cpp : <include>../src <library>bcrypt ;

test/Jamfile.v2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ run operations_test.cpp : : : <link>shared <define>BOOST_FILESYSTEM_VERSION=4 <t
8585
run operations_test.cpp : : : <link>static <define>BOOST_FILESYSTEM_VERSION=4 : operations_test_static ;
8686
run operations_test.cpp : : : <link>shared <define>BOOST_FILESYSTEM_VERSION=3 : operations_test_v3 ;
8787
run operations_unit_test.cpp : $(HERE) : : <link>shared <define>BOOST_FILESYSTEM_VERSION=4 <test-info>always_show_run_output ;
88-
run copy_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
88+
run copy_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 <library>/boost/exception//boost_exception ;
8989
compile-fail cf_path_nullptr_test.cpp ;
9090
compile path_iter_ctor_overload_test.cpp ;
9191
compile path_operator_ambiguity.cpp : <toolset>gcc:<warnings-as-errors>on ;
@@ -98,7 +98,7 @@ run path_unit_test.cpp : : : <link>shared $(VIS) <define>BOOST_FILESYSTEM_VERSIO
9898
run relative_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
9999
run ../example/simple_ls.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
100100
run ../example/file_status.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
101-
run foreach_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
101+
run foreach_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 <library>/boost/foreach//boost_foreach ;
102102

103103
# `quick` target (for CI)
104104
run quick.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;

0 commit comments

Comments
 (0)