diff --git a/Jamfile b/Jamfile index 1c608ac0..ac7c826a 100644 --- a/Jamfile +++ b/Jamfile @@ -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 ; diff --git a/bench/Jamfile b/bench/Jamfile index 8bb519fd..674622e0 100644 --- a/bench/Jamfile +++ b/bench/Jamfile @@ -7,25 +7,9 @@ # Official repository: https://github.com/boostorg/json # -import os ; - -STANDALONE = [ os.environ STANDALONE ] ; -if $(STANDALONE) -{ - LIB = - BOOST_JSON_STANDALONE=1 - ../src/src.cpp - ; -} -else -{ - LIB = /boost/json//boost_json ; -} - exe bench : bench.cpp + /boost/json//boost_json : ../test - : - $(LIB) ; diff --git a/build/Jamfile b/build/Jamfile index 4a367719..e692b085 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -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 : : no ] + standalone":$(cxx17-requires)" shared:BOOST_JSON_DYN_LINK=1 static:BOOST_JSON_STATIC_LINK=1 - /boost//container/off BOOST_JSON_SOURCE : usage-requirements shared:BOOST_JSON_DYN_LINK=1 static:BOOST_JSON_STATIC_LINK=1 - /boost//container/off + standalone:BOOST_JSON_STANDALONE=1 : source-location ../src ; alias json_sources : src.cpp + : usage-requirements + boost:/boost//container/off ; explicit json_sources ; lib boost_json : json_sources + : boost + : + : /boost//container/off + ; + +alias boost_json + : json_sources + : standalone ; boost-install boost_json ; diff --git a/example/Jamfile b/example/Jamfile index 6eb7ed66..41fd9efd 100644 --- a/example/Jamfile +++ b/example/Jamfile @@ -7,41 +7,12 @@ # Official repository: https://github.com/boostorg/json # -import os ; +project : requirements /boost/json//boost_json ; -STANDALONE = [ os.environ STANDALONE ] ; -if $(STANDALONE) -{ - LIB = - BOOST_JSON_STANDALONE=1 - ../src/src.cpp - ; -} -else -{ - LIB = /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 ; diff --git a/fuzzing/Jamfile b/fuzzing/Jamfile index bbc43ef1..d98b78a9 100644 --- a/fuzzing/Jamfile +++ b/fuzzing/Jamfile @@ -7,26 +7,9 @@ # Official repository: https://github.com/boostorg/json # -import os ; - -STANDALONE = [ os.environ STANDALONE ] ; -if $(STANDALONE) -{ - LIB = - BOOST_JSON_STANDALONE=1 - ../src/src.cpp - ; -} -else -{ - LIB = /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 ; - diff --git a/test/Jamfile b/test/Jamfile index 4caa25b2..37393585 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -8,21 +8,6 @@ # import testing ; -import ../../config/checks/config : requires ; - -import os ; -STANDALONE = [ os.environ STANDALONE ] ; -if $(STANDALONE) -{ - LIB = - BOOST_JSON_STANDALONE=1 - ../src/src.cpp - ; -} -else -{ - LIB = /boost/json//boost_json ; -} local SOURCES = array.cpp @@ -71,26 +56,17 @@ project : requirements . ; 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 BOOST_JSON_MAX_STRING_SIZE=1000 BOOST_JSON_MAX_STRUCTURED_SIZE=20 BOOST_JSON_STACK_BUFFER_SIZE=256 ; -if ! $(STANDALONE) -{ - compile standalone_with_boost.cpp - : [ requires - cxx17_hdr_string_view - cxx17_hdr_memory_resource - ] - BOOST_JSON_STANDALONE=1 - ; -} +compile standalone_with_boost.cpp + : standalone + /boost/json//json_sources + ;