early-access version 3088

This commit is contained in:
pineappleEA
2022-11-05 15:35:56 +01:00
parent 4e4fc25ce3
commit b601909c6d
35519 changed files with 5996896 additions and 860 deletions

View File

@@ -0,0 +1,309 @@
# Copyright 2008 - 2013 Roland Schwarz
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
# Boost library support module.
#
# This module allows to use the boost library from boost-build projects. The
# location of a boost source tree or the path to a pre-built version of the
# library can be configured from either site-config.jam or user-config.jam. If
# no location is configured the module looks for a BOOST_ROOT environment
# variable, which should point to a boost source tree. As a last resort it tries
# to use pre-built libraries from the standard search path of the compiler.
#
# If the location to a source tree is known, the module can be configured from
# the *-config.jam files:
#
# using boost : 1.35 : <root>/path-to-boost-root ;
#
# If the location to a pre-built version is known:
#
# using boost : 1.34
# : <include>/usr/local/include/boost_1_34
# <library>/usr/local/lib
# ;
#
# It is legal to configure more than one boost library version in the config
# files. The version identifier is used to disambiguate between them. The first
# configured version becomes the default.
#
# To use a boost library you need to put a 'use' statement into your Jamfile:
#
# import boost ;
#
# boost.use-project 1.35 ;
#
# If you do not care about a specific version you just can omit the version
# part, in which case the default is picked up:
#
# boost.use-project ;
#
# The library can be referenced with the project identifier '/boost'. To
# reference the program_options you would specify:
#
# exe myexe : mysrc.cpp : <library>/boost//program_options ;
#
# Note that the requirements are automatically transformed into suitable tags to
# find the correct pre-built library.
#
import common ;
import modules ;
import numbers ;
import project ;
import property-set ;
import regex ;
import toolset ;
.boost.auto_config = [ property-set.create <layout>system ] ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
# Configuration of the boost library to use.
#
# This can either be a boost source tree or pre-built libraries. The 'version'
# parameter must be a valid boost version number, e.g. 1.35, if specifying a
# pre-built version with versioned layout. It may be a symbolic name, e.g.
# 'trunk' if specifying a source tree. The options are specified as named
# parameters (like properties). The following parameters are available:
#
# <root>/path-to-boost-root : Specify a source tree.
# <include>/path-to-include : The include directory to search.
# <library>/path-to-library : The library directory to search.
# <layout>system or <layout>versioned : Built library layout.
# <build-id>my_build_id : The custom build id to use.
#
rule init
(
version # Version identifier.
: options * # Set the option properties.
)
{
if $(.boost.$(version))
{
import errors ;
errors.user-error Boost $(version) already configured. ;
}
else
{
if $(.debug-configuration)
{
if ! $(.boost_default)
{
echo notice\: configuring default boost library $(version) ;
}
echo notice\: configuring boost library $(version) ;
}
.boost_default ?= $(version) ; # the first configured is default
.boost.$(version) = [ property-set.create $(options) ] ;
}
}
# Use a certain version of the library.
#
# The use-project rule causes the module to define a boost project of searchable
# pre-built boost libraries, or references a source tree of the boost library.
# If the 'version' parameter is omitted either the configured default (first in
# config files) is used or an auto configuration will be attempted.
#
rule use-project
(
version ? # The version of the library to use.
)
{
project.push-current [ project.current ] ;
version ?= $(.boost_default) ;
version ?= auto_config ;
if $(.initialized)
{
if $(.initialized) != $(version)
{
import errors ;
errors.user-error Attempt to use $(__name__) with different
parameters. ;
}
}
else
{
if $(.boost.$(version))
{
local opt = $(.boost.$(version)) ;
local root = [ $(opt).get <root> ] ;
local inc = [ $(opt).get <include> ] ;
local lib = [ $(opt).get <library> ] ;
if $(.debug-configuration)
{
echo notice\: using boost library $(version) [ $(opt).raw ] ;
}
.layout = [ $(opt).get <layout> ] ;
.layout ?= versioned ;
.build_id = [ $(opt).get <build-id> ] ;
.version_tag = [ regex.replace $(version) "[*\\/:.\"\' ]" "_" ] ;
.initialized = $(version) ;
if ( $(root) && $(inc) )
|| ( $(root) && $(lib) )
|| ( $(lib) && ! $(inc) )
|| ( ! $(lib) && $(inc) )
{
import errors ;
errors.user-error Ambiguous parameters, use either <root> or
<include> with <library>. ;
}
else if ! $(root) && ! $(inc)
{
root = [ modules.peek : BOOST_ROOT ] ;
}
local prj = [ project.current ] ;
local mod = [ $(prj).project-module ] ;
if $(root)
{
modules.call-in $(mod) : use-project boost : $(root) ;
}
else
{
project.initialize $(__name__) ;
# It is possible to override the setup of the searched libraries
# per version. The (unlikely) 0.0.1 tag is meant as an example
# template only.
switch $(version)
{
case 0.0.1 : boost_0_0_1 $(inc) $(lib) ;
case * : boost_std $(inc) $(lib) ;
}
}
}
else
{
import errors ;
errors.user-error Reference to unconfigured boost version. ;
}
}
project.pop-current ;
}
local rule boost_lib_std ( id : shared-lib-define )
{
lib $(id) : : : : <link>shared:<define>$(shared-lib-define) ;
}
rule boost_std ( inc ? lib ? )
{
# The default definitions for pre-built libraries.
project boost
: usage-requirements <include>$(inc) <define>BOOST_ALL_NO_LIB
: requirements <tag>@tag_std <search>$(lib)
;
alias headers ;
boost_lib_std chrono : BOOST_CHRONO_DYN_LINK ;
boost_lib_std container : BOOST_CONTAINER_DYN_LINK ;
boost_lib_std date_time : BOOST_DATE_TIME_DYN_LINK ;
boost_lib_std filesystem : BOOST_FILE_SYSTEM_DYN_LINK ;
boost_lib_std graph : BOOST_GRAPH_DYN_LINK ;
boost_lib_std graph_parallel : BOOST_GRAPH_DYN_LINK ;
boost_lib_std iostreams : BOOST_IOSTREAMS_DYN_LINK ;
boost_lib_std json : BOOST_JSON_DYN_LINK ;
boost_lib_std locale : BOOST_LOCALE_DYN_LINK ;
boost_lib_std log : BOOST_LOG_DYN_LINK ;
boost_lib_std log_setup : BOOST_LOG_SETUP_DYN_LINK ;
boost_lib_std math_c99 : BOOST_MATH_TR1_DYN_LINK ;
boost_lib_std math_c99f : BOOST_MATH_TR1_DYN_LINK ;
boost_lib_std math_c99l : BOOST_MATH_TR1_DYN_LINK ;
boost_lib_std math_tr1 : BOOST_MATH_TR1_DYN_LINK ;
boost_lib_std math_tr1f : BOOST_MATH_TR1_DYN_LINK ;
boost_lib_std math_tr1l : BOOST_MATH_TR1_DYN_LINK ;
boost_lib_std mpi : BOOST_MPI_DYN_LINK ;
boost_lib_std prg_exec_monitor : BOOST_TEST_DYN_LINK ;
boost_lib_std program_options : BOOST_PROGRAM_OPTIONS_DYN_LINK ;
boost_lib_std python : BOOST_PYTHON_DYN_LINK ;
boost_lib_std python3 : BOOST_PYTHON_DYN_LINK ;
boost_lib_std random : BOOST_RANDOM_DYN_LINK ;
boost_lib_std regex : BOOST_REGEX_DYN_LINK ;
boost_lib_std serialization : BOOST_SERIALIZATION_DYN_LINK ;
boost_lib_std signals : BOOST_SIGNALS_DYN_LINK ;
boost_lib_std system : BOOST_SYSTEM_DYN_LINK ;
boost_lib_std test_exec_monitor : BOOST_TEST_DYN_LINK ;
boost_lib_std thread : BOOST_THREAD_DYN_DLL ;
boost_lib_std timer : BOOST_TIMER_DYN_DLL ;
boost_lib_std unit_test_framework : BOOST_TEST_DYN_LINK ;
boost_lib_std wave : BOOST_WAVE_DYN_LINK ;
boost_lib_std wserialization : BOOST_SERIALIZATION_DYN_LINK ;
}
# Example placeholder for rules defining Boost library project & library targets
# for a specific Boost library version. Copy under a different name and model
# after the boost_std rule. Please note that it is also possible to have a per
# version taging rule in case the tagging algorithm changes between versions.
#
rule boost_0_0_1 ( inc ? lib ? )
{
echo "You are trying to use an example placeholder for boost libs." ;
}
rule tag_std ( name : type ? : property-set )
{
name = boost_$(name) ;
if ( [ $(property-set).get <link> ] in static ) &&
( [ $(property-set).get <target-os> ] in windows )
{
name = lib$(name) ;
}
local result ;
if $(.layout) = system
{
local version = [ MATCH "^([0-9]+)_([0-9]+)" : $(.version_tag) ] ;
if $(version[1]) = "1" && [ numbers.less $(version[2]) 39 ]
{
result = [ tag_tagged $(name) : $(type) : $(property-set) ] ;
}
else
{
result = [ tag_system $(name) : $(type) : $(property-set) ] ;
}
}
else if $(.layout) = tagged
{
result = [ tag_tagged $(name) : $(type) : $(property-set) ] ;
}
else if $(.layout) = versioned
{
result = [ tag_versioned $(name) : $(type) : $(property-set) ] ;
}
else
{
import errors ;
errors.error Missing layout. ;
}
return $(result) ;
}
rule tag_system ( name : type ? : property-set )
{
return [ common.format-name <base> -$(.build_id) : $(name) : $(type) :
$(property-set) ] ;
}
rule tag_tagged ( name : type ? : property-set )
{
return [ common.format-name <base> <threading> <runtime> -$(.build_id) :
$(name) : $(type) : $(property-set) ] ;
}
rule tag_versioned ( name : type ? : property-set )
{
return [ common.format-name <base> <toolset> <threading> <runtime>
-$(.version_tag) -$(.build_id) : $(name) : $(type) : $(property-set) ] ;
}

View File

@@ -0,0 +1,280 @@
# $Id: boost.jam 62249 2010-05-26 19:05:19Z steven_watanabe $
# Copyright 2008 Roland Schwarz
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# Boost library support module.
#
# This module allows to use the boost library from boost-build projects.
# The location of a boost source tree or the path to a pre-built
# version of the library can be configured from either site-config.jam
# or user-config.jam. If no location is configured the module looks for
# a BOOST_ROOT environment variable, which should point to a boost source
# tree. As a last resort it tries to use pre-built libraries from the standard
# search path of the compiler.
#
# If the location to a source tree is known, the module can be configured
# from the *-config.jam files:
#
# using boost : 1.35 : <root>/path-to-boost-root ;
#
# If the location to a pre-built version is known:
#
# using boost : 1.34
# : <include>/usr/local/include/boost_1_34
# <library>/usr/local/lib
# ;
#
# It is legal to configure more than one boost library version in the config
# files. The version identifier is used to disambiguate between them.
# The first configured version becomes the default.
#
# To use a boost library you need to put a 'use' statement into your
# Jamfile:
#
# import boost ;
#
# boost.use-project 1.35 ;
#
# If you don't care about a specific version you just can omit the version
# part, in which case the default is picked up:
#
# boost.use-project ;
#
# The library can be referenced with the project identifier '/boost'. To
# reference the program_options you would specify:
#
# exe myexe : mysrc.cpp : <library>/boost//program_options ;
#
# Note that the requirements are automatically transformed into suitable
# tags to find the correct pre-built library.
#
import re
import bjam
from b2.build import alias, property, property_set, feature
from b2.manager import get_manager
from b2.tools import builtin, common
from b2.util import bjam_signature, regex
# TODO: This is currently necessary in Python Port, but was not in Jam.
feature.feature('layout', ['system', 'versioned', 'tag'], ['optional'])
feature.feature('root', [], ['optional', 'free'])
feature.feature('build-id', [], ['optional', 'free'])
__initialized = None
__boost_auto_config = property_set.create([property.Property('layout', 'system')])
__boost_configured = {}
__boost_default = None
__build_id = None
__debug = None
def debug():
global __debug
if __debug is None:
__debug = "--debug-configuration" in bjam.variable("ARGV")
return __debug
# Configuration of the boost library to use.
#
# This can either be a boost source tree or
# pre-built libraries. The 'version' parameter must be a valid boost
# version number, e.g. 1.35, if specifying a pre-built version with
# versioned layout. It may be a symbolic name, e.g. 'trunk' if specifying
# a source tree. The options are specified as named parameters (like
# properties). The following parameters are available:
#
# <root>/path-to-boost-root: Specify a source tree.
#
# <include>/path-to-include: The include directory to search.
#
# <library>/path-to-library: The library directory to search.
#
# <layout>system or <layout>versioned.
#
# <build-id>my_build_id: The custom build id to use.
#
def init(version, options = None):
assert(isinstance(version,list))
assert(len(version)==1)
version = version[0]
if version in __boost_configured:
get_manager().errors()("Boost {} already configured.".format(version));
else:
global __boost_default
if debug():
if not __boost_default:
print "notice: configuring default boost library {}".format(version)
print "notice: configuring boost library {}".format(version)
if not __boost_default:
__boost_default = version
properties = []
for option in options:
properties.append(property.create_from_string(option))
__boost_configured[ version ] = property_set.PropertySet(properties)
projects = get_manager().projects()
rules = projects.project_rules()
# Use a certain version of the library.
#
# The use-project rule causes the module to define a boost project of
# searchable pre-built boost libraries, or references a source tree
# of the boost library. If the 'version' parameter is omitted either
# the configured default (first in config files) is used or an auto
# configuration will be attempted.
#
@bjam_signature(([ "version", "?" ], ))
def use_project(version = None):
projects.push_current( projects.current() )
if not version:
version = __boost_default
if not version:
version = "auto_config"
global __initialized
if __initialized:
if __initialized != version:
get_manager().errors()('Attempt to use {} with different parameters'.format('boost'))
else:
if version in __boost_configured:
opts = __boost_configured[ version ]
root = opts.get('<root>' )
inc = opts.get('<include>')
lib = opts.get('<library>')
if debug():
print "notice: using boost library {} {}".format( version, opt.raw() )
global __layout
global __version_tag
__layout = opts.get('<layout>')
if not __layout:
__layout = 'versioned'
__build_id = opts.get('<build-id>')
__version_tag = re.sub("[*\\/:.\"\' ]", "_", version)
__initialized = version
if ( root and inc ) or \
( root and lib ) or \
( lib and not inc ) or \
( not lib and inc ):
get_manager().errors()("Ambiguous parameters, use either <root> or <include> with <library>.")
elif not root and not inc:
root = bjam.variable("BOOST_ROOT")
module = projects.current().project_module()
if root:
bjam.call('call-in-module', module, 'use-project', ['boost', root])
else:
projects.initialize(__name__)
if version == '0.0.1':
boost_0_0_1( inc, lib )
else:
boost_std( inc, lib )
else:
get_manager().errors()("Reference to unconfigured boost version.")
projects.pop_current()
rules.add_rule( 'boost.use-project', use_project )
def boost_std(inc = None, lib = None):
# The default definitions for pre-built libraries.
rules.project(
['boost'],
['usage-requirements'] + ['<include>{}'.format(i) for i in inc] + ['<define>BOOST_ALL_NO_LIB'],
['requirements'] + ['<search>{}'.format(l) for l in lib])
# TODO: There should be a better way to add a Python function into a
# project requirements property set.
tag_prop_set = property_set.create([property.Property('<tag>', tag_std)])
attributes = projects.attributes(projects.current().project_module())
attributes.requirements = attributes.requirements.refine(tag_prop_set)
alias('headers')
def boost_lib(lib_name, dyn_link_macro):
if (isinstance(lib_name,str)):
lib_name = [lib_name]
builtin.lib(lib_name, usage_requirements=['<link>shared:<define>{}'.format(dyn_link_macro)])
boost_lib('container' , 'BOOST_CONTAINER_DYN_LINK' )
boost_lib('date_time' , 'BOOST_DATE_TIME_DYN_LINK' )
boost_lib('filesystem' , 'BOOST_FILE_SYSTEM_DYN_LINK' )
boost_lib('graph' , 'BOOST_GRAPH_DYN_LINK' )
boost_lib('graph_parallel' , 'BOOST_GRAPH_DYN_LINK' )
boost_lib('iostreams' , 'BOOST_IOSTREAMS_DYN_LINK' )
boost_lib('locale' , 'BOOST_LOG_DYN_LINK' )
boost_lib('log' , 'BOOST_LOG_DYN_LINK' )
boost_lib('log_setup' , 'BOOST_LOG_DYN_LINK' )
boost_lib('math_tr1' , 'BOOST_MATH_TR1_DYN_LINK' )
boost_lib('math_tr1f' , 'BOOST_MATH_TR1_DYN_LINK' )
boost_lib('math_tr1l' , 'BOOST_MATH_TR1_DYN_LINK' )
boost_lib('math_c99' , 'BOOST_MATH_TR1_DYN_LINK' )
boost_lib('math_c99f' , 'BOOST_MATH_TR1_DYN_LINK' )
boost_lib('math_c99l' , 'BOOST_MATH_TR1_DYN_LINK' )
boost_lib('mpi' , 'BOOST_MPI_DYN_LINK' )
boost_lib('program_options' , 'BOOST_PROGRAM_OPTIONS_DYN_LINK')
boost_lib('python' , 'BOOST_PYTHON_DYN_LINK' )
boost_lib('python3' , 'BOOST_PYTHON_DYN_LINK' )
boost_lib('random' , 'BOOST_RANDOM_DYN_LINK' )
boost_lib('regex' , 'BOOST_REGEX_DYN_LINK' )
boost_lib('serialization' , 'BOOST_SERIALIZATION_DYN_LINK' )
boost_lib('wserialization' , 'BOOST_SERIALIZATION_DYN_LINK' )
boost_lib('signals' , 'BOOST_SIGNALS_DYN_LINK' )
boost_lib('system' , 'BOOST_SYSTEM_DYN_LINK' )
boost_lib('unit_test_framework' , 'BOOST_TEST_DYN_LINK' )
boost_lib('prg_exec_monitor' , 'BOOST_TEST_DYN_LINK' )
boost_lib('test_exec_monitor' , 'BOOST_TEST_DYN_LINK' )
boost_lib('thread' , 'BOOST_THREAD_DYN_DLL' )
boost_lib('wave' , 'BOOST_WAVE_DYN_LINK' )
def boost_0_0_1( inc, lib ):
print "You are trying to use an example placeholder for boost libs." ;
# Copy this template to another place (in the file boost.jam)
# and define a project and libraries modelled after the
# boost_std rule. Please note that it is also possible to have
# a per version taging rule in case they are different between
# versions.
def tag_std(name, type, prop_set):
name = 'boost_' + name
if 'static' in prop_set.get('<link>') and 'windows' in prop_set.get('<target-os>'):
name = 'lib' + name
result = None
if __layout == 'system':
versionRe = re.search('^([0-9]+)_([0-9]+)', __version_tag)
if versionRe and versionRe.group(1) == '1' and int(versionRe.group(2)) < 39:
result = tag_tagged(name, type, prop_set)
else:
result = tag_system(name, type, prop_set)
elif __layout == 'tagged':
result = tag_tagged(name, type, prop_set)
elif __layout == 'versioned':
result = tag_versioned(name, type, prop_set)
else:
get_manager().errors()("Missing layout")
return result
def tag_maybe(param):
return ['-{}'.format(param)] if param else []
def tag_system(name, type, prop_set):
return common.format_name(['<base>'] + tag_maybe(__build_id), name, type, prop_set)
def tag_tagged(name, type, prop_set):
return common.format_name(['<base>', '<threading>', '<runtime>'] + tag_maybe(__build_id), name, type, prop_set)
def tag_versioned(name, type, prop_set):
return common.format_name(['<base>', '<toolset>', '<threading>', '<runtime>'] + tag_maybe(__version_tag) + tag_maybe(__build_id),
name, type, prop_set)

View File

@@ -0,0 +1,288 @@
# Copyright Rene Rivera 2015
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
import path ;
import project ;
import modules ;
import regex ;
import type ;
# Add a location, i.e. directory, where to search for libraries.
# The optional 'prefix' indicates which rooted-prefixes the new
# search dir applies to. The prefix defaults to '/'.
rule add-location ( dir prefix ? : base-dir ? )
{
process-args ;
prefix ?= "/" ;
# Dir path of caller to base paths from.
caller-module ?= [ CALLER_MODULE ] ;
local caller-dir = [ modules.peek $(caller-module) : __file__ ] ;
caller-dir = $(caller-dir:D) ;
base-dir ?= $(caller-dir) ;
.search-path-prefix += $(prefix) ;
.search-path.$(prefix) += [ path.root [ path.root $(dir) $(base-dir) ] [ path.pwd ] ] ;
}
# Declares additional definitions of a modular library target external
# to the modular library build itself. This makes it possible to externally
# define modular libraries without modifying the library. The passed in
# values are added on demand when the named library is first declared.
rule external (
name : sources * : requirements * : default-build * :
usage-requirements * )
{
.external.($(name)).sources = $(sources) ;
.external.($(name)).requirements = $(requirements) ;
.external.($(name)).default-build = $(default-build) ;
.external.($(name)).usage-requirements = $(usage-requirements) ;
}
# Find, and declare, any modular libraries referenced in the target-refs.
# This will both load the modular libraries, and declare/manufacture
# the modular libraries as needed.
rule find ( target-refs + )
{
process-args ;
local caller-mod = [ CALLER_MODULE ] ;
local caller-dir = [ modules.peek $(caller-mod) : __file__ ] ;
caller-dir = $(caller-dir:D) ;
caller-dir = [ path.root $(caller-dir) [ path.pwd ] ] ;
local result-refs ;
for local target-ref in $(target-refs)
{
result-refs += [ resolve-reference $(target-ref)
: $(caller-mod) $(caller-dir) ] ;
}
return $(result-refs) ;
}
##############################################################################
local rule resolve-reference ( target-ref : caller-mod caller-dir ? )
{
# ECHO %%% modular.resolve-target-ref $(target-ref) :: $(caller-mod) $(caller-dir) ;
if ! $(caller-dir)
{
caller-dir = [ modules.peek $(caller-mod) : __file__ ] ;
caller-dir = $(caller-dir:D) ;
caller-dir = [ path.root $(caller-dir) [ path.pwd ] ] ;
}
local result-ref = $(target-ref) ;
local ref = [ MATCH ^(.*)//.* : $(target-ref:G=) ] ;
# if ! ( $(ref) in $(.target-refs) )
{
# .target-refs += $(ref) ;
local search-prefix ;
local search-sub ;
for local prefix in $(.search-path-prefix)
{
if ! $(search-prefix)
{
local search-match = [ MATCH ^($(prefix))/(.*)$ : $(ref) ] ;
search-prefix = $(search-match[1]) ;
search-sub = $(search-match[2]) ;
}
}
if $(search-prefix)
{
local found = [ path.glob $(.search-path.$(search-prefix)) : $(search-sub) ] ;
found = $(found[1]) ;
if $(found)
{
local lib-ref = [ regex.split $(search-sub) / ] ;
lib-ref = $(search-prefix)/$(lib-ref[1]) ;
local lib-path = [ path.relative-to $(caller-dir) $(found) ] ;
define-library $(lib-ref) $(caller-mod) : $(lib-path) ;
}
}
}
return $(result-ref) ;
}
local rule define-library ( name caller-module ? : root )
{
# ECHO ~~~ modular.library $(name) $(caller-module) :: $(root) :: $(depends) ;
process-args ;
# Dir path of caller to base paths from.
caller-module ?= [ CALLER_MODULE ] ;
local caller-dir = [ modules.peek $(caller-module) : __file__ ] ;
caller-dir = $(caller-dir:D) ;
# Find the various parts of the library.
local lib-dir = [ path.root [ path.root $(root) $(caller-dir) ] [ path.pwd ] ] ;
local lib-contents = [ path.glob $(lib-dir) : "include" "build" ] ;
lib-contents = $(lib-contents:D=) ;
# "include" dir for library..
local include-dir ;
if "include" in $(lib-contents)
{
include-dir = $(root)/include ;
}
# If it has a build dir, i.e. it has targets to build,
# we root the project at the build dir to make it easy
# to refer to the build targets. This mirrors the regular
# Boost organization of the project aliases.
if "build" in $(lib-contents)
{
root = $(root)/build ;
build-dir = "." ;
}
# Shadow target declarations so that we can alter build targets
# to work in the standalone modular structure.
local lib-location = [ path.root [ path.make $(root) ] $(caller-dir) ] ;
local lib-module-name = [ project.module-name $(lib-location) ] ;
local modular-rules = [ RULENAMES modular-rules ] ;
IMPORT modular-rules : $(modular-rules) : $(lib-module-name) : $(modular-rules) ;
# Load/create/declare library project.
local lib-module = [ project.find $(root) : $(caller-dir) ] ;
if ! $(lib-module)
{
# If the find was unable to load the project we synthesize it.
lib-module = [ project.load $(lib-location) : synthesize ] ;
}
local lib-target = [ project.target $(lib-module) ] ;
if ! [ modules.peek $(lib-module) : __library__ ]
{
modules.poke $(lib-module) : __library__ : $(name) ;
for local type in [ modules.peek type : .types ]
{
main-rule-name = [ type.type-to-rule-name $(type) ] ;
IMPORT modular-rules : main-target-rule : $(lib-module-name) : $(main-rule-name) ;
}
}
# Declare project alternate ID.
modules.call-in $(caller-module) : use-project $(name) : $(root) ;
# Create a "library" target that has basic usage info if needed.
if ! [ $(lib-target).has-alternative-for-target library ]
{
include-dir = [ path.relative-to $(root) $(include-dir) ] ;
project.push-current $(lib-target) ;
# Declare the library alias.
modules.call-in $(lib-module) : library
: # Sources
: # Requirements
: # Default Build
: # Usage Requirements
<include>$(include-dir)
;
project.pop-current ;
}
}
local rule process-args ( )
{
if ! $(.did-process-args)
{
.did-process-args = yes ;
local argv = [ modules.peek : ARGV ] ;
local dirs = [ MATCH ^--modular-search-dir=(.*)$ : $(argv) ] ;
for local dir in $(dirs)
{
add-location $(dir) : [ path.pwd ] ;
}
}
}
rule apply-external (
mod : field : values * )
{
local result ;
local name = [ modules.peek $(mod) : __library__ ] ;
values += $(.external.($(name)).$(field)) ;
for local value in $(values)
{
result += [ resolve-reference $(value) : $(mod) ] ;
}
return $(result) ;
}
module modular-rules
{
import type ;
import targets ;
import builtin ;
import alias ;
# Avoids any form of installation for Boost modules.
rule boost-install ( libraries * ) { }
# Generic typed target rule to pre-process main target
# declarations to make them work within the standalone
# modular structure.
rule main-target-rule (
name : sources * : requirements * : default-build * :
usage-requirements * )
{
local mod = [ CALLER_MODULE ] ;
# ECHO @@@ [[$(mod)]] modular-rules.main-target-rule $(name) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ;
# First discover the required target type based on the exact alias used to
# invoke this rule.
local bt = [ BACKTRACE 1 ] ;
local rulename = $(bt[4]) ;
local target-type = [ type.type-from-rule-name $(rulename) ] ;
return [ targets.create-typed-target $(target-type) : [ project.current ] :
$(name) : $(sources) : $(requirements) : $(default-build) :
$(usage-requirements) ] ;
}
rule lib ( names + : sources * : requirements * : default-build * :
usage-requirements * )
{
local mod = [ CALLER_MODULE ] ;
requirements += <use>library ;
usage-requirements += <use>library ;
# ECHO @@@ [[$(mod)]] modular-rules.lib $(names) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ;
return [ builtin.lib $(names) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ] ;
}
rule alias ( name : sources * : requirements * : default-build * :
usage-requirements * )
{
local mod = [ CALLER_MODULE ] ;
# ECHO @@@ [[$(mod)]] modular-rules.alias $(name) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ;
return [ alias.alias $(name) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ] ;
}
rule library ( name ? : sources * : requirements * : default-build * :
usage-requirements * )
{
import modular ;
local mod = [ CALLER_MODULE ] ;
sources = [ modular.apply-external $(mod) : sources : $(sources) ] ;
requirements = [ modular.apply-external $(mod) : requirements : $(requirements) ] ;
default-build = [ modular.apply-external $(mod) : default-build : $(default-build) ] ;
usage-requirements = [ modular.apply-external $(mod) : usage-requirements : $(usage-requirements) ] ;
name ?= library ;
# ECHO @@@ [[$(mod)]] modular-rules.library $(name) :: $(sources) :: $(requirements) :: $(default-build) :: $(usage-requirements) ;
return [ alias.alias $(name) : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ] ;
}
}

View File

@@ -0,0 +1,208 @@
# Copyright 2008 Eduardo Gurgel
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
#
# Support for creating components for the Tntnet web application
# server (http://tntnet.org)
#
# Example:
#
# using tntnet : /usr ;
# lib index : index.png index.js index.css index.ecpp otherclass.cpp
# /tntnnet//tntnet /tntnet//cxxtools ;
#
#
import modules ;
import feature ;
import errors ;
import "class" : new ;
import generators ;
import project ;
import toolset : flags ;
import os ;
import virtual-target ;
import scanner ;
import type ;
type.register ECPP : ecpp ;
type.register JPEG : jpeg ;
type.register JPG : jpg ;
type.register PNG : png ;
type.register JS : js ;
type.register CSS : css ;
type.register GIF : gif ;
project.initialize $(__name__) ;
project tntnet ;
# Save the project so that we tolerate 'import + using' combo.
.project = [ project.current ] ;
# Initialized the Tntnet support module. The 'prefix' parameter
# tells where Tntnet is installed.
rule init ( prefix : full_bin ? : full_inc ? : full_lib ? )
{
project.push-current $(.project) ;
# pre-build paths to detect reinitializations changes
local inc_prefix lib_prefix bin_prefix ;
if $(full_inc)
{
inc_prefix = $(full_inc) ;
}
else
{
inc_prefix = $(prefix)/include ;
}
if $(full_lib)
{
lib_prefix = $(full_lib) ;
}
else
{
lib_prefix = $(prefix)/lib ;
}
if $(full_bin)
{
bin_prefix = $(full_bin) ;
}
else
{
bin_prefix = $(prefix)/bin ;
}
if $(.initialized)
{
if $(prefix) != $(.prefix)
{
errors.error
"Attempt the reinitialize Tntnet with different installation prefix" ;
}
if $(inc_prefix) != $(.incprefix)
{
errors.error
"Attempt the reinitialize Tntnet with different include path" ;
}
if $(lib_prefix) != $(.libprefix)
{
errors.error
"Attempt the reinitialize Tntnet with different library path" ;
}
if $(bin_prefix) != $(.binprefix)
{
errors.error
"Attempt the reinitialize Tntnet with different bin path" ;
}
}
else
{
.initialized = true ;
.prefix = $(prefix) ;
# Setup prefixes for include, binaries and libs.
.incprefix = $(.prefix)/include ;
.libprefix = $(.prefix)/lib ;
.binprefix = $(.prefix)/bin ;
# Generates cpp files from ecpp files using "ecppc" tool
generators.register-standard tntnet.ecpp : ECPP : CPP ;
# Generates cpp files from jpeg files using "ecppc" tool
generators.register-standard tntnet.jpeg : JPEG : CPP ;
# Generates cpp files from jpg files using "ecppc" tool
generators.register-standard tntnet.jpg : JPG : CPP ;
# Generates cpp files from png files using "ecppc" tool
generators.register-standard tntnet.png : PNG : CPP ;
# Generates cpp files from js files using "ecppc" tool
generators.register-standard tntnet.js : JS : CPP ;
# Generates cpp files from gif files using "ecppc" tool
generators.register-standard tntnet.gif : GIF : CPP ;
# Generates cpp files from css files using "ecppc" tool
generators.register-standard tntnet.css : CSS : CPP ;
# Scanner for ecpp includes
type.set-scanner ECPP : ecpp-scanner ;
local usage-requirements =
<include>$(.incprefix)
<library-path>$(.libprefix)
<dll-path>$(.libprefix)
<threading>multi
<allow>tntnet ;
lib cxxtools : $(main)
:
:
:
<include>$(.incprefix)/cxxtools
$(usage-requiriments)
;
lib tntnet : $(main)
:
:
:
<include>$(.incprefix)/tntnet
$(usage-requiriments)
;
}
project.pop-current ;
}
rule directory
{
return $(.prefix) ;
}
rule initialized ( )
{
return $(.initialized) ;
}
# Get <include> from current toolset.
flags tntnet.ecpp INCLUDES <include> ;
actions ecpp
{
$(.binprefix)/ecppc -I " $(INCLUDES) " -o $(<) $(>)
}
actions jpeg
{
$(.binprefix)/ecppc -b -m image/jpeg -o $(<) $(>)
}
actions jpg
{
$(.binprefix)/ecppc -b -m image/jpeg -o $(<) $(>)
}
actions js
{
$(.binprefix)/ecppc -b -m application/x-javascript -o $(<) $(>)
}
actions png
{
$(.binprefix)/ecppc -b -m image/png -o $(<) $(>)
}
actions gif
{
$(.binprefix)/ecppc -b -m image/gif -o $(<) $(>)
}
actions css
{
$(.binprefix)/ecppc -b -m text/css -o $(<) $(>)
}
class ecpp-scanner : common-scanner
{
rule pattern ( )
{
return "<%include.*>(.*)</%include>" ;
}
}
scanner.register ecpp-scanner : include ;

View File

@@ -0,0 +1,195 @@
################################################################################
#
# Copyright (c) 2007-2008 Dario Senic, Jurko Gospodnetic.
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE.txt or
# https://www.bfgroup.xyz/b2/LICENSE.txt)
#
################################################################################
################################################################################
#
# Boost Build wxFormBuilder generator tool module.
#
# wxFormBuilder is a GUI designer tool for the wxWidgets library. It can then
# generate C++ sources modeling the designed GUI using the wxWidgets library
# APIs.
#
# This module defines a wxFormBuilder project file type and rules needed to
# generate C++ source files from those projects. With it you can simply list
# wxFormBuilder projects as sources for some target and Boost Build will
# automatically convert them to C++ sources and process from there.
#
# The wxFormBuilder executable location may be provided as a parameter when
# configuring this toolset. Otherwise the default wxFormBuilder.exe executable
# name is used located in the folder pointed to by the WXFORMBUILDER environment
# variable.
#
# Current limitations:
#
# * Works only on Windows.
# * Works only when run via Boost Jam using the native Windows cmd.exe command
# interpreter, i.e. the default native Windows Boost Jam build.
# * Used wxFormBuilder projects need to have their output file names defined
# consistently with target names assumed by this build script. This means
# that their target names must use the prefix 'wxFormBuilderGenerated_' and
# have no output folder defined where the base name is equal to the .fpb
# project file's name.
#
################################################################################
################################################################################
#
# Implementation note:
#
# Avoiding the limitation on the generated target file names can be done but
# would require depending on external tools to copy the wxFormBuilder project to
# a temp location and then modify it in-place to set its target file names. On
# the other hand wxFormBuilder is expected to add command-line options for
# choosing the target file names from the command line which will allow us to
# remove this limitation in a much cleaner way.
# (23.08.2008.) (Jurko)
#
################################################################################
import generators ;
import os ;
import path ;
import toolset ;
import type ;
################################################################################
#
# wxFormBuilder.generate()
# ------------------------
#
# Action for processing WX_FORM_BUILDER_PROJECT types.
#
################################################################################
#
# Implementation notes:
#
# wxFormBuilder generated CPP and H files need to be moved to the location
# where the Boost Build target system expects them so that the generated CPP
# file can be included into the compile process and that the clean rule
# successfully deletes both CPP and H files. We expect wxFormBuilder to generate
# files in the same location where the provided WX_FORM_BUILDER_PROJECT file is
# located.
# (15.05.2007.) (Dario)
#
################################################################################
actions generate
{
start "" /wait "$(EXECUTABLE)" /g "$(2)"
move "$(1[1]:BSR=$(2:P))" "$(1[1]:P)"
move "$(1[2]:BSR=$(2:P))" "$(1[2]:P)"
}
################################################################################
#
# wxFormBuilder.init()
# --------------------
#
# Main toolset initialization rule called via the toolset.using rule.
#
################################################################################
rule init ( executable ? )
{
if $(.initialized)
{
if $(.debug-configuration)
{
ECHO notice: [wxFormBuilder-cfg] Repeated initialization request
(executable \"$(executable:E="")\") detected and ignored. ;
}
}
else
{
local environmentVariable = WXFORMBUILDER ;
if $(.debug-configuration)
{
ECHO notice: [wxFormBuilder-cfg] Configuring wxFormBuilder... ;
}
# Deduce the path to the used wxFormBuilder executable.
if ! $(executable)
{
executable = "wxFormBuilder.exe" ;
local executable-path = [ os.environ $(environmentVariable) ] ;
if $(executable-path)-is-not-empty
{
executable = [ path.root $(executable) $(executable-path) ] ;
}
else if $(.debug-configuration)
{
ECHO notice: [wxFormBuilder-cfg] No wxFormBuilder path
configured either explicitly or using the
$(environmentVariable) environment variable. ;
ECHO notice: [wxFormBuilder-cfg] To avoid complications please
update your configuration to includes a correct path to the
wxFormBuilder executable. ;
ECHO notice: [wxFormBuilder-cfg] wxFormBuilder executable will
be searched for on the system path. ;
}
}
if $(.debug-configuration)
{
ECHO notice: [wxFormBuilder-cfg] Will use wxFormBuilder executable
\"$(executable)\". ;
}
# Now we are sure we have everything we need to initialize this toolset.
.initialized = true ;
# Store the path to the used wxFormBuilder executable.
.executable = $(executable) ;
# Type registration.
type.register WX_FORM_BUILDER_PROJECT : fbp ;
# Parameters to be forwarded to the action rule.
toolset.flags wxFormBuilder.generate EXECUTABLE : $(.executable) ;
# Generator definition and registration.
generators.register-standard wxFormBuilder.generate :
WX_FORM_BUILDER_PROJECT : CPP(wxFormBuilderGenerated_%)
H(wxFormBuilderGenerated_%) ;
}
}
################################################################################
#
# wxFormBuilder.is-initialized()
# ------------------------------
#
# Returns whether this toolset has been initialized.
#
################################################################################
rule is-initialized ( )
{
return $(.initialized) ;
}
################################################################################
#
# Startup code executed when loading this module.
#
################################################################################
# Global variables for this module.
.executable = ;
.initialized = ;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}