2
0
mirror of https://github.com/boostorg/log.git synced 2026-01-19 04:22:09 +00:00

Add support for modular build structure. (#233)

* Make the library modular usable.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Clean up build dependencies.

* Remove external build references and avoid custom project loading.

* Use relative paths to declare config sub-projects.

* Add missing NO_LIB usage requirements.

* Add missing library ref.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Update dependencies.

* Bump B2 require to 5.2

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Remove custom symbolic project names for config subprojects. And use project root relative targets.

* Move private deps to the build project.

* Put back default boost locale link as locale build is now fixed.

* Set default address-model and architecture to avoid extra/custom detection logic. Put back missing check and config rules.

* Adjust doc build to avoid boost-root references.

* Fix ref to predef.jam location.

* Have B2 build use same deps as CML for per-target private/public.

* Add log dep to log_setup, as it's needed on some platforms.

* Add boost_log_with_support target to mirror CML.

* Fix platform specific winapi dependency spec.
This commit is contained in:
René Ferdinand Rivera Morell
2025-05-25 16:48:16 -05:00
committed by GitHub
parent ad61f2c13e
commit 2530a4e03a
17 changed files with 189 additions and 139 deletions

19
build.jam Normal file
View File

@@ -0,0 +1,19 @@
# 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 ;
project /boost/log ;
explicit
[ alias boost_log : build//boost_log ]
[ alias boost_log_setup : build//boost_log_setup ]
[ alias boost_log_with_support : build//boost_log_with_support ]
[ alias all : boost_log boost_log_setup boost_log_with_support example test ]
;
call-if : boost-library log
: install boost_log boost_log_setup
;

View File

@@ -12,53 +12,120 @@ import path ;
import project ;
import feature ;
import configure ;
import-search /boost/config/checks ;
import config : requires ;
import log-arch-config ;
import log-platform-config ;
import log-build-config ;
import-search /boost/predef/tools/check ;
import predef ;
using mc ;
local here = [ modules.binding $(__name__) ] ;
project.push-current [ project.current ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ;
project.pop-current ;
# Windows libs
lib psapi ;
lib advapi32 ;
lib secur32 ;
lib ws2_32 ;
lib mswsock ;
searched-lib psapi ;
searched-lib advapi32 ;
searched-lib secur32 ;
searched-lib ws2_32 ;
searched-lib mswsock ;
explicit psapi advapi32 secur32 ws2_32 mswsock ;
# UNIX libs
lib rt ;
lib socket ;
lib nsl ;
lib ipv6 ;
searched-lib rt ;
searched-lib socket ;
searched-lib nsl ;
searched-lib ipv6 ;
explicit rt socket nsl ipv6 ;
local log_cxx_public_requirements = [ requires
constant boost_log_public_deps :
<library>/boost/assert//boost_assert
<library>/boost/config//boost_config
<library>/boost/core//boost_core
<library>/boost/date_time//boost_date_time
<library>/boost/filesystem//boost_filesystem
<library>/boost/function_types//boost_function_types
<library>/boost/fusion//boost_fusion
<library>/boost/intrusive//boost_intrusive
<library>/boost/move//boost_move
<library>/boost/mpl//boost_mpl
<library>/boost/parameter//boost_parameter
<library>/boost/phoenix//boost_phoenix
<library>/boost/predef//boost_predef
<library>/boost/preprocessor//boost_preprocessor
<library>/boost/proto//boost_proto
<library>/boost/range//boost_range
<library>/boost/smart_ptr//boost_smart_ptr
<library>/boost/system//boost_system
<library>/boost/throw_exception//boost_throw_exception
<library>/boost/type_index//boost_type_index
<library>/boost/type_traits//boost_type_traits
<library>/boost/utility//boost_utility
<target-os>windows:<library>/boost/winapi//boost_winapi
[ requires
cxx11_static_assert
] ;
]
;
local log_cxx_private_requirements = [ requires
constant boost_log_private_deps :
<library>/boost/align//boost_align
<library>/boost/asio//boost_asio
<library>/boost/bind//boost_bind
<library>/boost/exception//boost_exception
<library>/boost/interprocess//boost_interprocess
<library>/boost/optional//boost_optional
<library>/boost/random//boost_random
<library>/boost/spirit//boost_spirit
[ requires
cxx11_lambdas
] ;
]
;
local log_setup_cxx_public_requirements = [ requires
constant boost_log_setup_public_deps :
<library>/boost/assert//boost_assert
<library>/boost/config//boost_config
<library>/boost/core//boost_core
<library>/boost/iterator//boost_iterator
<library>/boost/move//boost_move
<library>/boost/optional//boost_optional
<library>/boost/parameter//boost_parameter
<library>/boost/phoenix//boost_phoenix
<library>/boost/preprocessor//boost_preprocessor
<library>/boost/property_tree//boost_property_tree
<library>/boost/smart_ptr//boost_smart_ptr
<library>/boost/type_traits//boost_type_traits
[ requires
cxx11_static_assert
cxx11_unified_initialization_syntax
] ;
]
;
local log_setup_cxx_public_requirements = [ requires
constant boost_log_setup_private_deps :
<library>/boost/asio//boost_asio
<library>/boost/bind//boost_bind
<library>/boost/date_time//boost_date_time
<library>/boost/exception//boost_exception
<library>/boost/filesystem//boost_filesystem
<library>/boost/io//boost_io
<library>/boost/log//boost_log
<library>/boost/spirit//boost_spirit
<library>/boost/throw_exception//boost_throw_exception
<library>/boost/utility//boost_utility
[ requires
cxx11_lambdas
] ;
]
;
project boost/log
constant boost_log_support_public_deps :
<library>/boost/log//boost_log
<library>/boost/exception//boost_exception
<library>/boost/spirit//boost_spirit
<library>/boost/xpressive//boost_xpressive
;
project
: source-location ../src
: common-requirements
<include>../include
: requirements
<conditional>@log-arch-config.check-instruction-set
<conditional>@log-build-config.check-atomic-int32
@@ -129,6 +196,10 @@ project boost/log
<target-os>freebsd:<library>rt
<target-os>qnxnto:<library>socket
<toolset>pgi:<library>rt
# Set these to computed values according to the build.
[ predef.address-model ]
[ predef.architecture ]
: usage-requirements
<toolset>clang:<cxxflags>-Wno-bind-to-temporary-copy
<toolset>clang:<cxxflags>-Wno-unused-function
@@ -218,16 +289,16 @@ rule select-arch-specific-sources ( properties * )
{
local result ;
if x86 in [ log-arch-config.deduce-architecture $(properties) ]
if <architecture>x86 in $(properties)
{
local has_ssse3 = [ configure.builds /boost/log/x86-extensions//ssse3 : $(properties) : "compiler supports SSSE3" ] ;
local has_ssse3 = [ configure.builds /boost/log/config/x86-ext//ssse3 : $(properties) : "compiler supports SSSE3" ] ;
if $(has_ssse3)
{
result += <define>BOOST_LOG_USE_SSSE3 ;
result += <source>$(BOOST_LOG_COMMON_SSSE3_SRC) ;
}
local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : "compiler supports AVX2" ] ;
local has_avx2 = [ configure.builds /boost/log/config/x86-ext//avx2 : $(properties) : "compiler supports AVX2" ] ;
if $(has_avx2)
{
result += <define>BOOST_LOG_USE_AVX2 ;
@@ -302,13 +373,14 @@ lib boost_log
<conditional>@select-platform-specific-sources
<link>shared:<define>BOOST_LOG_DLL
<define>BOOST_LOG_BUILDING_THE_LIB=1
$(log_cxx_public_requirements)
$(log_cxx_private_requirements)
$(boost_log_private_deps)
$(boost_log_public_deps)
: ## default-build ##
: ## usage-requirements ##
<link>shared:<define>BOOST_LOG_DYN_LINK=1
<threading>single:<define>BOOST_LOG_NO_THREADS
$(log_cxx_public_requirements)
<define>BOOST_LOG_NO_LIB=1
$(boost_log_public_deps)
;
@@ -344,14 +416,19 @@ lib boost_log_setup
<link>shared:<define>BOOST_LOG_DYN_LINK=1
<link>shared:<define>BOOST_LOG_SETUP_DLL
<define>BOOST_LOG_SETUP_BUILDING_THE_LIB=1
$(log_setup_cxx_public_requirements)
$(log_setup_cxx_private_requirements)
<library>boost_log
$(boost_log_setup_private_deps)
$(boost_log_setup_public_deps)
: ## default-build ##
: ## usage-requirements ##
<link>shared:<define>BOOST_LOG_SETUP_DYN_LINK=1
<threading>single:<define>BOOST_LOG_NO_THREADS
$(log_setup_cxx_public_requirements)
<define>BOOST_LOG_SETUP_NO_LIB=1
$(boost_log_setup_public_deps)
;
boost-install boost_log boost_log_setup ;
alias boost_log_with_support
: requirements
$(boost_log_support_public_deps)
: usage-requirements
$(boost_log_support_public_deps)
;

View File

@@ -13,68 +13,22 @@ import path ;
import property ;
import feature ;
local here = [ modules.binding $(__name__) ] ;
project.push-current [ project.current ] ;
project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ] ;
project.pop-current ;
rule deduce-address-model ( properties * )
{
local address_model = [ feature.get-values "address-model" : $(properties) ] ;
if $(address_model)
{
return $(address_model) ;
}
else
{
if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
{
return 32 ;
}
else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
{
return 64 ;
}
}
# The address-model is always set to a deduced value using the predef.address-model checks.
return [ feature.get-values <address-model> : $(properties) ] ;
}
rule deduce-architecture ( properties * )
{
local architecture = [ feature.get-values "architecture" : $(properties) ] ;
if $(architecture)
{
return $(architecture) ;
}
else
{
if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
{
return x86 ;
}
else if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
{
return arm ;
}
else if [ configure.builds /boost/architecture//mips : $(properties) : mips ]
{
return mips ;
}
else if [ configure.builds /boost/architecture//power : $(properties) : power ]
{
return power ;
}
else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
{
return sparc ;
}
}
# The architecture is always set to a deduced value using the predef.architecture checks.
return [ feature.get-values <architecture> : $(properties) ] ;
}
rule deduce-instruction-set ( properties * )
{
local result ;
local instruction_set = [ feature.get-values "instruction-set" : $(properties) ] ;
local instruction_set = [ feature.get-values <instruction-set> : $(properties) ] ;
if $(instruction_set)
{
@@ -95,7 +49,6 @@ rule deduce-instruction-set ( properties * )
rule ssse3-flags ( properties * )
{
local result ;
if <toolset>intel in $(properties)
{
if <toolset-intel:platform>win in $(properties)
@@ -111,7 +64,7 @@ rule ssse3-flags ( properties * )
{
# MSVC doesn't really care about these switches, all SSE intrinsics are always available, but still...
# Also 64 bit MSVC doesn't have the /arch:SSE2 switch as it is the default.
if 32 in [ deduce-address-model $(properties) ]
if <address-model>32 in $(properties)
{
result = <cxxflags>"/arch:SSE2" ;
}

View File

@@ -12,16 +12,6 @@ import path ;
import property ;
import feature ;
local here = [ modules.binding $(__name__) ] ;
project.push-current [ project.current ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/pthread-mutex-robust ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/native-syslog ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/atomic-int32 ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/regex-header-only ] ;
project.pop-current ;
rule has-config-flag ( flag : properties * )
{
if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) )
@@ -38,7 +28,7 @@ rule check-regex-header-only ( properties * )
{
local result ;
local has_regex_header_only = [ configure.builds /boost/log/regex-header-only//regex_header_only : $(properties) : "Boost.Regex is header-only" ] ;
local has_regex_header_only = [ configure.builds /boost/log/config/regex-header-only//regex_header_only : $(properties) : "Boost.Regex is header-only" ] ;
if ! $(has_regex_header_only)
{
result = <library>/boost/regex//boost_regex ;
@@ -51,7 +41,7 @@ rule check-atomic-int32 ( properties * )
{
local result ;
local has_atomic_int32 = [ configure.builds /boost/log/atomic-int32//atomic_int32 : $(properties) : "native atomic int32 supported" ] ;
local has_atomic_int32 = [ configure.builds /boost/log/config/atomic-int32//atomic_int32 : $(properties) : "native atomic int32 supported" ] ;
if ! $(has_atomic_int32)
{
result = <define>BOOST_LOG_WITHOUT_IPC ;
@@ -64,7 +54,7 @@ rule check-pthread-mutex-robust ( properties * )
{
local result ;
local has_pthread_mutex_robust = [ configure.builds /boost/log/pthread-mutex-robust//pthread_mutex_robust : $(properties) : "pthread supports robust mutexes" ] ;
local has_pthread_mutex_robust = [ configure.builds /boost/log/config/pthread-mutex-robust//pthread_mutex_robust : $(properties) : "pthread supports robust mutexes" ] ;
if $(has_pthread_mutex_robust)
{
result = <define>BOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST ;
@@ -79,7 +69,7 @@ rule check-native-syslog ( properties * )
if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ]
{
local has_native_syslog = [ configure.builds /boost/log/native-syslog//native_syslog : $(properties) : "native syslog supported" ] ;
local has_native_syslog = [ configure.builds /boost/log/config/native-syslog//native_syslog : $(properties) : "native syslog supported" ] ;
if $(has_native_syslog)
{
result = <define>BOOST_LOG_USE_NATIVE_SYSLOG ;
@@ -97,7 +87,7 @@ rule check-message-compiler ( properties * )
{
if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
{
local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : "has message compiler" ] ;
local has_mc = [ configure.builds /boost/log/config/message-compiler//test-availability : $(properties) : "has message compiler" ] ;
if ! $(has_mc)
{
result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;

View File

@@ -12,12 +12,6 @@ import path ;
import property ;
import feature ;
local here = [ modules.binding $(__name__) ] ;
project.push-current [ project.current ] ;
project.load [ path.join [ path.make $(here:D) ] ../config/xopen-source-600 ] ;
project.pop-current ;
rule set-platform-defines ( properties * )
{
local result ;
@@ -49,7 +43,7 @@ rule set-platform-defines ( properties * )
{
# Solaris headers are broken and cannot be included in C++03 when _XOPEN_SOURCE=600. At the same time, they cannot be included with _XOPEN_SOURCE=500 in C++11 and later.
# This is because the system headers check the C language version and error out if the version does not match. We have to test if we can request _XOPEN_SOURCE=600.
if [ configure.builds /boost/log/xopen-source-600//xopen_source_600 : $(properties) : xopen-source-600-supported ]
if [ configure.builds /boost/log/config/xopen-source-600//xopen_source_600 : $(properties) : xopen-source-600-supported ]
{
result += <define>_XOPEN_SOURCE=600 ;
}

View File

@@ -6,9 +6,9 @@
#
import project ;
import log-platform-config ;
import ../../build/log-platform-config ;
project /boost/log/atomic-int32
project
: source-location .
: requirements
<conditional>@log-platform-config.set-platform-defines

14
config/build.jam Normal file
View File

@@ -0,0 +1,14 @@
# Copyright René Ferdinand Rivera Morell
# 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)
import-search /boost/predef/tools/check ;
import predef ;
project
: requirements
# Set these to computed values according to the build.
[ predef.address-model ]
[ predef.architecture ]
;

View File

@@ -9,7 +9,7 @@ import project ;
import log-platform-config ;
using mc ;
project /boost/log/message-compiler
project
: source-location ../../src
: requirements
<conditional>@log-platform-config.set-platform-defines

View File

@@ -8,7 +8,7 @@
import project ;
import log-platform-config ;
project /boost/log/native-syslog
project
: source-location .
: requirements
<conditional>@log-platform-config.set-platform-defines

View File

@@ -8,7 +8,7 @@
import project ;
import log-platform-config ;
project /boost/log/pthread-mutex-robust
project
: source-location .
: requirements
<conditional>@log-platform-config.set-platform-defines

View File

@@ -8,7 +8,7 @@
import project ;
import log-platform-config ;
project /boost/log/regex-header-only
project
: source-location .
: requirements
<conditional>@log-platform-config.set-platform-defines

View File

@@ -6,9 +6,9 @@
#
import project ;
import log-arch-config ;
import ../../build/log-arch-config ;
project /boost/log/x86-extensions
project
: source-location .
: requirements
<pch>off

View File

@@ -7,7 +7,7 @@
import project ;
project /boost/log/xopen-source-600
project
: source-location .
: requirements
<pch>off

View File

@@ -86,57 +86,57 @@ local doxygen_params =
local top_level_includes =
[ glob
../../../boost/log/*.hpp
../include/boost/log/*.hpp
] ;
local core_includes =
[ glob
../../../boost/log/core/*.hpp
../include/boost/log/core/*.hpp
] ;
local attributes_includes =
[ glob
../../../boost/log/attributes/*.hpp
../include/boost/log/attributes/*.hpp
] ;
local expressions_includes =
[ glob
../../../boost/log/expressions/*.hpp
../../../boost/log/expressions/predicates/*.hpp
../../../boost/log/expressions/formatters/*.hpp
../include/boost/log/expressions/*.hpp
../include/boost/log/expressions/predicates/*.hpp
../include/boost/log/expressions/formatters/*.hpp
] ;
local sources_includes =
[ glob
../../../boost/log/sources/*.hpp
../include/boost/log/sources/*.hpp
] ;
local sinks_includes =
[ set.difference
# Document all these files...
[ glob
../../../boost/log/sinks/*.hpp
../include/boost/log/sinks/*.hpp
]
:
# ...except these
[ glob
../../../boost/log/sinks/nt6_event_log*.hpp
../include/boost/log/sinks/nt6_event_log*.hpp
]
] ;
local utility_includes =
[ glob
../../../boost/log/utility/*.hpp
../../../boost/log/utility/ipc/*.hpp
../../../boost/log/utility/setup/*.hpp
../../../boost/log/utility/type_dispatch/*.hpp
../../../boost/log/utility/functional/*.hpp
../../../boost/log/utility/manipulators/*.hpp
../include/boost/log/utility/*.hpp
../include/boost/log/utility/ipc/*.hpp
../include/boost/log/utility/setup/*.hpp
../include/boost/log/utility/type_dispatch/*.hpp
../include/boost/log/utility/functional/*.hpp
../include/boost/log/utility/manipulators/*.hpp
] ;
local support_includes =
[ glob
../../../boost/log/support/*.hpp
../include/boost/log/support/*.hpp
] ;

View File

@@ -29,7 +29,7 @@ rule check-message-compiler ( properties * )
{
if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
{
local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : message-compiler ] ;
local has_mc = [ configure.builds /boost/log/config/message-compiler//test-availability : $(properties) : message-compiler ] ;
if ! $(has_mc)
{
result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
@@ -89,6 +89,9 @@ project
<library>/boost/date_time//boost_date_time
<library>/boost/filesystem//boost_filesystem
<library>/boost/thread//boost_thread
<library>/boost/lambda//boost_lambda
<library>/boost/scope_exit//boost_scope_exit
<library>/boost/format//boost_format
<threading>multi
;

View File

@@ -29,7 +29,7 @@ rule check-message-compiler ( properties * )
{
if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
{
local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : message-compiler ] ;
local has_mc = [ configure.builds /boost/log/config/message-compiler//test-availability : $(properties) : message-compiler ] ;
if ! $(has_mc)
{
result += <build>no ;

View File

@@ -71,8 +71,8 @@ rule test_all
if ! [ os.environ BOOST_LOG_TEST_WITHOUT_SELF_CONTAINED_HEADER_TESTS ]
{
local headers_path = [ path.make $(BOOST_ROOT)/libs/log/include/boost/log ] ;
for file in [ path.glob-tree $(headers_path) : *.hpp : detail ]
local headers_path = ../include/boost/log ;
for file in [ glob-tree-ex $(headers_path) : *.hpp : detail ]
{
local rel_file = [ path.relative-to $(headers_path) $(file) ] ;
# Note: The test name starts with '~' in order to group these tests in the test report table, preferably at the end.