2018-08-24 19:25:20 +00:00
|
|
|
# Boost.Build support specific for the Boost C++ Libraries.
|
|
|
|
# Copyright Vladimir Prus 2002-2010.
|
|
|
|
# Copyright Dave Abrahams 2005-2006.
|
|
|
|
# Copyright Rene Rivera 2005-2007.
|
|
|
|
# Copyright Douglas Gregor 2005.
|
|
|
|
#
|
|
|
|
# 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)
|
|
|
|
|
|
|
|
import "class" : new ;
|
|
|
|
import common ;
|
|
|
|
import configure ;
|
|
|
|
import build-system ;
|
|
|
|
import generate ;
|
|
|
|
import modules ;
|
|
|
|
import option ;
|
|
|
|
import os ;
|
|
|
|
import package ;
|
|
|
|
import path ;
|
|
|
|
import project ;
|
|
|
|
import regex ;
|
|
|
|
import sequence ;
|
|
|
|
import set ;
|
|
|
|
import targets ;
|
|
|
|
import feature ;
|
|
|
|
import property ;
|
2019-10-25 16:32:08 +00:00
|
|
|
import version : version-less ;
|
2018-08-24 19:25:20 +00:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# 0. General setup. Parse options, check them.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
BOOST_ROOT = [ modules.binding $(__name__) ] ;
|
|
|
|
BOOST_ROOT = $(BOOST_ROOT:D) ;
|
|
|
|
|
|
|
|
rule set-version ( version )
|
|
|
|
{
|
|
|
|
BOOST_VERSION = $(version) ;
|
|
|
|
|
|
|
|
local version-tag =
|
|
|
|
[ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ;
|
|
|
|
if $(version-tag[3]) = 0
|
|
|
|
{
|
|
|
|
version-tag = $(version-tag[1-2]) ;
|
|
|
|
}
|
|
|
|
BOOST_VERSION_TAG = $(version-tag:J=_) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Option to choose how many variants to build. The default is "minimal".
|
|
|
|
build-type = [ option.get build-type ] ;
|
|
|
|
build-type ?= minimal ;
|
|
|
|
if ! ( $(build-type) in complete minimal )
|
|
|
|
{
|
|
|
|
EXIT The value of the --build-type option should be either 'complete' or
|
|
|
|
'minimal' ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# What kind of layout are we doing?
|
|
|
|
layout = [ option.get layout : "" ] ;
|
2019-10-25 16:32:08 +00:00
|
|
|
|
|
|
|
layout = [ MATCH (versioned|tagged|system)(-(.+))? : $(layout) ] ;
|
|
|
|
if $(layout[3])
|
|
|
|
{
|
|
|
|
layout-version = $(layout[3]) ;
|
|
|
|
layout = $(layout[1]) ;
|
|
|
|
if [ version-less [ regex.split $(layout-version) "[.]" ] : 1 66 ]
|
|
|
|
{
|
|
|
|
layout-version = 1.40 ;
|
|
|
|
}
|
|
|
|
else if [ version-less [ regex.split $(layout-version) "[.]" ] : 1 69 ]
|
|
|
|
{
|
|
|
|
layout-version = 1.66 ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
layout-version ?= 1.69 ;
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
# On Windows, we used versioned layout by default in order to be compatible with
|
|
|
|
# autolink. On other systems, we use system layout which is what every other
|
|
|
|
# program uses. Note that the Windows check is static, and will not be affected
|
|
|
|
# by specific build properties used.
|
|
|
|
if ! $(layout)
|
|
|
|
{
|
|
|
|
if [ os.name ] = NT
|
|
|
|
{
|
|
|
|
layout = versioned ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
layout = system ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
layout-$(layout) = true ;
|
|
|
|
|
|
|
|
if $(layout) = system && $(build-type) = complete
|
|
|
|
{
|
|
|
|
ECHO error\: Cannot use --layout=system with --build-type complete. ;
|
|
|
|
ECHO error\: Please use either --layout=versioned or --layout=tagged ;
|
|
|
|
ECHO error\: if you wish to build multiple variants. ;
|
|
|
|
if [ os.name ] != NT
|
|
|
|
{
|
|
|
|
ECHO error\: Note that --layout=system is used by default on Unix
|
|
|
|
starting with Boost 1.40. ;
|
|
|
|
}
|
|
|
|
EXIT ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Possible stage only location.
|
|
|
|
stage-locate = [ option.get stagedir ] ;
|
2019-10-25 16:32:08 +00:00
|
|
|
|
|
|
|
if $(stage-locate)
|
|
|
|
{
|
|
|
|
stage-locate = [ path.root [ path.make $(stage-locate) ] [ path.pwd ] ] ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
stage-locate = $(BOOST_ROOT)/stage ;
|
|
|
|
}
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
BOOST_STAGE_LOCATE = $(stage-locate) ;
|
|
|
|
|
|
|
|
# Custom build ID.
|
|
|
|
build-id = [ option.get buildid ] ;
|
|
|
|
if $(build-id)
|
|
|
|
{
|
|
|
|
BUILD_ID = [ regex.replace $(build-id) "[*\\/:.\"\' ]" _ ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Python build id (for Python libraries only).
|
|
|
|
python-id = [ option.get "python-buildid" ] ;
|
|
|
|
if $(python-id)
|
|
|
|
{
|
|
|
|
PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-25 16:32:08 +00:00
|
|
|
if $(layout) = versioned
|
|
|
|
{
|
|
|
|
switch $(layout-version)
|
|
|
|
{
|
|
|
|
case 1.40 :
|
|
|
|
.format-name-args =
|
|
|
|
<base> <toolset> <threading> <runtime> ;
|
|
|
|
case 1.66 :
|
|
|
|
.format-name-args =
|
|
|
|
<base> <toolset> <threading> <runtime> <arch-and-model> ;
|
|
|
|
case 1.69 :
|
|
|
|
.format-name-args =
|
|
|
|
<base> <toolset> <threading> <runtime> <arch-and-model> ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if $(layout) = tagged
|
|
|
|
{
|
|
|
|
switch $(layout-version)
|
|
|
|
{
|
|
|
|
case 1.40 :
|
|
|
|
.format-name-args =
|
|
|
|
<base> <threading> <runtime> ;
|
|
|
|
case 1.66 :
|
|
|
|
.format-name-args =
|
|
|
|
<base> <threading> <runtime> ;
|
|
|
|
case 1.69 :
|
|
|
|
.format-name-args =
|
|
|
|
<base> <threading> <runtime> <arch-and-model> ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if $(layout) = system
|
|
|
|
{
|
|
|
|
.format-name-args = <base> ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
.format-name-error = true ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# 1. 'tag' function adding decorations suitable to the properties if versioned
|
|
|
|
# or tagged layout is requested. Called from Jamroot.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
rule tag ( name : type ? : property-set )
|
|
|
|
{
|
2024-09-01 13:59:48 +00:00
|
|
|
if $(type:E=x) in STATIC_LIB SHARED_LIB IMPORT_LIB
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2019-10-25 16:32:08 +00:00
|
|
|
local args = $(.format-name-args) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
if $(layout) = versioned
|
|
|
|
{
|
2019-10-25 16:32:08 +00:00
|
|
|
args += -$(BOOST_VERSION_TAG) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
2019-10-25 16:32:08 +00:00
|
|
|
local result = [ common.format-name
|
|
|
|
$(args) -$(BUILD_ID)
|
|
|
|
: $(name) : $(type) : $(property-set) ] ;
|
|
|
|
if $(.format-name-error)
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
|
|
|
EXIT error\: invalid layout '$(layout:E=)' ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Optionally add version suffix. On NT, library with version suffix will
|
|
|
|
# not be recognized by linkers. On CYGWIN, we get strage duplicate
|
|
|
|
# symbol errors when library is generated with version suffix. On OSX,
|
|
|
|
# version suffix is not needed -- the linker expects the
|
|
|
|
# libFoo.1.2.3.dylib format. AIX linkers do not accept version suffixes
|
|
|
|
# either. Pgi compilers can not accept a library with version suffix.
|
2024-09-01 13:59:48 +00:00
|
|
|
# For android, if we link to libFoo.so, which is a soft link to libFoo.so.1.2.3,
|
|
|
|
# the android studio will only pack the former into the final apk.
|
2018-08-24 19:25:20 +00:00
|
|
|
if $(type) = SHARED_LIB &&
|
2024-09-01 13:59:48 +00:00
|
|
|
! [ $(property-set).get <target-os> ] in windows cygwin darwin aix android &&
|
2018-08-24 19:25:20 +00:00
|
|
|
! [ $(property-set).get <toolset> ] in pgi
|
|
|
|
{
|
|
|
|
result = $(result).$(BOOST_VERSION) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $(result) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Specialized tag function to use for libraries linking to Python.
|
|
|
|
# Appends value of --python-buildid if provided.
|
|
|
|
rule python-tag ( name : type ? : property-set )
|
|
|
|
{
|
|
|
|
local result = $(name) ;
|
2019-10-25 16:32:08 +00:00
|
|
|
|
|
|
|
if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2019-10-25 16:32:08 +00:00
|
|
|
# Add Python version suffix
|
|
|
|
|
|
|
|
local version = [ $(property-set).get <python> ] ;
|
|
|
|
|
|
|
|
local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)" : $(version) ] ;
|
|
|
|
local suffix = $(major-minor:J="") ;
|
|
|
|
|
|
|
|
if $(suffix)
|
|
|
|
{
|
|
|
|
result = $(result)$(suffix) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Add PYTHON_ID if supplied
|
|
|
|
|
|
|
|
if $(PYTHON_ID)
|
|
|
|
{
|
|
|
|
result = $(result)-$(PYTHON_ID) ;
|
|
|
|
}
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# forward to the boost tagging rule
|
|
|
|
return [ tag $(result) : $(type) : $(property-set) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# 2. Declare targets that build and install all libraries. Specifically:
|
|
|
|
#
|
|
|
|
# - 'stage-proper' that puts all libraries in stage/lib
|
|
|
|
# - 'install-proper' that install libraries and headers to system location
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2019-10-25 16:32:08 +00:00
|
|
|
rule declare_install_and_stage_proper_targets ( libraries * )
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
|
|
|
local p = [ project.current ] ;
|
2024-09-01 13:59:48 +00:00
|
|
|
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 ;
|
|
|
|
}
|
|
|
|
}
|
2018-08-24 19:25:20 +00:00
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
alias install-proper : $(install-targets) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
$(p).mark-target-as-explicit install-proper ;
|
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
alias stage-proper : $(stage-targets) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
$(p).mark-target-as-explicit stage-proper ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# 3. Declare top-level targets 'stage' and 'install'. These examine the
|
|
|
|
# --build-type option and, in case it is 'complete', build the 'install-proper'
|
|
|
|
# and 'stage-proper' targets with a number of property sets.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2021-12-11 13:07:32 +00:00
|
|
|
rule emit-shared-static-warning ( )
|
|
|
|
{
|
|
|
|
if ! $(.shared-static-warning-emitted)
|
|
|
|
{
|
|
|
|
ECHO "" ;
|
|
|
|
ECHO "warning: The configuration link=shared, runtime-link=static is disabled" ;
|
|
|
|
ECHO "warning: by default as being too dangerous to use, and will not be built." ;
|
|
|
|
ECHO "warning: To enable it, use --allow-shared-static." ;
|
|
|
|
ECHO "" ;
|
|
|
|
|
|
|
|
.shared-static-warning-emitted = 1 ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
class top-level-target : alias-target-class
|
|
|
|
{
|
|
|
|
import modules ;
|
2021-12-11 13:07:32 +00:00
|
|
|
import boostcpp ;
|
2018-08-24 19:25:20 +00:00
|
|
|
|
|
|
|
rule __init__ ( name : project : sources * : requirements *
|
|
|
|
: default-build * : usage-requirements * )
|
|
|
|
{
|
|
|
|
alias-target-class.__init__ $(name) : $(project) : $(sources) :
|
|
|
|
$(requirements) : $(default-build) : $(usage-requirements) ;
|
|
|
|
|
|
|
|
self.build-type = [ modules.peek boostcpp : build-type ] ;
|
|
|
|
# On Linux, we build the release variant by default, since few users
|
|
|
|
# will ever want to debug C++ Boost libraries, and there is no ABI
|
|
|
|
# incompatibility between debug and release variants. We build shared
|
|
|
|
# and static libraries since that is what most packages seem to provide
|
|
|
|
# (.so in libfoo and .a in libfoo-dev).
|
|
|
|
|
|
|
|
self.minimal-properties = [ property-set.create <variant>release
|
|
|
|
<threading>multi <link>shared <link>static <runtime-link>shared ] ;
|
|
|
|
|
|
|
|
# On Windows, new IDE projects use:
|
|
|
|
#
|
|
|
|
# runtime-link=dynamic, threading=multi, variant=(debug|release)
|
|
|
|
#
|
|
|
|
# and in addition, C++ Boost's autolink defaults to static linking.
|
|
|
|
|
|
|
|
self.minimal-properties-win = [ property-set.create <variant>debug
|
|
|
|
<variant>release <threading>multi <link>static <runtime-link>shared
|
|
|
|
<address-model>32 <address-model>64 ] ;
|
|
|
|
|
|
|
|
self.complete-properties = [ property-set.create
|
|
|
|
<variant>debug <variant>release
|
|
|
|
<threading>multi
|
|
|
|
<link>shared <link>static
|
|
|
|
<runtime-link>shared <runtime-link>static ] ;
|
|
|
|
|
|
|
|
self.complete-properties-win = [ property-set.create
|
|
|
|
<variant>debug <variant>release
|
|
|
|
<threading>multi
|
|
|
|
<link>shared <link>static
|
|
|
|
<runtime-link>shared <runtime-link>static
|
|
|
|
<address-model>32 <address-model>64 ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
rule generate ( property-set )
|
|
|
|
{
|
|
|
|
modules.poke : top-level-targets : [ modules.peek : top-level-targets ]
|
|
|
|
$(self.name) ;
|
|
|
|
|
|
|
|
local os = [ $(property-set).get <target-os> ] ;
|
|
|
|
|
|
|
|
# Because we completely override the parent's 'generate' we need to
|
|
|
|
# check for default feature values ourselves.
|
|
|
|
|
|
|
|
if ! $(os)
|
|
|
|
{
|
|
|
|
os = [ feature.defaults <target-os> ] ;
|
|
|
|
os = $(os:G=) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local build-type-set ;
|
|
|
|
|
|
|
|
if $(self.build-type) = minimal
|
|
|
|
{
|
|
|
|
if $(os) = windows
|
|
|
|
{
|
|
|
|
build-type-set = $(self.minimal-properties-win) ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
build-type-set = $(self.minimal-properties) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if $(self.build-type) = complete
|
|
|
|
{
|
|
|
|
if $(os) = windows
|
|
|
|
{
|
|
|
|
build-type-set = $(self.complete-properties-win) ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
build-type-set = $(self.complete-properties) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
import errors ;
|
|
|
|
errors.error "Unknown build type" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(build-type-set)
|
|
|
|
{
|
|
|
|
local expanded = [ targets.apply-default-build $(property-set)
|
|
|
|
: $(build-type-set) ] ;
|
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
# Filter inappropriate combinations.
|
2021-12-11 13:07:32 +00:00
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
local filtered ;
|
2021-12-11 13:07:32 +00:00
|
|
|
local skipped ;
|
|
|
|
|
|
|
|
local argv = [ modules.peek : ARGV ] ;
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
for local p in $(expanded)
|
|
|
|
{
|
|
|
|
# See comment in handle-static-runtime regarding this logic.
|
|
|
|
if [ $(p).get <link> ] = shared
|
|
|
|
&& [ $(p).get <runtime-link> ] = static
|
|
|
|
&& [ $(p).get <toolset> ] != cw
|
2021-12-11 13:07:32 +00:00
|
|
|
&& ! --allow-shared-static in $(argv)
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
|
|
|
# Skip this.
|
2021-12-11 13:07:32 +00:00
|
|
|
skipped += $(p) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
filtered += $(p) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-11 13:07:32 +00:00
|
|
|
if $(expanded) = $(skipped)
|
|
|
|
{
|
|
|
|
boostcpp.emit-shared-static-warning ;
|
|
|
|
}
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
return [ build-multiple $(filtered) ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule build-multiple ( property-sets * )
|
|
|
|
{
|
|
|
|
local usage-requirements = [ property-set.empty ] ;
|
|
|
|
local result ;
|
|
|
|
for local p in $(property-sets)
|
|
|
|
{
|
|
|
|
local r = [ alias-target-class.generate $(p) ] ;
|
|
|
|
if $(r)
|
|
|
|
{
|
|
|
|
usage-requirements = [ $(usage-requirements).add $(r[1]) ] ;
|
|
|
|
result += $(r[2-]) ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $(usage-requirements) [ sequence.unique $(result) ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:32:08 +00:00
|
|
|
rule declare_top_level_targets ( libraries * )
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2019-10-25 16:32:08 +00:00
|
|
|
declare_install_and_stage_proper_targets $(libraries) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
|
|
|
|
targets.create-metatarget top-level-target : [ project.current ]
|
|
|
|
: install
|
2019-10-25 16:32:08 +00:00
|
|
|
: install-proper
|
2018-08-24 19:25:20 +00:00
|
|
|
;
|
|
|
|
targets.create-metatarget top-level-target : [ project.current ]
|
|
|
|
: stage
|
2019-10-25 16:32:08 +00:00
|
|
|
: stage-proper headers
|
2018-08-24 19:25:20 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
p = [ project.current ] ;
|
|
|
|
$(p).mark-target-as-explicit install stage ;
|
|
|
|
|
|
|
|
# This target is built by default, and will forward to 'stage' after
|
|
|
|
# producing some explanations.
|
|
|
|
targets.create-metatarget top-level-target : [ project.current ]
|
|
|
|
: forward
|
|
|
|
: explain stage
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# 4. Add hook to report configuration before the build, and confirmation with
|
|
|
|
# setup instructions after the build.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
message explain : "\nBuilding the Boost C++ Libraries.\n\n" ;
|
|
|
|
local p = [ project.current ] ;
|
|
|
|
$(p).mark-target-as-explicit explain ;
|
|
|
|
|
|
|
|
rule pre-build ( )
|
|
|
|
{
|
|
|
|
local tl = [ modules.peek : top-level-targets ] ;
|
|
|
|
if stage in $(tl) || install in $(tl)
|
|
|
|
{
|
|
|
|
# FIXME: Remove 'if' when Boost regression tests start using trunk bjam.
|
|
|
|
if PAD in [ RULENAMES ]
|
|
|
|
{
|
|
|
|
configure.print-component-configuration ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IMPORT $(__name__) : pre-build : : $(__name__).pre-build ;
|
|
|
|
build-system.set-pre-build-hook $(__name__).pre-build ;
|
|
|
|
|
|
|
|
rule post-build ( ok ? )
|
|
|
|
{
|
|
|
|
if forward in [ modules.peek : top-level-targets ]
|
|
|
|
{
|
|
|
|
if $(ok)
|
|
|
|
{
|
|
|
|
local include-path = [ path.native $(BOOST_ROOT) ] ;
|
2019-10-25 16:32:08 +00:00
|
|
|
local stage-abs = [ path.native $(stage-locate)/lib ] ;
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
ECHO "
|
|
|
|
|
|
|
|
The Boost C++ Libraries were successfully built!
|
|
|
|
|
|
|
|
The following directory should be added to compiler include paths:
|
|
|
|
|
|
|
|
$(include-path)
|
|
|
|
|
|
|
|
The following directory should be added to linker library paths:
|
|
|
|
|
|
|
|
$(stage-abs)
|
|
|
|
" ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IMPORT $(__name__) : post-build : : $(__name__).post-build ;
|
|
|
|
build-system.set-post-build-hook $(__name__).post-build ;
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# 5. Top-level setup.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# Decides which libraries are to be installed by looking at --with-<library>
|
|
|
|
# --without-<library> arguments. Returns the list of directories under "libs"
|
|
|
|
# which must be built and installed.
|
|
|
|
#
|
|
|
|
rule libraries-to-install ( existing-libs * )
|
|
|
|
{
|
|
|
|
local argv = [ modules.peek : ARGV ] ;
|
|
|
|
local with-parameter = [ MATCH ^--with-(.*) : $(argv) ] ;
|
|
|
|
local without-parameter = [ MATCH ^--without-(.*) : $(argv) ] ;
|
|
|
|
|
|
|
|
if ! $(with-parameter) && ! $(without-parameter)
|
|
|
|
{
|
|
|
|
# Nothing is specified on command line. See if maybe project-config.jam
|
|
|
|
# has some choices.
|
|
|
|
local libs = [ modules.peek project-config : libraries ] ;
|
|
|
|
with-parameter = [ MATCH ^--with-(.*) : $(libs) ] ;
|
|
|
|
without-parameter = [ MATCH ^--without-(.*) : $(libs) ] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Do some checks.
|
|
|
|
if $(with-parameter) && $(without-parameter)
|
|
|
|
{
|
|
|
|
EXIT error\: both --with-<library> and --without-<library> specified ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local wrong = [ set.difference $(with-parameter) : $(existing-libs) ] ;
|
|
|
|
if $(wrong)
|
|
|
|
{
|
|
|
|
EXIT error\: wrong library name '$(wrong[1])' in the --with-<library>
|
|
|
|
option. ;
|
|
|
|
}
|
|
|
|
local wrong = [ set.difference $(without-parameter) : $(existing-libs) ] ;
|
|
|
|
if $(wrong)
|
|
|
|
{
|
|
|
|
EXIT error\: wrong library name '$(wrong[1])' in the --without-<library>
|
|
|
|
option. ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if $(with-parameter)
|
|
|
|
{
|
|
|
|
return [ set.intersection $(existing-libs) : $(with-parameter) ] ;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return [ set.difference $(existing-libs) : $(without-parameter) ] ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:32:08 +00:00
|
|
|
rule declare-targets ( all-libraries * )
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
|
|
|
configure.register-components $(all-libraries) ;
|
|
|
|
|
|
|
|
# Select the libraries to install.
|
|
|
|
libraries = [ libraries-to-install $(all-libraries) ] ;
|
|
|
|
configure.components-building $(libraries) ;
|
|
|
|
|
|
|
|
if [ option.get "show-libraries" : : true ]
|
|
|
|
{
|
|
|
|
ECHO The following libraries require building\: ;
|
|
|
|
for local l in $(libraries)
|
|
|
|
{
|
|
|
|
ECHO " - $(l)" ;
|
|
|
|
}
|
|
|
|
EXIT ;
|
|
|
|
}
|
|
|
|
|
2019-10-25 16:32:08 +00:00
|
|
|
declare_top_level_targets $(libraries) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Returns the properties identifying the toolset. We'll use them
|
|
|
|
# below to configure checks. These are essentially same as in
|
|
|
|
# configure.builds, except we don't use address-model and
|
|
|
|
# architecture - as we're trying to detect them here.
|
|
|
|
#
|
|
|
|
rule toolset-properties ( properties * )
|
|
|
|
{
|
|
|
|
local toolset = [ property.select <toolset> : $(properties) ] ;
|
|
|
|
local toolset-version-property = "<toolset-$(toolset:G=):version>" ;
|
|
|
|
return [ property.select <target-os> <toolset> $(toolset-version-property) : $(properties) ] ;
|
|
|
|
}
|
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
.deducible-architectures = arm loongarch mips power riscv s390x sparc x86 combined ;
|
|
|
|
feature.feature x-deduced-platform
|
|
|
|
: $(.deducible-architectures)_32 $(.deducible-architectures)_64
|
|
|
|
: composite implicit optional propagated ;
|
|
|
|
for a in $(.deducible-architectures)
|
|
|
|
{
|
|
|
|
feature.compose <x-deduced-platform>$(a)_32 : <architecture>$(a) <address-model>32 ;
|
|
|
|
feature.compose <x-deduced-platform>$(a)_64 : <architecture>$(a) <address-model>64 ;
|
|
|
|
}
|
2018-08-24 19:25:20 +00:00
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
rule deduce-architecture ( properties * )
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2024-09-01 13:59:48 +00:00
|
|
|
local deduced-pl = [ property.select <x-deduced-platform> : $(properties) ] ;
|
|
|
|
if $(deduced-pl)
|
|
|
|
{
|
|
|
|
return $(deduced-pl) ;
|
|
|
|
}
|
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
local filtered = [ toolset-properties $(properties) ] ;
|
2024-09-01 13:59:48 +00:00
|
|
|
|
2018-08-24 19:25:20 +00:00
|
|
|
local names = 32 64 ;
|
|
|
|
local idx = [ configure.find-builds "default address-model" : $(filtered)
|
|
|
|
: /boost/architecture//32 "32-bit"
|
|
|
|
: /boost/architecture//64 "64-bit" ] ;
|
2024-09-01 13:59:48 +00:00
|
|
|
local deduced-am = $(names[$(idx)]) ;
|
|
|
|
if ! $(deduced-am)
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2024-09-01 13:59:48 +00:00
|
|
|
return ;
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
names = $(.deducible-architectures) ;
|
|
|
|
idx = [ configure.find-builds "default architecture" : $(filtered)
|
2018-08-24 19:25:20 +00:00
|
|
|
: /boost/architecture//arm
|
2024-09-01 13:59:48 +00:00
|
|
|
: /boost/architecture//loongarch
|
|
|
|
: /boost/architecture//mips
|
2018-08-24 19:25:20 +00:00
|
|
|
: /boost/architecture//power
|
2021-12-11 13:07:32 +00:00
|
|
|
: /boost/architecture//riscv
|
|
|
|
: /boost/architecture//s390x
|
2018-08-24 19:25:20 +00:00
|
|
|
: /boost/architecture//sparc
|
|
|
|
: /boost/architecture//x86
|
|
|
|
: /boost/architecture//combined ] ;
|
2024-09-01 13:59:48 +00:00
|
|
|
local deduced-arch = $(names[$(idx)]) ;
|
|
|
|
if ! $(deduced-arch)
|
|
|
|
{
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
local requested-am = [ property.select <address-model> : $(properties) ] ;
|
|
|
|
requested-am ?= <address-model>$(deduced-am) ;
|
|
|
|
|
|
|
|
local requested-arch = [ property.select <architecture> : $(properties) ] ;
|
|
|
|
requested-arch ?= <architecture>$(deduced-arch) ;
|
2018-08-24 19:25:20 +00:00
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
deduced-pl = $(requested-arch:G=<x-deduced-platform>)_$(requested-am:G=) ;
|
|
|
|
|
|
|
|
if ! $(deduced-pl:G=) in [ feature.values <x-deduced-platform> ]
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2024-09-01 13:59:48 +00:00
|
|
|
deduced-pl = ;
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
2024-09-01 13:59:48 +00:00
|
|
|
return $(deduced-pl) ;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
rule deduce-address-model ( properties * )
|
|
|
|
{
|
|
|
|
# this rule is a noop and exists for legacy reasons
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|
|
|
|
|
2024-09-01 13:59:48 +00:00
|
|
|
rule platform ( )
|
2018-08-24 19:25:20 +00:00
|
|
|
{
|
2024-09-01 13:59:48 +00:00
|
|
|
return <conditional>@boostcpp.deduce-architecture
|
|
|
|
<conditional>@boostcpp.deduce-address-model ;
|
2018-08-24 19:25:20 +00:00
|
|
|
}
|