b2 feature for standlaone mode

This commit is contained in:
Dmitry Arkhipov 2021-10-03 18:07:40 +03:00
parent a30b76c51b
commit a63c6ff301
6 changed files with 38 additions and 102 deletions

View File

@ -7,6 +7,13 @@
# Official repository: https://github.com/boostorg/json
#
import feature ;
# b2 feature to choose Boost or standalone mode
feature.feature boost.json.mode
: boost standalone
: propagated
;
build-project bench ;
build-project test ;

View File

@ -7,25 +7,9 @@
# Official repository: https://github.com/boostorg/json
#
import os ;
STANDALONE = [ os.environ STANDALONE ] ;
if $(STANDALONE)
{
LIB =
<define>BOOST_JSON_STANDALONE=1
<source>../src/src.cpp
;
}
else
{
LIB = <library>/boost/json//boost_json ;
}
exe bench :
bench.cpp
/boost/json//boost_json
:
<include>../test
:
$(LIB)
;

View File

@ -14,6 +14,11 @@ import ../../config/checks/config : requires ;
obj check_basic_alignas : ../check/basic_alignas.cpp ;
explicit check_basic_alignas ;
local cxx17-requires = [ requires
cxx17_hdr_string_view
cxx17_hdr_memory_resource
] ;
project boost/json
: requirements
[ requires
@ -28,25 +33,35 @@ project boost/json
[ check-target-builds
check_basic_alignas cxx11_basic_alignas : : <build>no
]
<boost.json.mode>standalone":$(cxx17-requires)"
<link>shared:<define>BOOST_JSON_DYN_LINK=1
<link>static:<define>BOOST_JSON_STATIC_LINK=1
<library>/boost//container/<warnings-as-errors>off
<define>BOOST_JSON_SOURCE
: usage-requirements
<link>shared:<define>BOOST_JSON_DYN_LINK=1
<link>static:<define>BOOST_JSON_STATIC_LINK=1
<library>/boost//container/<warnings-as-errors>off
<boost.json.mode>standalone:<define>BOOST_JSON_STANDALONE=1
: source-location ../src
;
alias json_sources
: src.cpp
: usage-requirements
<boost.json.mode>boost:<library>/boost//container/<warnings-as-errors>off
;
explicit json_sources ;
lib boost_json
: json_sources
: <boost.json.mode>boost
:
: <library>/boost//container/<warnings-as-errors>off
;
alias boost_json
: json_sources
: <boost.json.mode>standalone
;
boost-install boost_json ;

View File

@ -7,41 +7,12 @@
# Official repository: https://github.com/boostorg/json
#
import os ;
project : requirements <library>/boost/json//boost_json ;
STANDALONE = [ os.environ STANDALONE ] ;
if $(STANDALONE)
{
LIB =
<define>BOOST_JSON_STANDALONE=1
<source>../src/src.cpp
;
}
else
{
LIB = <library>/boost/json//boost_json ;
}
exe path : path.cpp ;
exe path :
path.cpp
: :
$(LIB)
;
exe pretty : pretty.cpp ;
exe pretty :
pretty.cpp
: :
$(LIB)
;
exe proxy : proxy.cpp ;
exe proxy :
proxy.cpp
: :
$(LIB)
;
exe validate :
validate.cpp
: :
$(LIB)
;
exe validate : validate.cpp ;

View File

@ -7,26 +7,9 @@
# Official repository: https://github.com/boostorg/json
#
import os ;
STANDALONE = [ os.environ STANDALONE ] ;
if $(STANDALONE)
{
LIB =
<define>BOOST_JSON_STANDALONE=1
<source>../src/src.cpp
;
}
else
{
LIB = <library>/boost/json//boost_json ;
}
# See the comments in CMakeLists.txt for why
# these are libraries and not exe targets.
lib fuzzerlib_basic_parser :
fuzz_basic_parser.cpp
: :
$(LIB)
/boost/json//boost_json
;

View File

@ -8,21 +8,6 @@
#
import testing ;
import ../../config/checks/config : requires ;
import os ;
STANDALONE = [ os.environ STANDALONE ] ;
if $(STANDALONE)
{
LIB =
<define>BOOST_JSON_STANDALONE=1
<source>../src/src.cpp
;
}
else
{
LIB = <library>/boost/json//boost_json ;
}
local SOURCES =
array.cpp
@ -71,26 +56,17 @@ project : requirements <include>. ;
for local f in $(SOURCES)
{
run $(f) main.cpp
: : : $(LIB)
;
run $(f) main.cpp /boost/json//boost_json ;
}
run limits.cpp main.cpp
/boost/json//json_sources
: : :
run limits.cpp main.cpp /boost/json//json_sources
: requirements
<define>BOOST_JSON_MAX_STRING_SIZE=1000
<define>BOOST_JSON_MAX_STRUCTURED_SIZE=20
<define>BOOST_JSON_STACK_BUFFER_SIZE=256
;
if ! $(STANDALONE)
{
compile standalone_with_boost.cpp
: [ requires
cxx17_hdr_string_view
cxx17_hdr_memory_resource
]
<define>BOOST_JSON_STANDALONE=1
;
}
compile standalone_with_boost.cpp
: <boost.json.mode>standalone
<dependency>/boost/json//json_sources
;