2 # Copyright Andrey Semashev 2007 - 2014.
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-architecture ;
18 local here = [ modules.binding $(__name__) ] ;
20 project.push-current [ project.current ] ;
21 project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ;
23 project.push-current [ project.current ] ;
24 project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ;
38 feature.feature log-api : generic winnt unix ;
40 rule check-instruction-set ( properties * )
43 local instruction_set = [ feature.get-values "log-instruction-set" : [ log-architecture.deduce-instruction-set $(properties) ] ] ;
45 if $(instruction_set) = i386 || $(instruction_set) = i486
47 if ! $(.annouced-failure)
49 ECHO Boost.Log is not supported on the specified target CPU and will not be built. At least i586 class CPU is required. ;
50 .annouced-failure = 1 ;
58 rule select-log-api ( properties * )
60 local result = <log-api>generic ;
62 local target_os = [ feature.get-values "target-os" : $(properties) ] ;
66 # We have to verify if message compiler is available
67 if ! ( <define>BOOST_LOG_WITHOUT_EVENT_LOG in $(properties) || <define>BOOST_LOG_WITHOUT_EVENT_LOG=1 in $(properties) )
69 local has_mc = [ configure.builds /boost/message-compiler//test-availability : $(properties) : message-compiler ] ;
72 result = <log-api>winnt ;
76 case linux : result = <log-api>unix ;
77 case *bsd : result = <log-api>unix ;
78 case darwin : result = <log-api>unix ;
79 case unix : result = <log-api>unix ;
80 case unixware : result = <log-api>unix ;
81 case cygwin : result = <log-api>unix ;
82 case hpux : result = <log-api>unix ;
83 case solaris : result = <log-api>unix ;
84 case qnx* : result = <log-api>unix ;
85 case sgi : result = <log-api>unix ;
86 case aix : result = <log-api>unix ;
88 case * : result = <log-api>generic ;
91 if ! <log-api>winnt in $(result)
93 result += <define>BOOST_LOG_WITHOUT_EVENT_LOG ;
95 if <log-api>unix in $(result)
97 result += <define>BOOST_LOG_USE_NATIVE_SYSLOG ;
103 rule select-regex-backend ( properties * )
107 # Use Boost.Regex backend by default. It produces smaller executables and also has the best performance for small string matching.
108 if ! ( <define>BOOST_LOG_WITHOUT_SETTINGS_PARSERS in $(properties) || <define>BOOST_LOG_WITHOUT_DEFAULT_FACTORIES in $(properties) || <define>BOOST_LOG_USE_STD_REGEX in $(properties) || <define>BOOST_LOG_USE_BOOST_XPRESSIVE in $(properties) )
110 result = <library>/boost/regex//boost_regex ;
117 : source-location ../src
119 <conditional>@select-log-api
120 <conditional>@check-instruction-set
121 <conditional>@select-regex-backend
122 <define>BOOST_SPIRIT_USE_PHOENIX_V3=1
123 <define>BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono
125 # Disable warnings about using 'insecure' standard C functions
126 <toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
127 <toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
128 <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
129 <toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
130 <toolset>intel-win:<define>_SCL_SECURE_NO_WARNINGS
131 <toolset>intel-win:<define>_SCL_SECURE_NO_DEPRECATE
132 <toolset>intel-win:<define>_CRT_SECURE_NO_WARNINGS
133 <toolset>intel-win:<define>_CRT_SECURE_NO_DEPRECATE
135 <toolset>msvc:<cxxflags>/bigobj
136 <toolset>msvc:<cxxflags>/wd4503 # decorated name length exceeded, name was truncated
137 <toolset>msvc:<cxxflags>/wd4456 # declaration of 'A' hides previous local declaration
138 <toolset>msvc:<cxxflags>/wd4459 # declaration of 'A' hides global declaration
140 # Disable Intel warnings:
141 # warning #177: function "X" was declared but never referenced
142 # warning #780: using-declaration ignored -- it refers to the current namespace
143 # warning #2196: routine is both "inline" and "noinline"
144 # remark #1782: #pragma once is obsolete. Use #ifndef guard instead.
145 # remark #193: zero used for undefined preprocessing identifier "X"
146 # remark #304: access control not specified ("public" by default)
147 # remark #981: operands are evaluated in unspecified order
148 # remark #1418: external function definition with no prior declaration
149 # Mostly comes from Boost.Phoenix: warning #411: class "X" defines no constructor to initialize the following: reference member "Y"...
150 # warning #734: "X" (declared at line N of "file.hpp"), required for copy that was eliminated, is inaccessible
151 # warning #279: controlling expression is constant
152 <toolset>intel-win:<cxxflags>"/Qwd177,780,2196,1782,193,304,981,1418,411,734,279"
153 <toolset>intel-linux:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
154 <toolset>intel-darwin:<cxxflags>"-wd177,780,2196,1782,193,304,981,1418,411,734,279"
156 <toolset>darwin:<cxxflags>-ftemplate-depth-1024
157 <toolset>clang:<cxxflags>-ftemplate-depth-1024
158 <toolset>gcc:<cxxflags>-ftemplate-depth-1024
160 <toolset>gcc:<cxxflags>-fno-strict-aliasing # avoids strict aliasing violations in other Boost components
161 <toolset>gcc,<target-os>windows:<linkflags>-Wl,--enable-auto-import
162 <toolset>gcc,<target-os>cygwin:<linkflags>-Wl,--enable-auto-import
164 <library>/boost/date_time//boost_date_time
165 <library>/boost/filesystem//boost_filesystem
166 <library>/boost/system//boost_system
167 <threading>single:<define>BOOST_LOG_NO_THREADS
168 <threading>multi:<library>/boost/thread//boost_thread
170 <target-os>windows:<library>ws2_32
171 <target-os>windows:<library>mswsock
173 <target-os>cygwin:<define>__USE_W32_SOCKETS
174 <target-os>cygwin:<library>ws2_32
175 <target-os>cygwin:<library>mswsock
177 <target-os>linux:<library>rt
178 <target-os>linux:<define>_XOPEN_SOURCE=600
179 <target-os>linux:<define>_GNU_SOURCE=1
181 <target-os>solaris:<define>_XOPEN_SOURCE=500
182 <target-os>solaris:<define>__EXTENSIONS__
183 <target-os>solaris:<library>socket
184 <target-os>solaris:<library>nsl
186 <target-os>hpux,<toolset>gcc:<define>_XOPEN_SOURCE_EXTENDED
187 <target-os>hpux:<library>ipv6
189 <target-os>freebsd:<library>rt
190 <target-os>qnxnto:<library>socket
191 <toolset>pgi:<library>rt
193 <toolset>clang:<cxxflags>-Wno-bind-to-temporary-copy
194 <toolset>clang:<cxxflags>-Wno-unused-function
197 local BOOST_LOG_COMMON_SRC =
200 attribute_value_set.cpp
205 global_logger_storage.cpp
212 default_attribute_names.cpp
214 text_ostream_backend.cpp
215 text_file_backend.cpp
216 text_multifile_backend.cpp
226 date_time_format_parser.cpp
227 named_scope_format_parser.cpp
228 unhandled_exception_count.cpp
232 local BOOST_LOG_COMMON_SSSE3_SRC =
236 local BOOST_LOG_COMMON_AVX2_SRC =
240 rule ssse3-targets-cond ( properties * )
242 local result = <build>no ;
244 if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
246 local has_ssse3 = [ configure.builds /boost/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ;
250 if <toolset>gcc in $(properties) || <toolset>clang in $(properties)
252 result = <cxxflags>"-march=core2 -msse -msse2 -msse3 -mssse3" ;
254 else if <toolset>intel in $(properties)
256 if <toolset-intel:platform>win in $(properties)
258 result = <cxxflags>"/QxSSSE3" ;
262 result = <cxxflags>"-march=core2" ;
265 else if <toolset>msvc in $(properties)
267 # MSVC doesn't really care about these switches, all SSE intrinsics are always available, but still...
268 # Also 64 bit MSVC doesn't have the /arch:SSE2 switch as it is the default.
269 if <log-address-model>32 in [ log-architecture.deduce-address-model $(properties) ]
271 result = <cxxflags>"/arch:SSE2" ;
277 # if ! <build>no in $(result)
279 # ECHO Boost.Log: Using SSSE3 optimized implementation ;
286 for local src in $(BOOST_LOG_COMMON_SSSE3_SRC)
292 <conditional>@ssse3-targets-cond
293 <link>shared:<define>BOOST_LOG_DLL
294 <define>BOOST_LOG_BUILDING_THE_LIB=1
295 : ## default-build ##
296 : ## usage-requirements ##
297 <define>BOOST_LOG_USE_SSSE3
302 rule avx2-targets-cond ( properties * )
304 local result = <build>no ;
306 if <log-architecture>x86 in [ log-architecture.deduce-architecture $(properties) ]
308 local has_ssse3 = [ configure.builds /boost/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ;
312 if <toolset>gcc in $(properties)
314 result = <cxxflags>"-march=core-avx2 -mavx -mavx2 -fabi-version=0" ;
316 else if <toolset>clang in $(properties)
318 result = <cxxflags>"-march=core-avx2 -mavx -mavx2" ;
320 else if <toolset>intel in $(properties)
322 if <toolset-intel:platform>win in $(properties)
324 result = <cxxflags>"/arch:CORE-AVX2" ;
328 result = <cxxflags>"-march=core-avx2 -fabi-version=0" ;
331 else if <toolset>msvc in $(properties)
333 result = <cxxflags>"/arch:AVX" ;
338 # if ! <build>no in $(result)
340 # ECHO Boost.Log: Using AVX2 optimized implementation ;
347 for local src in $(BOOST_LOG_COMMON_AVX2_SRC)
353 <conditional>@avx2-targets-cond
354 <link>shared:<define>BOOST_LOG_DLL
355 <define>BOOST_LOG_BUILDING_THE_LIB=1
356 : ## default-build ##
357 : ## usage-requirements ##
358 <define>BOOST_LOG_USE_AVX2
362 alias platform-specific-sources
364 debug_output_backend.cpp
370 alias platform-specific-sources ;
372 rule select-log-api-specific-sources ( properties * )
376 if <log-api>winnt in $(properties)
378 result = <source>simple_event_log.mc ;
379 result += <source>event_log_backend.cpp ;
380 result += <library>psapi ;
382 DEPENDS event_log_backend.cpp : simple_event_log.mc ;
390 $(BOOST_LOG_COMMON_SRC)
391 $(BOOST_LOG_COMMON_SSSE3_SRC)
392 $(BOOST_LOG_COMMON_AVX2_SRC)
393 platform-specific-sources
395 <conditional>@select-log-api-specific-sources
396 <link>shared:<define>BOOST_LOG_DLL
397 <define>BOOST_LOG_BUILDING_THE_LIB=1
398 : ## default-build ##
399 : ## usage-requirements ##
400 <link>shared:<define>BOOST_LOG_DYN_LINK=1
401 <threading>single:<define>BOOST_LOG_NO_THREADS
402 <log-api>generic:<define>BOOST_LOG_WITHOUT_EVENT_LOG
403 <log-api>unix:<define>BOOST_LOG_WITHOUT_EVENT_LOG
407 local BOOST_LOG_SETUP_COMMON_SRC =
410 init_from_settings.cpp
414 default_filter_factory.cpp
415 matches_relation_factory.cpp
416 default_formatter_factory.cpp
421 $(BOOST_LOG_SETUP_COMMON_SRC)
423 <link>shared:<define>BOOST_LOG_DYN_LINK=1
424 <link>shared:<define>BOOST_LOG_SETUP_DLL
425 <define>BOOST_LOG_SETUP_BUILDING_THE_LIB=1
427 : ## default-build ##
428 : ## usage-requirements ##
429 <link>shared:<define>BOOST_LOG_SETUP_DYN_LINK=1
430 <threading>single:<define>BOOST_LOG_NO_THREADS