2 # Copyright Andrey Semashev 2007 - 2020.
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt or copy at
5 # http://www.boost.org/LICENSE_1_0.txt)
15 import log-arch-config ;
16 import log-platform-config ;
19 local here = [ modules.binding $(__name__) ] ;
21 project.push-current [ project.current ] ;
22 project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ;
23 project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ;
24 project.load [ path.join [ path.make $(here:D) ] ../config/pthread-mutex-robust ] ;
25 project.load [ path.join [ path.make $(here:D) ] ../config/native-syslog ] ;
26 project.load [ path.join [ path.make $(here:D) ] ../config/atomic-int32 ] ;
35 explicit psapi advapi32 secur32 ws2_32 mswsock ;
42 explicit rt socket nsl ipv6 ;
44 rule has-config-flag ( flag : properties * )
46 if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) )
56 rule check-instruction-set ( properties * )
59 local instruction_set = [ log-arch-config.deduce-instruction-set $(properties) ] ;
61 if $(instruction_set) = i386 || $(instruction_set) = i486
63 if ! $(.annouced-failure)
65 ECHO Boost.Log is not supported on the specified target CPU and will not be built. At least i586 class CPU is required. ;
66 .annouced-failure = 1 ;
74 rule select-regex-backend ( properties * )
78 # Use Boost.Regex backend by default. It produces smaller executables and also has the best performance for small string matching.
80 [ has-config-flag BOOST_LOG_WITHOUT_SETTINGS_PARSERS : $(properties) ] ||
81 [ has-config-flag BOOST_LOG_WITHOUT_DEFAULT_FACTORIES : $(properties) ] ||
82 [ has-config-flag BOOST_LOG_USE_STD_REGEX : $(properties) ] ||
83 [ has-config-flag BOOST_LOG_USE_BOOST_XPRESSIVE : $(properties) ] )
85 result = <library>/boost/regex//boost_regex ;
91 rule check-pthread-mutex-robust ( properties * )
95 local has_pthread_mutex_robust = [ configure.builds /boost/log/pthread-mutex-robust//pthread_mutex_robust : $(properties) : "pthread supports robust mutexes" ] ;
96 if $(has_pthread_mutex_robust)
98 result = <define>BOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST ;
104 rule check-atomic-int32 ( properties * )
108 local has_atomic_int32 = [ configure.builds /boost/log/atomic-int32//atomic_int32 : $(properties) : "native atomic int32 supported" ] ;
109 if ! $(has_atomic_int32)
111 result = <define>BOOST_LOG_WITHOUT_IPC ;
117 rule check-native-syslog ( properties * )
121 if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ]
123 local has_native_syslog = [ configure.builds /boost/log/native-syslog//native_syslog : $(properties) : "native syslog supported" ] ;
124 if $(has_native_syslog)
126 result = <define>BOOST_LOG_USE_NATIVE_SYSLOG ;
133 rule check-message-compiler ( properties * )
137 if <target-os>windows in $(properties)
139 if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
141 local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : "has message compiler" ] ;
144 result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
149 # This branch is needed to fix building with MinGW
150 result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
155 result = <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
162 : source-location ../src
164 <conditional>@check-instruction-set
165 <conditional>@check-atomic-int32
166 <conditional>@select-regex-backend
167 <conditional>@check-pthread-mutex-robust
168 <conditional>@check-native-syslog
169 <conditional>@check-message-compiler
170 <conditional>@log-platform-config.set-platform-defines
174 <define>__STDC_CONSTANT_MACROS # Use system-defined macros for integer constants, if possible
175 <define>BOOST_SPIRIT_USE_PHOENIX_V3=1
176 <define>BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono
178 <c++-template-depth>1024
180 <toolset>msvc:<cxxflags>/bigobj
181 <toolset>msvc:<cxxflags>/wd4503 # decorated name length exceeded, name was truncated
182 <toolset>msvc:<cxxflags>/wd4456 # declaration of 'A' hides previous local declaration
183 <toolset>msvc:<cxxflags>/wd4459 # declaration of 'A' hides global declaration
184 <toolset>msvc:<cxxflags>/wd4003 # not enough actual parameters for macro 'X' - caused by BOOST_PP_IS_EMPTY and BOOST_PP_IS_BEGIN_PARENS which are used by Fusion
186 # Disable Intel warnings:
187 # warning #177: function "X" was declared but never referenced
188 # warning #780: using-declaration ignored -- it refers to the current namespace
189 # warning #2196: routine is both "inline" and "noinline"
190 # remark #1782: #pragma once is obsolete. Use #ifndef guard instead.
191 # remark #193: zero used for undefined preprocessing identifier "X"
192 # remark #304: access control not specified ("public" by default)
193 # remark #981: operands are evaluated in unspecified order
194 # remark #1418: external function definition with no prior declaration
195 # Mostly comes from Boost.Phoenix: warning #411: class "X" defines no constructor to initialize the following: reference member "Y"...
196 # warning #734: "X" (declared at line N of "file.hpp"), required for copy that was eliminated, is inaccessible
197 # warning #279: controlling expression is constant
198 <toolset>intel-win:<cxxflags>"/Qwd177,780,2196,1782,193,304,981,1418,411,734,279"
199 <toolset>intel-linux:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
200 <toolset>intel-darwin:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
202 <toolset>gcc:<cxxflags>-fno-strict-aliasing # avoids strict aliasing violations in other Boost components
203 <toolset>gcc,<target-os>windows:<linkflags>-Wl,--enable-auto-import
204 <toolset>gcc,<target-os>cygwin:<linkflags>-Wl,--enable-auto-import
206 <library>/boost/filesystem//boost_filesystem
207 <threading>single:<define>BOOST_LOG_NO_THREADS
208 <threading>multi:<library>/boost/atomic//boost_atomic
209 <threading>multi:<library>/boost/thread//boost_thread
211 <target-os>windows:<library>ws2_32
212 <target-os>windows:<library>mswsock
213 <target-os>windows:<library>advapi32
215 <target-os>cygwin:<library>ws2_32
216 <target-os>cygwin:<library>mswsock
217 <target-os>cygwin:<library>advapi32
218 # Boost.Interprocess does not compile on Cygwin: https://github.com/boostorg/interprocess/issues/76
219 <target-os>cygwin:<define>BOOST_LOG_WITHOUT_IPC
221 <target-os>linux:<library>rt
223 <target-os>solaris:<library>socket
224 <target-os>solaris:<library>nsl
226 <target-os>hpux:<library>ipv6
228 <target-os>freebsd:<library>rt
229 <target-os>qnxnto:<library>socket
230 <toolset>pgi:<library>rt
232 <toolset>clang:<cxxflags>-Wno-bind-to-temporary-copy
233 <toolset>clang:<cxxflags>-Wno-unused-function
236 local BOOST_LOG_COMMON_SRC =
239 attribute_value_set.cpp
244 global_logger_storage.cpp
251 default_attribute_names.cpp
253 text_ostream_backend.cpp
254 text_file_backend.cpp
255 text_multifile_backend.cpp
264 date_time_format_parser.cpp
265 named_scope_format_parser.cpp
270 BOOST_LOG_COMMON_SSSE3_SRC =
274 BOOST_LOG_COMMON_AVX2_SRC =
278 for local src in $(BOOST_LOG_COMMON_SSSE3_SRC)
284 <conditional>@log-arch-config.ssse3-flags
285 <link>shared:<define>BOOST_LOG_DLL
286 <define>BOOST_LOG_BUILDING_THE_LIB=1
287 : ## default-build ##
288 : ## usage-requirements ##
289 <define>BOOST_LOG_USE_SSSE3
295 for local src in $(BOOST_LOG_COMMON_AVX2_SRC)
301 <conditional>@log-arch-config.avx2-flags
302 <link>shared:<define>BOOST_LOG_DLL
303 <define>BOOST_LOG_BUILDING_THE_LIB=1
304 : ## default-build ##
305 : ## usage-requirements ##
306 <define>BOOST_LOG_USE_AVX2
312 rule select-arch-specific-sources ( properties * )
316 if x86 in [ log-arch-config.deduce-architecture $(properties) ]
318 local has_ssse3 = [ configure.builds /boost/log/x86-extensions//ssse3 : $(properties) : "compiler supports SSSE3" ] ;
321 result += <define>BOOST_LOG_USE_SSSE3 ;
322 result += <source>$(BOOST_LOG_COMMON_SSSE3_SRC) ;
325 local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : "compiler supports AVX2" ] ;
328 result += <define>BOOST_LOG_USE_AVX2 ;
329 result += <source>$(BOOST_LOG_COMMON_AVX2_SRC) ;
333 # ECHO Arch sources: $(result) ;
338 rule select-platform-specific-sources ( properties * )
342 if <target-os>windows in $(properties)
344 result += <source>windows/light_rw_mutex.cpp ;
346 if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ]
348 result += <source>windows/object_name.cpp ;
349 result += <source>windows/mapped_shared_memory.cpp ;
350 result += <source>windows/ipc_sync_wrappers.cpp ;
351 result += <source>windows/ipc_reliable_message_queue.cpp ;
352 result += <library>secur32 ;
355 if ! [ has-config-flag BOOST_LOG_WITHOUT_DEBUG_OUTPUT : $(properties) ]
357 result += <source>windows/debug_output_backend.cpp ;
360 if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
362 result += <source>windows/simple_event_log.mc ;
363 result += <source>windows/event_log_backend.cpp ;
364 result += <library>psapi ;
366 DEPENDS windows/event_log_backend.cpp : windows/simple_event_log.mc ;
371 result += <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
372 result += <define>BOOST_LOG_WITHOUT_DEBUG_OUTPUT ;
374 if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ]
376 result += <source>posix/object_name.cpp ;
377 result += <source>posix/ipc_reliable_message_queue.cpp ;
381 if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ]
383 result += <source>syslog_backend.cpp ;
386 # ECHO Platform sources: $(result) ;
393 $(BOOST_LOG_COMMON_SRC)
395 <conditional>@select-arch-specific-sources
396 <conditional>@select-platform-specific-sources
397 <link>shared:<define>BOOST_LOG_DLL
398 <define>BOOST_LOG_BUILDING_THE_LIB=1
399 : ## default-build ##
400 : ## usage-requirements ##
401 <link>shared:<define>BOOST_LOG_DYN_LINK=1
402 <threading>single:<define>BOOST_LOG_NO_THREADS
406 local BOOST_LOG_SETUP_COMMON_SRC =
409 init_from_settings.cpp
413 default_filter_factory.cpp
414 matches_relation_factory.cpp
415 default_formatter_factory.cpp
420 setup/$(BOOST_LOG_SETUP_COMMON_SRC)
422 <link>shared:<define>BOOST_LOG_DYN_LINK=1
423 <link>shared:<define>BOOST_LOG_SETUP_DLL
424 <define>BOOST_LOG_SETUP_BUILDING_THE_LIB=1
426 : ## default-build ##
427 : ## usage-requirements ##
428 <link>shared:<define>BOOST_LOG_SETUP_DYN_LINK=1
429 <threading>single:<define>BOOST_LOG_NO_THREADS
432 boost-install boost_log boost_log_setup ;