2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

update stdlib feature (#494)

Adds gnu11 (libstdc++ with new ABI) and libc++ values to stdlib feature.
The value gnu was already in use by sun toolset, so this commit sets it as
libstdc++ with old ABI. Adds support for that feature to gcc, clang-linux and
clang-darwin toolsets. Refactors sun toolset to use stdlib feature via toolset
flags.
This commit is contained in:
Dmitry
2019-10-29 13:35:25 +03:00
committed by Rene Rivera
parent 115dc4c83e
commit e04b0c206e
6 changed files with 70 additions and 35 deletions

View File

@@ -254,6 +254,7 @@ include::../../src/tools/features/rtti-feature.jam[tag=doc]
include::../../src/tools/features/runtime-feature.jam[tag=doc]
include::../../src/tools/features/search-feature.jam[tag=doc]
include::../../src/tools/features/source-feature.jam[tag=doc]
include::../../src/tools/features/stdlib-feature.jam[tag=doc]
include::../../src/tools/features/strip-feature.jam[tag=doc]
include::../../src/tools/features/dll-feature.jam[tag=suppress-doc]
include::../../src/tools/features/tag-feature.jam[tag=doc]

View File

@@ -99,6 +99,13 @@ toolset.flags clang-darwin.link OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
toolset.flags clang-darwin.compile OPTIONS <lto>on/<lto-mode>full : -flto=full ;
toolset.flags clang-darwin.link OPTIONS <lto>on/<lto-mode>full : -flto=full ;
# stdlib selection
toolset.flags clang-darwin.compile OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libstdc++ ;
toolset.flags clang-darwin.link OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libstdc++ ;
toolset.flags clang-darwin.compile OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
toolset.flags clang-darwin.link OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
actions compile.c
{
"$(CONFIG_COMMAND)" -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"

View File

@@ -123,6 +123,13 @@ toolset.flags clang-linux.link OPTIONS <lto>on/<lto-mode>thin : -flto=thin ;
toolset.flags clang-linux.compile OPTIONS <lto>on/<lto-mode>full : -flto=full ;
toolset.flags clang-linux.link OPTIONS <lto>on/<lto-mode>full : -flto=full ;
# stdlib selection
toolset.flags clang-linux.compile OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libstdc++ ;
toolset.flags clang-linux.link OPTIONS <stdlib>gnu <stdlib>gnu11 : -stdlib=libstdc++ ;
toolset.flags clang-linux.compile OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
toolset.flags clang-linux.link OPTIONS <stdlib>libc++ : -stdlib=libc++ ;
###############################################################################
# C and C++ compilation

View File

@@ -3,10 +3,27 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# TODO: Documentation.
import feature ;
#| tag::doc[]
[[bbv2.builtin.features.stdlib]]`stdlib`::
*Allowed values*: `native`, `gnu`, `gnu11`, `libc++`, `sun-stlport`, `apache`.
+
Specifies C++ standard library to link to and in some cases the library ABI to
use:
+
`native`::: Use compiler's default.
`gnu`::: Use GNU Standard Library (a.k.a. pass:[libstdc++]) with the old ABI.
`gnu11`::: Use GNU Standard Library with the new ABI.
`libc++`::: Use LLVM pass:[libc++].
`sun-stlport`::: Use the STLport implementation of the standard library
provided with the Solaris Studio compiler.
`apache`::: Use the Apache stdcxx version 4 C++ standard library provided with
the Solaris Studio compiler.
|# # end::doc[]
feature.feature stdlib
: native
: native gnu gnu11 libc++ sun-stlport apache
: propagated composite ;

View File

@@ -755,6 +755,9 @@ toolset.flags gcc.link OPTIONS <lto>on/<lto-mode>full : -flto ;
toolset.flags gcc.compile OPTIONS <lto>on/<lto-mode>fat : -flto -ffat-lto-objects ;
toolset.flags gcc.link OPTIONS <lto>on/<lto-mode>fat : -flto ;
# ABI selection
toolset.flags gcc.compile.c++ DEFINES <stdlib>gnu : _GLIBCXX_USE_CXX11_ABI=0 ;
toolset.flags gcc.compile.c++ DEFINES <stdlib>gnu11 : _GLIBCXX_USE_CXX11_ABI=1 ;
###
### User free feature options.

View File

@@ -73,40 +73,13 @@ generators.override sun.prebuilt : builtin.lib-generator ;
generators.override sun.prebuilt : builtin.prebuilt ;
generators.override sun.searched-lib-generator : searched-lib-generator ;
#
# There are no less than 5 standard library options:
# 1) The default, which uses an old version of the Rogue Wave std lib,
# also available via -std=sun03.
# 2) C++03 mode + STLport, selected via the -library option.
# 3) C++03 mode plus the Apache std lib, selected via the -library option.
# 4) C++03 or C++11 in g++ compatibility mode, and GNU libstdc++3, selected via -std=c++03/11.
#
# Note that the -std, -library and -compat compiler switches appear to be largely mutually
# incompatible, and that going forward the -std switch seems to be the preferred one.
#
# See http://docs.oracle.com/cd/E37069_01/html/E37075/bkamw.html#OSSCPgnaof
#
feature.extend stdlib : sun-stlport ;
feature.compose <stdlib>sun-stlport
: <cxxflags>-library=stlport4 <cxxflags>-compat=5 <cxxflags>-features=zla
<linkflags>-library=stlport4 <linkflags>-compat=5
;
feature.extend stdlib : apache ;
feature.compose <stdlib>apache
: <cxxflags>-library=stdcxx4 <cxxflags>-compat=5 <cxxflags>-features=zla
<linkflags>-library=stdcxx4 <cxxflags>-compat=5
;
feature.extend stdlib : gnu ;
feature.compose <stdlib>gnu
: <cxxflags>-std=c++03 <linkflags>-std=c++03
;
rule init ( version ? : command * : options * )
rule init ( version ? : command * : options * )
{
local condition = [
local condition = [
common.check-init-parameters sun : version $(version) ] ;
command = [ common.get-invocation-command sun : CC
command = [ common.get-invocation-command sun : CC
: $(command) : "/opt/SUNWspro/bin" ] ;
# Even if the real compiler is not found, put CC to
@@ -114,7 +87,7 @@ rule init ( version ? : command * : options * )
command ?= CC ;
common.handle-options sun : $(condition) : $(command) : $(options) ;
command_c = $(command[1--2]) $(command[-1]:B=cc) ;
toolset.flags sun CONFIG_C_COMMAND $(condition) : $(command_c) ;
@@ -141,6 +114,33 @@ flags sun.compile OPTIONS <local-visibility>global : -xldscope=global ;
flags sun.compile.c++ OPTIONS <inlining>off : +d ;
# There are no less than 5 standard library options:
# 1) The default, which uses an old version of the Rogue Wave std lib,
# also available via -std=sun03.
# 2) C++03 mode + STLport, selected via the -library option.
# 3) C++03 mode plus the Apache std lib, selected via the -library option.
# 4) C++03 or C++11 in g++ compatibility mode, and GNU libstdc++3, selected via -std=c++03/11.
#
# Note that the -std, -library and -compat compiler switches appear to be largely mutually
# incompatible, and that going forward the -std switch seems to be the preferred one.
#
# See http://docs.oracle.com/cd/E37069_01/html/E37075/bkamw.html#OSSCPgnaof
#
flags sun.compile.c++ OPTIONS <stdlib>sun-stlport : -library=stlport4 -compat=5 -features=zla ;
flags sun.link OPTIONS <stdlib>sun-stlport : -library=stlport4 -compat=5 ;
flags sun.compile.c++ OPTIONS <stdlib>apache : -library=stdcxx4 -compat=5 -features=zla ;
flags sun.link OPTIONS <stdlib>apache : -library=stdcxx4 -compat=5 ;
flags sun.compile.c++ OPTIONS <stdlib>gnu : -std=c++03 ;
flags sun.compile.c++ DEFINES <stdlib>gnu : _GLIBCXX_USE_CXX11_ABI=0 ;
flags sun.link OPTIONS <stdlib>gnu : -std=c++03 ;
flags sun.compile.c++ OPTIONS <stdlib>gnu11 : -std=c++11 ;
flags sun.compile.c++ DEFINES <stdlib>gnu11 : _GLIBCXX_USE_CXX11_ABI=1 ;
flags sun.link OPTIONS <stdlib>gnu11 : -std=c++11 ;
# The -m32 and -m64 options are supported starting
# with Sun Studio 12. On earlier compilers, the
# 'address-model' feature is not supported and should not