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:<define>BOOST_USE_WINDOWS_H
212 <target-os>windows:<library>ws2_32
213 <target-os>windows:<library>mswsock
214 <target-os>windows:<library>advapi32
216 <target-os>cygwin:<define>BOOST_USE_WINDOWS_H
217 # Boost.Interprocess does not compile on Cygwin: https://github.com/boostorg/interprocess/issues/76
218 <target-os>cygwin:<define>BOOST_LOG_WITHOUT_IPC
219 <target-os>cygwin:<library>ws2_32
220 <target-os>cygwin:<library>mswsock
221 <target-os>cygwin:<library>advapi32
223 <target-os>linux:<library>rt
225 <target-os>solaris:<library>socket
226 <target-os>solaris:<library>nsl
228 <target-os>hpux:<library>ipv6
230 <target-os>freebsd:<library>rt
231 <target-os>qnxnto:<library>socket
232 <toolset>pgi:<library>rt
234 <toolset>clang:<cxxflags>-Wno-bind-to-temporary-copy
235 <toolset>clang:<cxxflags>-Wno-unused-function
238 local BOOST_LOG_COMMON_SRC =
241 attribute_value_set.cpp
246 global_logger_storage.cpp
253 default_attribute_names.cpp
255 text_ostream_backend.cpp
256 text_file_backend.cpp
257 text_multifile_backend.cpp
266 date_time_format_parser.cpp
267 named_scope_format_parser.cpp
272 BOOST_LOG_COMMON_SSSE3_SRC =
276 BOOST_LOG_COMMON_AVX2_SRC =
280 for local src in $(BOOST_LOG_COMMON_SSSE3_SRC)
286 <conditional>@log-arch-config.ssse3-flags
287 <link>shared:<define>BOOST_LOG_DLL
288 <define>BOOST_LOG_BUILDING_THE_LIB=1
289 : ## default-build ##
290 : ## usage-requirements ##
291 <define>BOOST_LOG_USE_SSSE3
297 for local src in $(BOOST_LOG_COMMON_AVX2_SRC)
303 <conditional>@log-arch-config.avx2-flags
304 <link>shared:<define>BOOST_LOG_DLL
305 <define>BOOST_LOG_BUILDING_THE_LIB=1
306 : ## default-build ##
307 : ## usage-requirements ##
308 <define>BOOST_LOG_USE_AVX2
314 rule select-arch-specific-sources ( properties * )
318 if x86 in [ log-arch-config.deduce-architecture $(properties) ]
320 local has_ssse3 = [ configure.builds /boost/log/x86-extensions//ssse3 : $(properties) : "compiler supports SSSE3" ] ;
323 result += <define>BOOST_LOG_USE_SSSE3 ;
324 result += <source>$(BOOST_LOG_COMMON_SSSE3_SRC) ;
327 local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : "compiler supports AVX2" ] ;
330 result += <define>BOOST_LOG_USE_AVX2 ;
331 result += <source>$(BOOST_LOG_COMMON_AVX2_SRC) ;
335 # ECHO Arch sources: $(result) ;
340 rule select-platform-specific-sources ( properties * )
344 if <target-os>windows in $(properties)
346 result += <source>windows/light_rw_mutex.cpp ;
347 result += <source>windows/is_debugger_present.cpp ;
349 if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ]
351 result += <source>windows/object_name.cpp ;
352 result += <source>windows/mapped_shared_memory.cpp ;
353 result += <source>windows/ipc_sync_wrappers.cpp ;
354 result += <source>windows/ipc_reliable_message_queue.cpp ;
355 result += <library>secur32 ;
358 if ! [ has-config-flag BOOST_LOG_WITHOUT_DEBUG_OUTPUT : $(properties) ]
360 result += <source>windows/debug_output_backend.cpp ;
363 if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ]
365 result += <source>windows/simple_event_log.mc ;
366 result += <source>windows/event_log_backend.cpp ;
367 result += <library>psapi ;
369 DEPENDS windows/event_log_backend.cpp : windows/simple_event_log.mc ;
374 result += <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
375 result += <define>BOOST_LOG_WITHOUT_DEBUG_OUTPUT ;
377 if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ]
379 result += <source>posix/object_name.cpp ;
380 result += <source>posix/ipc_reliable_message_queue.cpp ;
384 if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ]
386 result += <source>syslog_backend.cpp ;
389 # ECHO Platform sources: $(result) ;
396 $(BOOST_LOG_COMMON_SRC)
398 <conditional>@select-arch-specific-sources
399 <conditional>@select-platform-specific-sources
400 <link>shared:<define>BOOST_LOG_DLL
401 <define>BOOST_LOG_BUILDING_THE_LIB=1
402 : ## default-build ##
403 : ## usage-requirements ##
404 <link>shared:<define>BOOST_LOG_DYN_LINK=1
405 <threading>single:<define>BOOST_LOG_NO_THREADS
409 local BOOST_LOG_SETUP_COMMON_SRC =
412 init_from_settings.cpp
416 default_filter_factory.cpp
417 matches_relation_factory.cpp
418 default_formatter_factory.cpp
423 setup/$(BOOST_LOG_SETUP_COMMON_SRC)
425 <link>shared:<define>BOOST_LOG_DYN_LINK=1
426 <link>shared:<define>BOOST_LOG_SETUP_DLL
427 <define>BOOST_LOG_SETUP_BUILDING_THE_LIB=1
429 : ## default-build ##
430 : ## usage-requirements ##
431 <link>shared:<define>BOOST_LOG_SETUP_DYN_LINK=1
432 <threading>single:<define>BOOST_LOG_NO_THREADS
435 boost-install boost_log boost_log_setup ;