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 # 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 bench ;
build-project test ; build-project test ;

View File

@ -7,25 +7,9 @@
# Official repository: https://github.com/boostorg/json # 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 : exe bench :
bench.cpp bench.cpp
/boost/json//boost_json
: :
<include>../test <include>../test
:
$(LIB)
; ;

View File

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

View File

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

View File

@ -7,26 +7,9 @@
# Official repository: https://github.com/boostorg/json # 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 # See the comments in CMakeLists.txt for why
# these are libraries and not exe targets. # these are libraries and not exe targets.
lib fuzzerlib_basic_parser : lib fuzzerlib_basic_parser :
fuzz_basic_parser.cpp fuzz_basic_parser.cpp
: : /boost/json//boost_json
$(LIB)
; ;

View File

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