Skip to content

Commit

Permalink
Get stage and install targets to work in mixed-modular setup.
Browse files Browse the repository at this point in the history
This adjusts the top level stage and install targets to refer to the new modular per-library stage and instal targets if available. It also declares the stage and instal targets for header only libraries that don't have those targets.

It makes it possible to fully stage or install at the top level in the mixed-modular transition.
  • Loading branch information
grafikrobot committed Apr 24, 2024
1 parent 2eafd5f commit da06823
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 9 deletions.
29 changes: 22 additions & 7 deletions Jamroot
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ import project ;
import tools/boost\_install/boost-install ;

path-constant BOOST_ROOT : . ;
constant BOOST_VERSION : 1.85.0 ;
constant BOOST_VERSION : 1.86.0 ;
constant BOOST_JAMROOT_MODULE : $(__name__) ;

# Allow subprojects to simply `import config : requires ;` to get access to the requires rule
import-search $(BOOST_ROOT)/libs/config/checks ;
import-search $(BOOST_ROOT)/libs/predef/tools/checks ;
import-search $(BOOST_ROOT)/libs/predef/tools/check ;

boostcpp.set-version $(BOOST_VERSION) ;

Expand Down Expand Up @@ -327,9 +327,6 @@ for local l in $(all-libraries-modular-build)
}
}

# Log has an additional target
explicit [ alias log_setup : libs/log/build//boost_log_setup ] ;

rule do-nothing { }

rule generate-alias ( project name : property-set : sources * )
Expand Down Expand Up @@ -360,7 +357,7 @@ if [ path.exists $(BOOST_ROOT)/tools/inspect/build ]

if [ path.exists $(BOOST_ROOT)/libs/wave/tool/build ]
{
use-project /boost/libs/wave/tool : libs/wave/tool/build ;
use-project /boost/libs/wave/tool : $(BOOST_ROOT)/libs/wave/tool/build ;
}

# Make the boost-install rule visible in subprojects
Expand Down Expand Up @@ -395,7 +392,7 @@ rule boost-lib ( name : sources * : requirements * : default-build * : usage-req

# Declare special top-level targets that build and install the desired variants
# of the libraries.
boostcpp.declare-targets $(all-libraries-to-build) ;
boostcpp.declare-targets $(all-libraries-to-build) $(all-libraries-modular-build) ;

# Declare a Boost library and run related declaration rules. This should be
# called from the libroot/build.jam to define the components of a Boost lib.
Expand All @@ -409,14 +406,27 @@ boostcpp.declare-targets $(all-libraries-to-build) ;
#
rule boost-library ( id ? : options * : * )
{
# ECHO "INFO: Declare Boost library:" $(id) ;
local called-boost-install ;
for n in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
{
local option = $($(n)) ;
if $(option)
{
call-if : boost-$(option[1]) $(option[2-]) ;
if $(option[1]) = install
{
called-boost-install = true ;
}
}
}
if ! $(called-boost-install)
{
# If the library didn't indicate an install build target it's likely
# header only. We should declare empty install targets to allow for
# generic handling.
boost-install.boost-install ;
}
}

# Declare projects and targets for all placeholder, header only, not yet
Expand Down Expand Up @@ -451,3 +461,8 @@ for local lib in $(all-libraries-to-declare)
}
project.pop-current ;
}

if ! [ project.search /boost/tools/boost_install ]
{
use-project /boost/tools/boost_install : tools/boost_install ;
}
20 changes: 18 additions & 2 deletions boostcpp.jam
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,27 @@ rule python-tag ( name : type ? : property-set )
rule declare_install_and_stage_proper_targets ( libraries * )
{
local p = [ project.current ] ;
local install-targets ;
local stage-targets ;
for local library in $(libraries)
{
local mp = [ project.search /boost/$(library) ] ;
if $(mp)
{
install-targets += /boost/$(library)//install ;
stage-targets += /boost/$(library)//stage ;
}
else
{
install-targets += libs/$(library)/build//install ;
stage-targets += libs/$(library)/build//stage ;
}
}

alias install-proper : libs/$(libraries)/build//install ;
alias install-proper : $(install-targets) ;
$(p).mark-target-as-explicit install-proper ;

alias stage-proper : libs/$(libraries)/build//stage ;
alias stage-proper : $(stage-targets) ;
$(p).mark-target-as-explicit stage-proper ;
}

Expand Down

0 comments on commit da06823

Please sign in to comment.