From 4f5233911c2cc5a1b8f124eff11a0345ad5b5e7c Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 24 Jul 2017 21:36:07 -0500 Subject: [PATCH 1/3] Restructure built-in feature definitions to make it easier to add and document them. This moves the built-in feature definitions into a subdirectory where each feature (or cohesive set of features) are defined in their own file. Eventually documentation can be added in the definitions files themselves and inported into the full documentation. Not all features got move by this. There are some features spread out through the toolset files. Those will also get moved as needed, and as possible. --- src/tools/builtin.jam | 355 +----------------- src/tools/features/__init__.jam | 21 ++ src/tools/features/address-model-feature.jam | 13 + src/tools/features/allow-feature.jam | 14 + src/tools/features/architecture-feature.jam | 40 ++ src/tools/features/archiveflags-feature.jam | 12 + src/tools/features/asmflags-feature.jam | 12 + src/tools/features/build-feature.jam | 12 + src/tools/features/cflags-feature.jam | 12 + src/tools/features/conditional-feature.jam | 12 + .../features/cxx-template-depth-feature.jam | 31 ++ src/tools/features/cxxabi-feature.jam | 12 + src/tools/features/cxxflags-feature.jam | 12 + src/tools/features/cxxstd-feature.jam | 25 ++ src/tools/features/debug-feature.jam | 16 + src/tools/features/define-feature.jam | 16 + src/tools/features/dependency-feature.jam | 32 ++ src/tools/features/dll-feature.jam | 33 ++ src/tools/features/exception-feature.jam | 22 ++ src/tools/features/fflags-feature.jam | 12 + src/tools/features/file-feature.jam | 12 + src/tools/features/find-lib-feature.jam | 20 + src/tools/features/flags-feature.jam | 12 + src/tools/features/include-feature.jam | 13 + .../features/instruction-set-feature.jam | 46 +++ src/tools/features/internal-feature.jam | 19 + src/tools/features/library-feature.jam | 12 + src/tools/features/link-feature.jam | 12 + src/tools/features/linkflags-feature.jam | 12 + src/tools/features/location-feature.jam | 12 + .../features/location-prefix-feature.jam | 12 + src/tools/features/name-feature.jam | 12 + src/tools/features/objcflags-feature.jam | 16 + src/tools/features/optimization-feature.jam | 20 + src/tools/features/os-feature.jam | 78 ++++ src/tools/features/rtti-feature.jam | 12 + src/tools/features/runtime-feature.jam | 16 + src/tools/features/search-feature.jam | 13 + src/tools/features/source-feature.jam | 12 + src/tools/features/stdlib-feature.jam | 12 + src/tools/features/strip-feature.jam | 19 + src/tools/features/tag-feature.jam | 12 + src/tools/features/threading-feature.jam | 12 + src/tools/features/toolset-feature.jam | 12 + src/tools/features/user-interface-feature.jam | 13 + src/tools/features/variant-feature.jam | 82 ++++ src/tools/features/version-feature.jam | 12 + src/tools/features/warnings-feature.jam | 21 ++ src/tools/python.jam | 2 +- 49 files changed, 917 insertions(+), 355 deletions(-) create mode 100644 src/tools/features/__init__.jam create mode 100644 src/tools/features/address-model-feature.jam create mode 100644 src/tools/features/allow-feature.jam create mode 100644 src/tools/features/architecture-feature.jam create mode 100644 src/tools/features/archiveflags-feature.jam create mode 100644 src/tools/features/asmflags-feature.jam create mode 100644 src/tools/features/build-feature.jam create mode 100644 src/tools/features/cflags-feature.jam create mode 100644 src/tools/features/conditional-feature.jam create mode 100644 src/tools/features/cxx-template-depth-feature.jam create mode 100644 src/tools/features/cxxabi-feature.jam create mode 100644 src/tools/features/cxxflags-feature.jam create mode 100644 src/tools/features/cxxstd-feature.jam create mode 100644 src/tools/features/debug-feature.jam create mode 100644 src/tools/features/define-feature.jam create mode 100644 src/tools/features/dependency-feature.jam create mode 100644 src/tools/features/dll-feature.jam create mode 100644 src/tools/features/exception-feature.jam create mode 100644 src/tools/features/fflags-feature.jam create mode 100644 src/tools/features/file-feature.jam create mode 100644 src/tools/features/find-lib-feature.jam create mode 100644 src/tools/features/flags-feature.jam create mode 100644 src/tools/features/include-feature.jam create mode 100644 src/tools/features/instruction-set-feature.jam create mode 100644 src/tools/features/internal-feature.jam create mode 100644 src/tools/features/library-feature.jam create mode 100644 src/tools/features/link-feature.jam create mode 100644 src/tools/features/linkflags-feature.jam create mode 100644 src/tools/features/location-feature.jam create mode 100644 src/tools/features/location-prefix-feature.jam create mode 100644 src/tools/features/name-feature.jam create mode 100644 src/tools/features/objcflags-feature.jam create mode 100644 src/tools/features/optimization-feature.jam create mode 100644 src/tools/features/os-feature.jam create mode 100644 src/tools/features/rtti-feature.jam create mode 100644 src/tools/features/runtime-feature.jam create mode 100644 src/tools/features/search-feature.jam create mode 100644 src/tools/features/source-feature.jam create mode 100644 src/tools/features/stdlib-feature.jam create mode 100644 src/tools/features/strip-feature.jam create mode 100644 src/tools/features/tag-feature.jam create mode 100644 src/tools/features/threading-feature.jam create mode 100644 src/tools/features/toolset-feature.jam create mode 100644 src/tools/features/user-interface-feature.jam create mode 100644 src/tools/features/variant-feature.jam create mode 100644 src/tools/features/version-feature.jam create mode 100644 src/tools/features/warnings-feature.jam diff --git a/src/tools/builtin.jam b/src/tools/builtin.jam index 08794196b..7fdc691e0 100644 --- a/src/tools/builtin.jam +++ b/src/tools/builtin.jam @@ -13,6 +13,7 @@ import alias ; import "class" : new ; import errors ; import feature ; +import features/__init__ ; import generators ; import numbers ; import os ; @@ -40,360 +41,6 @@ import convert ; import generate ; -.os-names = aix android appletv bsd cygwin darwin freebsd haiku hpux iphone linux netbsd - openbsd osf qnx qnxnto sgi solaris unix unixware windows vms - elf # Not actually an OS -- used for targeting bare metal where object - # format is ELF. This catches both -elf and -eabi gcc targets and well - # as other compilers targeting ELF. It is not clear how often we need - # the 'elf' key as opposed to other bare metal targets, but let us - # stick with gcc naming. - ; - -# Feature used to determine which OS we're on. New and -# features should be used instead. -local os = [ modules.peek : OS ] ; -feature.feature os : $(os) : propagated link-incompatible ; - - -# Translates from bjam current OS to the os tags used in host-os and target-os, -# i.e. returns the running host-os. -# -local rule default-host-os ( ) -{ - local host-os ; - if [ os.name ] in $(.os-names:U) - { - host-os = [ os.name ] ; - } - else - { - switch [ os.name ] - { - case NT : host-os = windows ; - case AS400 : host-os = unix ; - case MINGW : host-os = windows ; - case BSDI : host-os = bsd ; - case COHERENT : host-os = unix ; - case DRAGONFLYBSD : host-os = bsd ; - case IRIX : host-os = sgi ; - case HAIKU : host-os = haiku ; - case MACOSX : host-os = darwin ; - case KFREEBSD : host-os = freebsd ; - case LINUX : host-os = linux ; - case VMS : host-os = vms ; - case SUNOS : - ECHO "SunOS is not a supported operating system." ; - ECHO "We believe last version of SunOS was released in 1992, " ; - ECHO "so if you get this message, something is very wrong with configuration logic. " ; - ECHO "Please report this as a bug. " ; - EXIT ; - case * : host-os = unix ; - } - } - return $(host-os:L) ; -} - - -# The two OS features define a known set of abstract OS names. The host-os is -# the OS under which bjam is running. Even though this should really be a fixed -# property we need to list all the values to prevent unknown value errors. Both -# set the default value to the current OS to account for the default use case of -# building on the target OS. -feature.feature host-os : $(.os-names) ; -feature.set-default host-os : [ default-host-os ] ; - -feature.feature target-os : $(.os-names) : propagated link-incompatible ; -feature.set-default target-os : [ default-host-os ] ; - - -feature.feature toolset : : implicit propagated symmetric ; -feature.feature stdlib : native : propagated composite ; -feature.feature link : shared static : propagated ; -feature.feature runtime-link : shared static : propagated ; -feature.feature runtime-debugging : on off : propagated ; -feature.feature optimization : off speed space : propagated ; -feature.feature profiling : off on : propagated ; -feature.feature inlining : off on full : propagated ; -feature.feature threading : single multi : propagated ; -feature.feature rtti : on off : propagated ; -feature.feature exception-handling : on off : propagated ; -feature.feature vectorize : off on full : propagated ; - -# Whether there is support for asynchronous EH (e.g. catching SEGVs). -feature.feature asynch-exceptions : off on : propagated ; - -# Whether all extern "C" functions are considered nothrow by default. -feature.feature extern-c-nothrow : off on : propagated ; - -feature.feature debug-symbols : on off : propagated ; -# Controls whether the binary should be stripped -- that is have -# everything not necessary to running removed. This option should -# not be very often needed. Also, this feature will show up in -# target paths of everything, not just binaries. Should fix that -# when implementing feature relevance. -feature.feature strip : off on : propagated ; -feature.feature define : : free ; -feature.feature undef : : free ; -feature.feature "include" : : free path ; #order-sensitive ; -feature.feature cflags : : free ; -feature.feature cxxflags : : free ; -feature.feature fflags : : free ; -feature.feature asmflags : : free ; -feature.feature linkflags : : free ; -feature.feature archiveflags : : free ; -feature.feature version : : free ; -feature.feature mflags : : free ; -feature.feature mmflags : : free ; - -# Generic, i.e. non-language specific, flags for tools. -feature.feature flags : : free ; -feature.feature location-prefix : : free ; - - -# The following features are incidental since they have no effect on built -# products. Not making them incidental will result in problems in corner cases, -# e.g.: -# -# unit-test a : a.cpp : b ; -# lib b : a.cpp b ; -# -# Here, if is not incidental, we would decide we have two targets for -# a.obj with different properties and complain about it. -# -# Note that making a feature incidental does not mean it is ignored. It may be -# ignored when creating a virtual target, but the rest of build process will use -# them. -feature.feature use : : free dependency incidental ; -feature.feature dependency : : free dependency incidental ; -feature.feature implicit-dependency : : free dependency incidental ; - -feature.feature warnings : - on # Enable default/"reasonable" warning level for the tool. - all # Enable all possible warnings issued by the tool. - off # Disable all warnings issued by the tool. - : incidental propagated ; - -feature.feature warnings-as-errors : - off # Do not fail the compilation if there are warnings. - on # Fail the compilation if there are warnings. - : incidental propagated ; - -# Feature that allows us to configure the maximal template instantiation depth -# level allowed by a C++ compiler. Applies only to C++ toolsets whose compilers -# actually support this configuration setting. -# -# Note that Boost Build currently does not allow defining features that take any -# positive integral value as a parameter, which is what we need here, so we just -# define some of the values here and leave it up to the user to extend this set -# as he needs using the feature.extend rule. -# -# TODO: This should be upgraded as soon as Boost Build adds support for custom -# validated feature values or at least features allowing any positive integral -# value. See related Boost Build related trac ticket #194. -# -feature.feature c++-template-depth - : - [ numbers.range 64 1024 : 64 ] - [ numbers.range 20 1000 : 10 ] - # Maximum template instantiation depth guaranteed for ANSI/ISO C++ - # conforming programs. - 17 - : - incidental optional propagated ; - -feature.feature source : : free dependency incidental ; -feature.feature library : : free dependency incidental ; -feature.feature file : : free dependency incidental ; -feature.feature find-shared-library : : free ; #order-sensitive ; -feature.feature find-static-library : : free ; #order-sensitive ; -feature.feature library-path : : free path ; #order-sensitive ; - -# Internal feature. -feature.feature library-file : : free dependency ; - -feature.feature name : : free ; -feature.feature tag : : free ; -feature.feature search : : free path ; #order-sensitive ; -feature.feature location : : free path ; -feature.feature dll-path : : free path ; -feature.feature hardcode-dll-paths : true false : incidental ; - - -# An internal feature that holds the paths of all dependency shared libraries. -# On Windows, it is needed so that we can add all those paths to PATH when -# running applications. On Linux, it is needed to add proper -rpath-link command -# line options. -feature.feature xdll-path : : free path ; - -# Provides means to specify def-file for windows DLLs. -feature.feature def-file : : free dependency ; - -feature.feature suppress-import-lib : false true : incidental ; - -# Internal feature used to store the name of a bjam action to call when building -# a target. -feature.feature action : : free ; - -# This feature is used to allow specific generators to run. For example, QT -# tools can only be invoked when QT library is used. In that case, qt -# will be in usage requirement of the library. -feature.feature allow : : free ; - -# The addressing model to generate code for. Currently a limited set only -# specifying the bit size of pointers. -feature.feature address-model : 16 32 64 32_64 : propagated optional ; - -# Type of CPU architecture to compile for. -feature.feature architecture : - # x86 and x86-64 - x86 - - # ia64 - ia64 - - # Sparc - sparc - - # RS/6000 & PowerPC - power - - # MIPS/SGI - mips1 mips2 mips3 mips4 mips32 mips32r2 mips64 - - # HP/PA-RISC - parisc - - # Advanced RISC Machines - arm - - # Combined architectures for platforms/toolsets that support building for - # multiple architectures at once. "combined" would be the default multi-arch - # for the toolset. - combined - combined-x86-power - - : propagated optional ; - -# The specific instruction set in an architecture to compile. -feature.feature instruction-set : - # x86 and x86-64 - native i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 - pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i - conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale - yorksfield nehalem sandy-bridge ivy-bridge haswell k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp - athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona - bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 atom - - # ia64 - itanium itanium1 merced itanium2 mckinley - - # Sparc - v7 cypress v8 supersparc sparclite hypersparc sparclite86x f930 f934 - sparclet tsc701 v9 ultrasparc ultrasparc3 - - # RS/6000 & PowerPC - 401 403 405 405fp 440 440fp 505 601 602 603 603e 604 604e 620 630 740 7400 - 7450 750 801 821 823 860 970 8540 power-common ec603e g3 g4 g5 power power2 - power3 power4 power5 powerpc powerpc64 rios rios1 rsc rios2 rs64a - - # MIPS - 4kc 4kp 5kc 20kc m4k r2000 r3000 r3900 r4000 r4100 r4300 r4400 r4600 r4650 - r6000 r8000 rm7000 rm9000 orion sb1 vr4100 vr4111 vr4120 vr4130 vr4300 - vr5000 vr5400 vr5500 - - # HP/PA-RISC - 700 7100 7100lc 7200 7300 8000 - - # Advanced RISC Machines - armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5te armv6 armv6j iwmmxt ep9312 - armv7 armv7s - - : propagated optional ; - -# Used to select a specific variant of C++ ABI if the compiler supports several. -feature.feature c++abi : : propagated optional ; - -feature.feature conditional : : incidental free ; - -# The value of 'no' prevents building of a target. -feature.feature build : yes no : optional ; - -# Windows-specific features - -feature.feature user-interface : console gui wince native auto ; - -feature.feature variant : : implicit composite propagated symmetric ; - - -# Declares a new variant. -# -# First determines explicit properties for this variant, by refining parents' -# explicit properties with the passed explicit properties. The result is -# remembered and will be used if this variant is used as parent. -# -# Second, determines the full property set for this variant by adding to the -# explicit properties default values for all missing non-symmetric properties. -# -# Lastly, makes appropriate value of 'variant' property expand to the full -# property set. -# -rule variant ( name # Name of the variant - : parents-or-properties * # Specifies parent variants, if - # 'explicit-properties' are given, and - # explicit-properties or parents otherwise. - : explicit-properties * # Explicit properties. - ) -{ - local parents ; - if ! $(explicit-properties) - { - if $(parents-or-properties[1]:G) - { - explicit-properties = $(parents-or-properties) ; - } - else - { - parents = $(parents-or-properties) ; - } - } - else - { - parents = $(parents-or-properties) ; - } - - # The problem is that we have to check for conflicts between base variants. - if $(parents[2]) - { - errors.error "multiple base variants are not yet supported" ; - } - - local inherited ; - # Add explicitly specified properties for parents. - for local p in $(parents) - { - # TODO: This check may be made stricter. - if ! [ feature.is-implicit-value $(p) ] - { - errors.error "Invalid base variant" $(p) ; - } - - inherited += $(.explicit-properties.$(p)) ; - } - property.validate $(explicit-properties) ; - explicit-properties = [ property.refine $(inherited) - : $(explicit-properties) ] ; - - # Record explicitly specified properties for this variant. We do this after - # inheriting parents' properties so they affect other variants derived from - # this one. - .explicit-properties.$(name) = $(explicit-properties) ; - - feature.extend variant : $(name) ; - feature.compose $(name) : $(explicit-properties) ; -} -IMPORT $(__name__) : variant : : variant ; - - variant debug : off on off on ; variant release : speed off full diff --git a/src/tools/features/__init__.jam b/src/tools/features/__init__.jam new file mode 100644 index 000000000..a98ca6dc5 --- /dev/null +++ b/src/tools/features/__init__.jam @@ -0,0 +1,21 @@ +# Copyright 2017 Rene Rivera +# 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) + +# Here we automatically define any feature modules in this directory. + +import os path modules ; + +.this-module's-file = [ modules.binding $(__name__) ] ; +.this-module's-dir = [ path.parent [ path.make $(.this-module's-file) ] ] ; +.feature-jamfiles = [ path.glob $(.this-module's-dir) : *-feature.jam ] ; +.feature-modules = [ MATCH ^(.*)\.jam$ : $(.feature-jamfiles) ] ; + +# A loop over all feature modules in this directory +for local m in $(.feature-modules) +{ + m = [ path.basename $(m) ] ; + m = features/$(m) ; + import $(m) ; +} diff --git a/src/tools/features/address-model-feature.jam b/src/tools/features/address-model-feature.jam new file mode 100644 index 000000000..de7e736f4 --- /dev/null +++ b/src/tools/features/address-model-feature.jam @@ -0,0 +1,13 @@ +# Copyright 2017 Rene Rivera +# 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) + +# The addressing model to generate code for. Currently a limited set only +# specifying the bit size of pointers. + +import feature ; + +feature.feature address-model + : 16 32 64 32_64 + : propagated optional ; diff --git a/src/tools/features/allow-feature.jam b/src/tools/features/allow-feature.jam new file mode 100644 index 000000000..bf5697764 --- /dev/null +++ b/src/tools/features/allow-feature.jam @@ -0,0 +1,14 @@ +# Copyright 2017 Rene Rivera +# 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) + +# This feature is used to allow specific generators to run. For example, QT +# tools can only be invoked when QT library is used. In that case, qt +# will be in usage requirement of the library. + +import feature ; + +feature.feature allow + : + : free ; diff --git a/src/tools/features/architecture-feature.jam b/src/tools/features/architecture-feature.jam new file mode 100644 index 000000000..b8f7fbcbd --- /dev/null +++ b/src/tools/features/architecture-feature.jam @@ -0,0 +1,40 @@ +# Copyright 2017 Rene Rivera +# 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) + +# Type of CPU architecture to compile for. + +import feature ; + +feature.feature architecture + : + # x86 and x86-64 + x86 + + # ia64 + ia64 + + # Sparc + sparc + + # RS/6000 & PowerPC + power + + # MIPS/SGI + mips1 mips2 mips3 mips4 mips32 mips32r2 mips64 + + # HP/PA-RISC + parisc + + # Advanced RISC Machines + arm + + # Combined architectures for platforms/toolsets that support building for + # multiple architectures at once. "combined" would be the default multi-arch + # for the toolset. + combined + combined-x86-power + : + propagated optional + ; diff --git a/src/tools/features/archiveflags-feature.jam b/src/tools/features/archiveflags-feature.jam new file mode 100644 index 000000000..d4ebc3a8d --- /dev/null +++ b/src/tools/features/archiveflags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature archiveflags + : + : free ; diff --git a/src/tools/features/asmflags-feature.jam b/src/tools/features/asmflags-feature.jam new file mode 100644 index 000000000..45d8ee126 --- /dev/null +++ b/src/tools/features/asmflags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature asmflags + : + : free ; diff --git a/src/tools/features/build-feature.jam b/src/tools/features/build-feature.jam new file mode 100644 index 000000000..6cafeda0d --- /dev/null +++ b/src/tools/features/build-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# The value of 'no' prevents building of a target. + +import feature ; + +feature.feature build + : yes no + : optional ; diff --git a/src/tools/features/cflags-feature.jam b/src/tools/features/cflags-feature.jam new file mode 100644 index 000000000..37bb54bb9 --- /dev/null +++ b/src/tools/features/cflags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature cflags + : + : free ; diff --git a/src/tools/features/conditional-feature.jam b/src/tools/features/conditional-feature.jam new file mode 100644 index 000000000..35c05ef26 --- /dev/null +++ b/src/tools/features/conditional-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature conditional + : + : incidental free ; diff --git a/src/tools/features/cxx-template-depth-feature.jam b/src/tools/features/cxx-template-depth-feature.jam new file mode 100644 index 000000000..b1cd54b2d --- /dev/null +++ b/src/tools/features/cxx-template-depth-feature.jam @@ -0,0 +1,31 @@ +# Copyright 2017 Rene Rivera +# 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) + +# Feature that allows us to configure the maximal template instantiation depth +# level allowed by a C++ compiler. Applies only to C++ toolsets whose compilers +# actually support this configuration setting. +# +# Note that Boost Build currently does not allow defining features that take any +# positive integral value as a parameter, which is what we need here, so we just +# define some of the values here and leave it up to the user to extend this set +# as he needs using the feature.extend rule. +# +# TODO: This should be upgraded as soon as Boost Build adds support for custom +# validated feature values or at least features allowing any positive integral +# value. See related Boost Build related trac ticket #194. +# + +import feature ; +import numbers ; + +feature.feature c++-template-depth + : + [ numbers.range 64 1024 : 64 ] + [ numbers.range 20 1000 : 10 ] + # Maximum template instantiation depth guaranteed for ANSI/ISO C++ + # conforming programs. + 17 + : + incidental optional propagated ; diff --git a/src/tools/features/cxxabi-feature.jam b/src/tools/features/cxxabi-feature.jam new file mode 100644 index 000000000..3ff16f563 --- /dev/null +++ b/src/tools/features/cxxabi-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# Used to select a specific variant of C++ ABI if the compiler supports several. + +import feature ; + +feature.feature c++abi + : + : propagated optional ; diff --git a/src/tools/features/cxxflags-feature.jam b/src/tools/features/cxxflags-feature.jam new file mode 100644 index 000000000..0aa0ff744 --- /dev/null +++ b/src/tools/features/cxxflags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature cxxflags + : + : free ; diff --git a/src/tools/features/cxxstd-feature.jam b/src/tools/features/cxxstd-feature.jam new file mode 100644 index 000000000..b1a812335 --- /dev/null +++ b/src/tools/features/cxxstd-feature.jam @@ -0,0 +1,25 @@ +# Copyright 2017 Rene Rivera +# 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) + +# The `cxxstd` feature specifies the version of the C++ Standard Language to +# build with. All the official versions of the standard since "98" are +# included: `98`, `03`, `11`, `14`, and `17`. It is also possible to +# specify using the experimental, work in progress, `latest` version. Some +# compilers specified intermediate versions for the experimental versions +# leading up to the released standard version. Those are not included as +# it's preferred to use actual releases, when available. +# +# NOTE: This is an `optional` feature. Hence when not specified the compiler +# default behaviour is used. +# +# NOTE: Please consult the toolset specific documentation for which `cxxstd` +# is supported. + + +import feature ; + +feature.feature cxxstd + : 98 03 11 14 17 latest + : optional composite propagated ; diff --git a/src/tools/features/debug-feature.jam b/src/tools/features/debug-feature.jam new file mode 100644 index 000000000..04958f9a5 --- /dev/null +++ b/src/tools/features/debug-feature.jam @@ -0,0 +1,16 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature debug-symbols + : on off + : propagated ; + +feature.feature profiling + : off on + : propagated ; diff --git a/src/tools/features/define-feature.jam b/src/tools/features/define-feature.jam new file mode 100644 index 000000000..9208136ee --- /dev/null +++ b/src/tools/features/define-feature.jam @@ -0,0 +1,16 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature define + : + : free ; + +feature.feature undef + : + : free ; diff --git a/src/tools/features/dependency-feature.jam b/src/tools/features/dependency-feature.jam new file mode 100644 index 000000000..7c95dbd8c --- /dev/null +++ b/src/tools/features/dependency-feature.jam @@ -0,0 +1,32 @@ +# Copyright 2017 Rene Rivera +# 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) + +# The following features are incidental since they have no effect on built +# products. Not making them incidental will result in problems in corner cases, +# e.g.: +# +# unit-test a : a.cpp : b ; +# lib b : a.cpp b ; +# +# Here, if is not incidental, we would decide we have two targets for +# a.obj with different properties and complain about it. +# +# Note that making a feature incidental does not mean it is ignored. It may be +# ignored when creating a virtual target, but the rest of build process will use +# them. + +import feature ; + +feature.feature use + : + : free dependency incidental ; + +feature.feature dependency + : + : free dependency incidental ; + +feature.feature implicit-dependency + : + : free dependency incidental ; diff --git a/src/tools/features/dll-feature.jam b/src/tools/features/dll-feature.jam new file mode 100644 index 000000000..fc59cc173 --- /dev/null +++ b/src/tools/features/dll-feature.jam @@ -0,0 +1,33 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature dll-path + : + : free path ; + +feature.feature hardcode-dll-paths + : true false + : incidental ; + +# An internal feature that holds the paths of all dependency shared libraries. +# On Windows, it is needed so that we can add all those paths to PATH when +# running applications. On Linux, it is needed to add proper -rpath-link command +# line options. +feature.feature xdll-path + : + : free path ; + +# Provides means to specify def-file for windows DLLs. +feature.feature def-file + : + : free dependency ; + +feature.feature suppress-import-lib + : false true + : incidental ; diff --git a/src/tools/features/exception-feature.jam b/src/tools/features/exception-feature.jam new file mode 100644 index 000000000..d5161ef96 --- /dev/null +++ b/src/tools/features/exception-feature.jam @@ -0,0 +1,22 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature exception-handling + : on off + : propagated ; + +# Whether there is support for asynchronous EH (e.g. catching SEGVs). +feature.feature asynch-exceptions + : off on + : propagated ; + +# Whether all extern "C" functions are considered nothrow by default. +feature.feature extern-c-nothrow + : off on + : propagated ; diff --git a/src/tools/features/fflags-feature.jam b/src/tools/features/fflags-feature.jam new file mode 100644 index 000000000..7f080d037 --- /dev/null +++ b/src/tools/features/fflags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature fflags + : + : free ; diff --git a/src/tools/features/file-feature.jam b/src/tools/features/file-feature.jam new file mode 100644 index 000000000..00f19e1b0 --- /dev/null +++ b/src/tools/features/file-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature file + : + : free dependency incidental ; diff --git a/src/tools/features/find-lib-feature.jam b/src/tools/features/find-lib-feature.jam new file mode 100644 index 000000000..f75740393 --- /dev/null +++ b/src/tools/features/find-lib-feature.jam @@ -0,0 +1,20 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature find-shared-library + : + : free ; #order-sensitive ; + +feature.feature find-static-library + : + : free ; #order-sensitive ; + +feature.feature library-path + : + : free path ; #order-sensitive ; diff --git a/src/tools/features/flags-feature.jam b/src/tools/features/flags-feature.jam new file mode 100644 index 000000000..f38b5fca3 --- /dev/null +++ b/src/tools/features/flags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# Generic, i.e. non-language specific, flags for tools. + +import feature ; + +feature.feature flags + : + : free ; diff --git a/src/tools/features/include-feature.jam b/src/tools/features/include-feature.jam new file mode 100644 index 000000000..094af2425 --- /dev/null +++ b/src/tools/features/include-feature.jam @@ -0,0 +1,13 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature "include" + : + : free path #order-sensitive + ; diff --git a/src/tools/features/instruction-set-feature.jam b/src/tools/features/instruction-set-feature.jam new file mode 100644 index 000000000..3cdde0245 --- /dev/null +++ b/src/tools/features/instruction-set-feature.jam @@ -0,0 +1,46 @@ +# Copyright 2017 Rene Rivera +# 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) + +# The specific instruction set in an architecture to compile. + +import feature ; + +feature.feature instruction-set + : + # x86 and x86-64 + native i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 + pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp + athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona + bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 atom + + # ia64 + itanium itanium1 merced itanium2 mckinley + + # Sparc + v7 cypress v8 supersparc sparclite hypersparc sparclite86x f930 f934 + sparclet tsc701 v9 ultrasparc ultrasparc3 + + # RS/6000 & PowerPC + 401 403 405 405fp 440 440fp 505 601 602 603 603e 604 604e 620 630 740 7400 + 7450 750 801 821 823 860 970 8540 power-common ec603e g3 g4 g5 power power2 + power3 power4 power5 powerpc powerpc64 rios rios1 rsc rios2 rs64a + + # MIPS + 4kc 4kp 5kc 20kc m4k r2000 r3000 r3900 r4000 r4100 r4300 r4400 r4600 r4650 + r6000 r8000 rm7000 rm9000 orion sb1 vr4100 vr4111 vr4120 vr4130 vr4300 + vr5000 vr5400 vr5500 + + # HP/PA-RISC + 700 7100 7100lc 7200 7300 8000 + + # Advanced RISC Machines + armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5t armv5te armv6 armv6j iwmmxt ep9312 + armv7 armv7s + + : + propagated optional + ; diff --git a/src/tools/features/internal-feature.jam b/src/tools/features/internal-feature.jam new file mode 100644 index 000000000..5c1d88e78 --- /dev/null +++ b/src/tools/features/internal-feature.jam @@ -0,0 +1,19 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +# Internal feature. +feature.feature library-file + : + : free dependency ; + +# Internal feature used to store the name of a bjam action to call when building +# a target. +feature.feature action + : + : free ; diff --git a/src/tools/features/library-feature.jam b/src/tools/features/library-feature.jam new file mode 100644 index 000000000..97338e5c8 --- /dev/null +++ b/src/tools/features/library-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature library + : + : free dependency incidental ; diff --git a/src/tools/features/link-feature.jam b/src/tools/features/link-feature.jam new file mode 100644 index 000000000..2032b921b --- /dev/null +++ b/src/tools/features/link-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature link + : shared static + : propagated ; diff --git a/src/tools/features/linkflags-feature.jam b/src/tools/features/linkflags-feature.jam new file mode 100644 index 000000000..9ce44e005 --- /dev/null +++ b/src/tools/features/linkflags-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature linkflags + : + : free ; diff --git a/src/tools/features/location-feature.jam b/src/tools/features/location-feature.jam new file mode 100644 index 000000000..dd49c5d72 --- /dev/null +++ b/src/tools/features/location-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature location + : + : free path ; diff --git a/src/tools/features/location-prefix-feature.jam b/src/tools/features/location-prefix-feature.jam new file mode 100644 index 000000000..61789f218 --- /dev/null +++ b/src/tools/features/location-prefix-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature location-prefix + : + : free ; diff --git a/src/tools/features/name-feature.jam b/src/tools/features/name-feature.jam new file mode 100644 index 000000000..13f6d52cd --- /dev/null +++ b/src/tools/features/name-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature name + : + : free ; diff --git a/src/tools/features/objcflags-feature.jam b/src/tools/features/objcflags-feature.jam new file mode 100644 index 000000000..e4f026bf3 --- /dev/null +++ b/src/tools/features/objcflags-feature.jam @@ -0,0 +1,16 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature mflags + : + : free ; + +feature.feature mmflags + : + : free ; diff --git a/src/tools/features/optimization-feature.jam b/src/tools/features/optimization-feature.jam new file mode 100644 index 000000000..761f76f1e --- /dev/null +++ b/src/tools/features/optimization-feature.jam @@ -0,0 +1,20 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature optimization + : off speed space + : propagated ; + +feature.feature inlining + : off on full + : propagated ; + +feature.feature vectorize + : off on full + : propagated ; diff --git a/src/tools/features/os-feature.jam b/src/tools/features/os-feature.jam new file mode 100644 index 000000000..b9c3c0f94 --- /dev/null +++ b/src/tools/features/os-feature.jam @@ -0,0 +1,78 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; +import modules ; +import os ; + +.os-names = + aix android appletv bsd cygwin darwin freebsd haiku hpux iphone linux + netbsd openbsd osf qnx qnxnto sgi solaris unix unixware windows vms + + # Not actually an OS -- used for targeting bare metal where object + # format is ELF. This catches both -elf and -eabi gcc targets as well + # as other compilers targeting ELF. It is not clear how often we need + # the 'elf' key as opposed to other bare metal targets, but let us + # stick with gcc naming. + elf + ; + +# Feature used to determine which OS we're on. New and +# features should be used instead. +local os = [ modules.peek : OS ] ; +feature.feature os : $(os) : propagated link-incompatible ; + +# Translates from bjam current OS to the os tags used in host-os and +# target-os, i.e. returns the running host-os. +# +local rule default-host-os ( ) +{ + local host-os ; + if [ os.name ] in $(.os-names:U) + { + host-os = [ os.name ] ; + } + else + { + switch [ os.name ] + { + case NT : host-os = windows ; + case AS400 : host-os = unix ; + case MINGW : host-os = windows ; + case BSDI : host-os = bsd ; + case COHERENT : host-os = unix ; + case DRAGONFLYBSD : host-os = bsd ; + case IRIX : host-os = sgi ; + case HAIKU : host-os = haiku ; + case MACOSX : host-os = darwin ; + case KFREEBSD : host-os = freebsd ; + case LINUX : host-os = linux ; + case VMS : host-os = vms ; + case SUNOS : + ECHO + "SunOS is not a supported operating system." + "We believe last version of SunOS was released in 1992, " + "so if you get this message, something is very wrong with " + "configuration logic. Please report this as a bug. " ; + EXIT ; + case * : host-os = unix ; + } + } + return $(host-os:L) ; +} + + +# The two OS features define a known set of abstract OS names. The host-os is +# the OS under which bjam is running. Even though this should really be a fixed +# property we need to list all the values to prevent unknown value errors. Both +# set the default value to the current OS to account for the default use case of +# building on the target OS. +feature.feature host-os : $(.os-names) ; +feature.set-default host-os : [ default-host-os ] ; + +feature.feature target-os : $(.os-names) : propagated link-incompatible ; +feature.set-default target-os : [ default-host-os ] ; diff --git a/src/tools/features/rtti-feature.jam b/src/tools/features/rtti-feature.jam new file mode 100644 index 000000000..c271d977f --- /dev/null +++ b/src/tools/features/rtti-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature rtti + : on off + : propagated ; diff --git a/src/tools/features/runtime-feature.jam b/src/tools/features/runtime-feature.jam new file mode 100644 index 000000000..c4bf9b2ad --- /dev/null +++ b/src/tools/features/runtime-feature.jam @@ -0,0 +1,16 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature runtime-link + : shared static + : propagated ; + +feature.feature runtime-debugging + : on off + : propagated ; diff --git a/src/tools/features/search-feature.jam b/src/tools/features/search-feature.jam new file mode 100644 index 000000000..618e37263 --- /dev/null +++ b/src/tools/features/search-feature.jam @@ -0,0 +1,13 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature search + : + : free path #order-sensitive + ; diff --git a/src/tools/features/source-feature.jam b/src/tools/features/source-feature.jam new file mode 100644 index 000000000..2d6b936d4 --- /dev/null +++ b/src/tools/features/source-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature source + : + : free dependency incidental ; diff --git a/src/tools/features/stdlib-feature.jam b/src/tools/features/stdlib-feature.jam new file mode 100644 index 000000000..2dda4804c --- /dev/null +++ b/src/tools/features/stdlib-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature stdlib + : native + : propagated composite ; diff --git a/src/tools/features/strip-feature.jam b/src/tools/features/strip-feature.jam new file mode 100644 index 000000000..7e13e0d5d --- /dev/null +++ b/src/tools/features/strip-feature.jam @@ -0,0 +1,19 @@ +# Copyright 2017 Rene Rivera +# 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) + +# Controls whether the binary should be stripped -- that is have +# everything not necessary to running removed. This option should +# not be very often needed. +# +# NOTE: Also, this feature will show up in +# target paths of everything, not just binaries. +# +# TODO: Should fix that when implementing feature relevance. + +import feature ; + +feature.feature strip + : off on + : propagated ; diff --git a/src/tools/features/tag-feature.jam b/src/tools/features/tag-feature.jam new file mode 100644 index 000000000..854a9a70e --- /dev/null +++ b/src/tools/features/tag-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature tag + : + : free ; diff --git a/src/tools/features/threading-feature.jam b/src/tools/features/threading-feature.jam new file mode 100644 index 000000000..826c1577d --- /dev/null +++ b/src/tools/features/threading-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature threading + : single multi + : propagated ; diff --git a/src/tools/features/toolset-feature.jam b/src/tools/features/toolset-feature.jam new file mode 100644 index 000000000..1e3e371f8 --- /dev/null +++ b/src/tools/features/toolset-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature toolset + : + : implicit propagated symmetric ; diff --git a/src/tools/features/user-interface-feature.jam b/src/tools/features/user-interface-feature.jam new file mode 100644 index 000000000..cbb714a91 --- /dev/null +++ b/src/tools/features/user-interface-feature.jam @@ -0,0 +1,13 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +# Windows-specific feature? + +feature.feature user-interface + : console gui wince native auto ; diff --git a/src/tools/features/variant-feature.jam b/src/tools/features/variant-feature.jam new file mode 100644 index 000000000..b1e6544df --- /dev/null +++ b/src/tools/features/variant-feature.jam @@ -0,0 +1,82 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; +import errors ; +import property ; + +feature.feature variant + : + : implicit composite propagated symmetric ; + +# Declares a new variant. +# +# First determines explicit properties for this variant, by refining parents' +# explicit properties with the passed explicit properties. The result is +# remembered and will be used if this variant is used as parent. +# +# Second, determines the full property set for this variant by adding to the +# explicit properties default values for all missing non-symmetric properties. +# +# Lastly, makes appropriate value of 'variant' property expand to the full +# property set. +# +rule variant ( name # Name of the variant + : parents-or-properties * # Specifies parent variants, if + # 'explicit-properties' are given, and + # explicit-properties or parents otherwise. + : explicit-properties * # Explicit properties. + ) +{ + local parents ; + if ! $(explicit-properties) + { + if $(parents-or-properties[1]:G) + { + explicit-properties = $(parents-or-properties) ; + } + else + { + parents = $(parents-or-properties) ; + } + } + else + { + parents = $(parents-or-properties) ; + } + + # The problem is that we have to check for conflicts between base variants. + if $(parents[2]) + { + errors.error "multiple base variants are not yet supported" ; + } + + local inherited ; + # Add explicitly specified properties for parents. + for local p in $(parents) + { + # TODO: This check may be made stricter. + if ! [ feature.is-implicit-value $(p) ] + { + errors.error "Invalid base variant" $(p) ; + } + + inherited += $(.explicit-properties.$(p)) ; + } + property.validate $(explicit-properties) ; + explicit-properties = [ property.refine $(inherited) + : $(explicit-properties) ] ; + + # Record explicitly specified properties for this variant. We do this after + # inheriting parents' properties so they affect other variants derived from + # this one. + .explicit-properties.$(name) = $(explicit-properties) ; + + feature.extend variant : $(name) ; + feature.compose $(name) : $(explicit-properties) ; +} +IMPORT $(__name__) : variant : : variant ; diff --git a/src/tools/features/version-feature.jam b/src/tools/features/version-feature.jam new file mode 100644 index 000000000..cc87eef30 --- /dev/null +++ b/src/tools/features/version-feature.jam @@ -0,0 +1,12 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature version + : + : free ; diff --git a/src/tools/features/warnings-feature.jam b/src/tools/features/warnings-feature.jam new file mode 100644 index 000000000..25ebe3576 --- /dev/null +++ b/src/tools/features/warnings-feature.jam @@ -0,0 +1,21 @@ +# Copyright 2017 Rene Rivera +# 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) + +# TODO: Documentation. + +import feature ; + +feature.feature warnings + : + on # Enable default/"reasonable" warning level for the tool. + all # Enable all possible warnings issued by the tool. + off # Disable all warnings issued by the tool. + : incidental propagated ; + +feature.feature warnings-as-errors + : + off # Do not fail the compilation if there are warnings. + on # Fail the compilation if there are warnings. + : incidental propagated ; diff --git a/src/tools/python.jam b/src/tools/python.jam index c60f450a4..406d828b7 100644 --- a/src/tools/python.jam +++ b/src/tools/python.jam @@ -561,7 +561,7 @@ toolset.flags python.capture-output PYTHON : ; # Support for Python configured --with-pydebug # feature.feature python-debugging : off on : propagated ; -builtin.variant debug-python : debug : on ; +variant debug-python : debug : on ; # Return a list of candidate commands to try when looking for a Python From 44aebcc61db884ad83993974b2caf12e6647ad1d Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 25 Jul 2017 14:48:10 -0500 Subject: [PATCH 2/3] Add `dialect` subfeature to cover the compiler extensions ot `cxxstd`. --- src/tools/features/cxxstd-feature.jam | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tools/features/cxxstd-feature.jam b/src/tools/features/cxxstd-feature.jam index b1a812335..1a8e4952f 100644 --- a/src/tools/features/cxxstd-feature.jam +++ b/src/tools/features/cxxstd-feature.jam @@ -3,6 +3,8 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +import feature ; + # The `cxxstd` feature specifies the version of the C++ Standard Language to # build with. All the official versions of the standard since "98" are # included: `98`, `03`, `11`, `14`, and `17`. It is also possible to @@ -17,9 +19,15 @@ # NOTE: Please consult the toolset specific documentation for which `cxxstd` # is supported. - -import feature ; - feature.feature cxxstd : 98 03 11 14 17 latest : optional composite propagated ; + +# The cxxstd:dialet subfeature indicates if a non-standard dialect should be +# used. These usually have either/or extensions or platform specific +# functionality. Not specifying the dialect will disable any dialect and use +# ANSI C++ Standard conformance. + +feature.subfeature cxxstd : dialect + : gnu msvc + : optional composite propagated ; From 76db93bb66730bd870551ff27a443eca78a09561 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 25 Jul 2017 16:31:42 -0500 Subject: [PATCH 3/3] Lets be inclusinve and add values for intermediate C++ versions. --- src/tools/features/cxxstd-feature.jam | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tools/features/cxxstd-feature.jam b/src/tools/features/cxxstd-feature.jam index 1a8e4952f..20bd0028b 100644 --- a/src/tools/features/cxxstd-feature.jam +++ b/src/tools/features/cxxstd-feature.jam @@ -10,8 +10,9 @@ import feature ; # included: `98`, `03`, `11`, `14`, and `17`. It is also possible to # specify using the experimental, work in progress, `latest` version. Some # compilers specified intermediate versions for the experimental versions -# leading up to the released standard version. Those are not included as -# it's preferred to use actual releases, when available. +# leading up to the released standard version. Those are included following +# the GNU nomenclature as `0x`, `1y`, `1z`, and `2a`. And depending on the +# compiler `latest` would map to one of those. # # NOTE: This is an `optional` feature. Hence when not specified the compiler # default behaviour is used. @@ -20,7 +21,7 @@ import feature ; # is supported. feature.feature cxxstd - : 98 03 11 14 17 latest + : 98 03 0x 11 1y 14 1z 17 2a latest : optional composite propagated ; # The cxxstd:dialet subfeature indicates if a non-standard dialect should be @@ -29,5 +30,5 @@ feature.feature cxxstd # ANSI C++ Standard conformance. feature.subfeature cxxstd : dialect - : gnu msvc + : gnu ms : optional composite propagated ;