Skip to content

Commit

Permalink
Merge pull request #282 from boostorg/better_config
Browse files Browse the repository at this point in the history
Simplify no wstreambuf support.
  • Loading branch information
robertramey authored Aug 23, 2023
2 parents 5e8c130 + 3a58de1 commit f3c564c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 45 deletions.
47 changes: 6 additions & 41 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ project boost/serialization
<conditional>@include-spirit
;

import ../../config/checks/config : requires ;

SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ;
rule include-spirit ( properties * )
{
Expand Down Expand Up @@ -88,7 +90,7 @@ SOURCES =
codecvt_null
;

SOURCES_HAS_STD_LOCALE =
SOURCES_HAS_STD_WSTREAMBUF =
xml_oarchive
utf8_codecvt_facet
;
Expand All @@ -105,51 +107,14 @@ WSOURCES =
xml_woarchive
polymorphic_xml_wiarchive
polymorphic_xml_woarchive
$(SOURCES_HAS_STD_WSTREAMBUF)
;

rule has-config-flag ( flag : properties * )
{
if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) )
{
return 1 ;
}
else
{
return ;
}
}

rule select-define-specific-sources ( properties * )
{
local result ;
if ! [ has-config-flag BOOST_NO_STD_LOCALE : $(properties) ]
{
result += <source>$(SOURCES_HAS_STD_LOCALE).cpp ;
}

#ECHO additional sources $(result) ;

return $(result) ;
}

rule should-build-wserialization ( properties * )
{
local result ;
if [ has-config-flag BOOST_NO_STD_LOCALE : $(properties) ]
{
result += <build>no ;
}

#ECHO should build wserialization $(result) ;

return $(result) ;
}

lib boost_serialization
: ## sources ##
$(SOURCES).cpp
: ## requirements ##
<conditional>@select-define-specific-sources
[ check-target-builds ../../config/checks//std_wstreambuf : <source>../src/$(SOURCES_HAS_STD_WSTREAMBUF).cpp ]
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
Expand All @@ -165,7 +130,7 @@ lib boost_serialization
lib boost_wserialization
: $(WSOURCES).cpp boost_serialization
:
<conditional>@should-build-wserialization
[ requires std_wstreambuf ]
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
Expand Down
8 changes: 4 additions & 4 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test-suite "serialization" :
[ test-bsl-run_files test_diamond_complex ]
[ test-bsl-run_files test_forward_list : A : : [ requires cxx11_hdr_forward_list ] ] # BOOST_NO_CXX11_HDR_FORWARD_LIST
[ test-bsl-run_files test_forward_list_ptrs : A : : [ requires cxx11_hdr_forward_list ] ] # BOOST_NO_CXX11_HDR_FORWARD_LIST
[ test-bsl-run_files test_helper_support ]
[ test-bsl-run_files test_helper_support : : : [ requires std_wstreambuf ] ]
[ test-bsl-run_files test_interrupts ]
[ test-bsl-run_files test_list : A ]
[ test-bsl-run_files test_list_ptrs : A ]
Expand Down Expand Up @@ -119,7 +119,7 @@ test-suite "serialization" :

[ test-bsl-run_polymorphic_files test_polymorphic : test_polymorphic_A A ]
[ test-bsl-run_polymorphic_files test_polymorphic2 : test_polymorphic2imp ]
[ test-bsl-run_polymorphic_files test_p_helper ]
[ test-bsl-run_polymorphic_files test_p_helper : : : [ requires std_wstreambuf ] ]

# this test should pass with both shared and static linking. But B2 get's mixed up with static linking
# so we'll just run the shared version of the test, which is the one that we're most interested
Expand Down Expand Up @@ -150,8 +150,8 @@ if ! $(BOOST_ARCHIVE_LIST) {
[ test-bsl-run test_private_ctor ]
[ test-bsl-run test_reset_object_address : A ]
[ test-bsl-run test_void_cast ]
[ test-bsl-run test_mult_archive_types ]
[ test-bsl-run test_iterators ]
[ test-bsl-run test_mult_archive_types : : : [ requires std_wstreambuf ] ]
[ test-bsl-run test_iterators : : : [ requires std_wstreambuf ] ]
[ test-bsl-run test_iterators_base64 ]
[ test-bsl-run test_smart_cast ]
[ test-bsl-run test_codecvt_null ]
Expand Down
11 changes: 11 additions & 0 deletions util/test.jam
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ rule test-bsl-run_archive ( test-name : archive-name : sources * : libs * : requ
<define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
$(requirements)
] ;
case "*xml_archive" :
tests += [
run-invoke $(test-name)_$(archive-name)
: # sources
$(sources).cpp $(libs)
: # input files
: # requirements
<define>BOOST_ARCHIVE_TEST=$(archive-name).hpp
$(requirements)
[ requires std_wstreambuf ]
] ;
case "*" :
tests += [
run-invoke $(test-name)_$(archive-name)
Expand Down

0 comments on commit f3c564c

Please sign in to comment.