Merge pull request #317 from grafikrobot/modular

Add support for modular build structure.
This commit is contained in:
Robert Ramey
2024-08-18 11:53:35 -07:00
committed by GitHub
6 changed files with 132 additions and 79 deletions

46
build.jam Normal file
View File

@@ -0,0 +1,46 @@
# Copyright René Ferdinand Rivera Morell 2023-2024
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
require-b2 5.2 ;
constant boost_dependencies :
/boost/array//boost_array
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/detail//boost_detail
/boost/integer//boost_integer
/boost/io//boost_io
/boost/iterator//boost_iterator
/boost/move//boost_move
/boost/mp11//boost_mp11
/boost/mpl//boost_mpl
/boost/optional//boost_optional
/boost/predef//boost_predef
/boost/preprocessor//boost_preprocessor
/boost/smart_ptr//boost_smart_ptr
/boost/spirit//boost_spirit
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
/boost/type_traits//boost_type_traits
/boost/utility//boost_utility
/boost/variant//boost_variant
/boost/variant2//boost_variant2 ;
project /boost/serialization
: common-requirements
<include>include
;
explicit
[ alias boost_serialization : build//boost_serialization ]
[ alias boost_wserialization : build//boost_wserialization ]
[ alias all : boost_serialization boost_wserialization example test ]
;
call-if : boost-library serialization
: install boost_serialization boost_wserialization
;

View File

@@ -1,60 +1,70 @@
# Boost serialization Library Build Jamfile
# (C) Copyright Robert Ramey 2002-2004.
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# See http://www.boost.org/libs/serialization for the library home page.
project boost/serialization
require-b2 5.0.1 ;
import-search /boost/config/checks ;
import config : requires ;
constant boost_dependencies_private :
/boost/function//boost_function
;
project
: source-location ../src
: common-requirements <library>$(boost_dependencies)
: requirements
<conditional>@include-spirit
<library>$(boost_dependencies_private)
: usage-requirements
<define>BOOST_SERIALIZATION_NO_LIB=1
;
import ../../config/checks/config : requires ;
SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ;
rule include-spirit ( properties * )
{
local old-compiler ;
if <toolset>borland in $(properties)
{
if ! <toolset-borland:version>6.1.0 in $(properties)
{
old-compiler = true ;
}
if ! <toolset-borland:version>6.1.0 in $(properties)
{
old-compiler = true ;
}
}
else if <toolset>msvc in $(properties)
{
if <toolset-msvc:version>6.5 in $(properties)
|| <toolset-msvc:version>7.0 in $(properties)
{
{
old-compiler = true ;
}
}
}
local result ;
if $(old-compiler)
{
{
if $(SPIRIT_ROOT)
{
# note - we can't use <include>$(SPIRIT_ROOT) because
# note - we can't use <include>$(SPIRIT_ROOT) because
# it puts -I$(SPIRIT_ROOT) AFTER the "../../.." in the command line.
# so use these instead
# so use these instead
result = <cxxflags>-I$(SPIRIT_ROOT) ;
}
else
else
{
echo **** spirit 1.6x required to build library with this compiler **** ;
result = <build>no ;
}
}
}
return $(result) ;
}
SOURCES =
SOURCES =
archive_exception
basic_archive
basic_iarchive
@@ -90,12 +100,12 @@ SOURCES =
codecvt_null
;
SOURCES_HAS_STD_WSTREAMBUF =
SOURCES_HAS_STD_WSTREAMBUF =
xml_oarchive
utf8_codecvt_facet
;
WSOURCES =
WSOURCES =
basic_text_wiprimitive
basic_text_woprimitive
text_wiarchive
@@ -110,27 +120,25 @@ WSOURCES =
codecvt_null
;
lib boost_serialization
lib boost_serialization
: ## sources ##
$(SOURCES).cpp
: ## requirements ##
[ check-target-builds ../../config/checks//std_wstreambuf : <source>../src/$(SOURCES_HAS_STD_WSTREAMBUF).cpp ]
[ check-target-builds /boost/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
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
lib boost_wserialization
: $(WSOURCES).cpp boost_serialization
:
lib boost_wserialization
: $(WSOURCES).cpp boost_serialization
:
[ requires std_wstreambuf ]
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
# note: both serialization and wserialization are conditioned on the this
# switch - don't change it to BOOST_WSERIALIZATION_DYN_LINK
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
boost-install boost_serialization boost_wserialization ;

View File

@@ -19,7 +19,6 @@ import ../util/test :
test-bsl-run
test-bsl-run_archive
test-bsl-run_files
test-bsl-run_polymorphic_archive
;
test-suite "demo-suite" :

View File

@@ -21,7 +21,6 @@ import ../util/test :
test-bsl-run
test-bsl-run_archive
test-bsl-run_files
test-bsl-run_polymorphic_archive
;
BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
@@ -33,7 +32,6 @@ test-suite "performance" :
# [ test-bsl-run_files performance_vector ]
# [ test-bsl-run_files performance_no_rtti ]
# [ test-bsl-run_files performance_simple_class ]
# [ test-bsl-run_polymorphic_archive performance_polymorphic : ../test/test_polymorphic_A ]
[ test-bsl-run-no-lib performance_iterators ]
[ test-bsl-run-no-lib performance_iterators_base64 ]

View File

@@ -1,18 +1,20 @@
# Boost serialization Library test Jamfile
# (C) Copyright Robert Ramey 2002-2004.
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
project libs/serialization/test
project
: id serialization_test
: requirements <library>/boost/filesystem
: requirements <library>/boost/filesystem//boost_filesystem
<library>/boost/math//boost_math_tr1
;
# import rules for testing conditional on config file variables
import ../../config/checks/config : requires ;
import-search /boost/config/checks ;
import config : requires ;
# import rules from the boost serialization test
import ../util/test :
@@ -27,9 +29,9 @@ import ../util/test :
;
BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
lib dll_a
:
:
dll_a.cpp
../build//boost_serialization
:
@@ -38,7 +40,7 @@ lib dll_a
lib dll_polymorphic_base
:
dll_polymorphic_base.cpp
dll_polymorphic_base.cpp
../build//boost_serialization
:
<link>shared
@@ -130,7 +132,7 @@ test-suite "serialization" :
;
if ! $(BOOST_ARCHIVE_LIST) {
test-suite "serialization2" :
test-suite "serialization2" :
[ test-bsl-run test_inclusion ]
[ test-bsl-run test_inclusion2 ]
@@ -178,7 +180,7 @@ if ! $(BOOST_ARCHIVE_LIST) {
#[ compile test_const_save_warn1_nvp.cpp ]
#[ compile test_const_save_warn2_nvp.cpp ]
#[ compile test_const_save_warn3_nvp.cpp ]
# should compile
[ compile test_traits_pass.cpp ]
[ compile test_const_pass.cpp ]

View File

@@ -1,8 +1,8 @@
# Boost serialization Library utility test Jamfile
# (C) Copyright Robert Ramey 2002-2004.
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification, and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
@@ -11,19 +11,19 @@
# tests.
# import rules for testing conditional on config file variables
import ../../config/checks/config : requires ;
import config : requires ;
BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
# these are used to shorten testing while in development. It permits
# testing to be applied to just a particular type of archive
if ! $(BOOST_ARCHIVE_LIST) {
BOOST_ARCHIVE_LIST =
"text_archive.hpp"
"text_warchive.hpp"
"binary_archive.hpp"
"xml_archive.hpp"
"xml_warchive.hpp"
BOOST_ARCHIVE_LIST =
"text_archive.hpp"
"text_warchive.hpp"
"binary_archive.hpp"
"xml_archive.hpp"
"xml_warchive.hpp"
;
# enable the tests which don't depend on a particular archive
BOOST_SERIALIZATION_TEST = true ;
@@ -54,8 +54,8 @@ rule run-template ( test-name : sources * : files * : requirements * ) {
# toolset optimizations
<toolset>msvc:<cxxflags>"-Gy"
# linking
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
<link>shared:<define>BOOST_WSERIALIZATION_DYN_LINK=1
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
<link>shared:<define>BOOST_WSERIALIZATION_DYN_LINK=1
$(requirements)
: # test name
$(test-name)
@@ -70,7 +70,7 @@ rule dependency-save-test ( test )
if $(m)
{
return $(m[1])save$(m[2]) ;
}
}
}
# each of the following tests is run with each type of archive
@@ -79,7 +79,7 @@ rule run-invoke ( test-name : sources * : files * : requirements * )
local save-test = [ dependency-save-test $(test-name) ] ;
local tests ;
tests += [
tests += [
run-template $(test-name)
: # sources
$(sources)
@@ -99,7 +99,7 @@ rule run-winvoke ( test-name : sources * : files * : requirements * )
local save-test = [ dependency-save-test $(test-name) ] ;
local tests ;
tests += [
tests += [
run-template $(test-name)
: # sources
$(sources)
@@ -121,7 +121,7 @@ rule run-winvoke ( test-name : sources * : files * : requirements * )
rule test-bsl-run-no-lib ( test-name : sources * : requirements * )
{
local tests ;
tests += [
tests += [
run-template $(test-name)
: # sources
$(test-name).cpp $(sources).cpp
@@ -136,8 +136,8 @@ rule test-bsl-run-no-lib ( test-name : sources * : requirements * )
rule test-bsl-run ( test-name : sources * : libs * : requirements * )
{
local tests ;
tests += [
run-invoke $(test-name)
tests += [
run-invoke $(test-name)
: # sources
$(test-name).cpp $(sources).cpp $(libs)
: # input files
@@ -188,27 +188,27 @@ rule test-bsl-run_archive ( test-name : archive-name : sources * : libs * : requ
rule test-bsl-run_files ( test-name : sources * : libs * : requirements * ) {
local tests ;
for local defn in $(BOOST_ARCHIVE_LIST) {
tests += [
test-bsl-run_archive $(test-name)
: $(defn:LB)
: $(test-name) $(sources)
: $(libs)
: $(requirements)
] ;
}
return $(tests) ;
}
rule test-bsl-run_polymorphic_files ( test-name : sources * : libs * : requirements * ) {
local tests ;
for local defn in $(BOOST_ARCHIVE_LIST) {
#ECHO polymorphic_$(defn:LB) ;
tests += [
test-bsl-run_archive $(test-name)
: polymorphic_$(defn:LB)
: $(test-name) $(sources)
: $(libs)
: $(requirements)
tests += [
test-bsl-run_archive $(test-name)
: $(defn:LB)
: $(test-name) $(sources)
: $(libs)
: $(requirements)
] ;
}
return $(tests) ;
}
rule test-bsl-run_polymorphic_files ( test-name : sources * : libs * : requirements * ) {
local tests ;
for local defn in $(BOOST_ARCHIVE_LIST) {
#ECHO polymorphic_$(defn:LB) ;
tests += [
test-bsl-run_archive $(test-name)
: polymorphic_$(defn:LB)
: $(test-name) $(sources)
: $(libs)
: $(requirements)
] ;
}
return $(tests) ;