Skip to content

Commit

Permalink
Add support for modular build structure. (#318)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
grafikrobot authored Sep 22, 2024
1 parent dc94c80 commit 5746b3f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
32 changes: 32 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright René Ferdinand Rivera Morell 2023-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/assert//boost_assert
/boost/config//boost_config
/boost/container_hash//boost_container_hash
/boost/detail//boost_detail
/boost/io//boost_io
/boost/iterator//boost_iterator
/boost/smart_ptr//boost_smart_ptr
/boost/system//boost_system
/boost/type_traits//boost_type_traits ;

project /boost/filesystem
: common-requirements
<include>include
;

explicit
[ alias boost_filesystem : build//boost_filesystem ]
[ alias all : boost_filesystem example test ]
;

call-if : boost-library filesystem
: install boost_filesystem
;

17 changes: 11 additions & 6 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

import project ;
import configure ;
import-search /boost/config/checks ;
import config : requires ;

lib bcrypt ;
lib advapi32 ;
lib coredll ;
searched-lib bcrypt ;
searched-lib advapi32 ;
searched-lib coredll ;
explicit bcrypt advapi32 coredll ;

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

project boost/filesystem
project
: common-requirements <library>$(boost_dependencies)
: requirements
<library>/boost/core//boost_core
<library>/boost/predef//boost_predef
<library>/boost/scope//boost_scope
<target-os>windows:<library>/boost/winapi//boost_winapi
<host-os>hpux,<toolset>gcc:<define>_INCLUDE_STDC__SOURCE_199901
[ check-target-builds ../config//has_attribute_init_priority "has init_priority attribute" : <define>BOOST_FILESYSTEM_HAS_INIT_PRIORITY ]
[ check-target-builds ../config//has_stat_st_mtim "has stat::st_blksize" : <define>BOOST_FILESYSTEM_HAS_STAT_ST_BLKSIZE ]
Expand Down Expand Up @@ -177,6 +183,7 @@ project boost/filesystem
: usage-requirements # pass these requirement to dependents (i.e. users)
<link>shared:<define>BOOST_FILESYSTEM_DYN_LINK=1
<link>static:<define>BOOST_FILESYSTEM_STATIC_LINK=1
<define>BOOST_FILESYSTEM_NO_LIB=1
;

SOURCES =
Expand Down Expand Up @@ -216,5 +223,3 @@ lib boost_filesystem
: usage-requirements
$(cxx_requirements)
;

boost-install boost_filesystem ;
2 changes: 1 addition & 1 deletion config/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ explicit has_posix_at_apis ;
obj has_fallocate : has_fallocate.cpp : <include>../src ;
explicit has_fallocate ;

lib bcrypt ;
searched-lib bcrypt ;
explicit bcrypt ;

exe has_bcrypt : has_bcrypt.cpp : <include>../src <library>bcrypt ;
Expand Down
4 changes: 2 additions & 2 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ run operations_test.cpp : : : <link>shared <define>BOOST_FILESYSTEM_VERSION=4 <t
run operations_test.cpp : : : <link>static <define>BOOST_FILESYSTEM_VERSION=4 : operations_test_static ;
run operations_test.cpp : : : <link>shared <define>BOOST_FILESYSTEM_VERSION=3 : operations_test_v3 ;
run operations_unit_test.cpp : $(HERE) : : <link>shared <define>BOOST_FILESYSTEM_VERSION=4 <test-info>always_show_run_output ;
run copy_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
run copy_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 <library>/boost/exception//boost_exception ;
compile-fail cf_path_nullptr_test.cpp ;
compile path_iter_ctor_overload_test.cpp ;
compile path_operator_ambiguity.cpp : <toolset>gcc:<warnings-as-errors>on ;
Expand All @@ -98,7 +98,7 @@ run path_unit_test.cpp : : : <link>shared $(VIS) <define>BOOST_FILESYSTEM_VERSIO
run relative_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
run ../example/simple_ls.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
run ../example/file_status.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
run foreach_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 ;
run foreach_test.cpp : : : <define>BOOST_FILESYSTEM_VERSION=4 <library>/boost/foreach//boost_foreach ;

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

0 comments on commit 5746b3f

Please sign in to comment.