# # Copyright Andrey Semashev 2007 - 2014. # 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 common ; import modules ; import os ; import path ; import project ; import feature ; import configure ; import log-architecture ; using mc ; local here = [ modules.binding $(__name__) ] ; project.push-current [ project.current ] ; project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ; project.pop-current ; project.push-current [ project.current ] ; project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ; project.pop-current ; # Windows libs lib psapi ; lib ws2_32 ; lib mswsock ; # UNIX libs lib rt ; lib socket ; lib nsl ; lib ipv6 ; feature.feature log-api : generic winnt unix ; rule check-instruction-set ( properties * ) { local result ; local instruction_set = [ feature.get-values "log-instruction-set" : [ log-architecture.deduce-instruction-set $(properties) ] ] ; if $(instruction_set) = i386 || $(instruction_set) = i486 { if ! $(.annouced-failure) { ECHO Boost.Log is not supported on the specified target CPU and will not be built. At least i586 class CPU is required. ; .annouced-failure = 1 ; } result = no ; } return $(result) ; } rule select-log-api ( properties * ) { local result = generic ; local target_os = [ feature.get-values "target-os" : $(properties) ] ; switch $(target_os) { case windows : # We have to verify if message compiler is available if ! ( BOOST_LOG_WITHOUT_EVENT_LOG in $(properties) || BOOST_LOG_WITHOUT_EVENT_LOG=1 in $(properties) ) { local has_mc = [ configure.builds /boost/message-compiler//test-availability : $(properties) : message-compiler ] ; if $(has_mc) { result = winnt ; } } case linux : result = unix ; case *bsd : result = unix ; case darwin : result = unix ; case unix : result = unix ; case unixware : result = unix ; case cygwin : result = unix ; case hpux : result = unix ; case solaris : result = unix ; case qnx* : result = unix ; case sgi : result = unix ; case aix : result = unix ; case * : result = generic ; } if ! winnt in $(result) { result += BOOST_LOG_WITHOUT_EVENT_LOG ; } if unix in $(result) { result += BOOST_LOG_USE_NATIVE_SYSLOG ; } return $(result) ; } rule select-regex-backend ( properties * ) { local result = ; # Use Boost.Regex backend by default. It produces smaller executables and also has the best performance for small string matching. if ! ( BOOST_LOG_WITHOUT_SETTINGS_PARSERS in $(properties) || BOOST_LOG_WITHOUT_DEFAULT_FACTORIES in $(properties) || BOOST_LOG_USE_STD_REGEX in $(properties) || BOOST_LOG_USE_BOOST_XPRESSIVE in $(properties) ) { result = /boost/regex//boost_regex ; } return $(result) ; } project boost/log : source-location ../src : requirements @select-log-api @check-instruction-set @select-regex-backend BOOST_SPIRIT_USE_PHOENIX_V3=1 BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono # Disable warnings about using 'insecure' standard C functions msvc:_SCL_SECURE_NO_WARNINGS msvc:_SCL_SECURE_NO_DEPRECATE msvc:_CRT_SECURE_NO_WARNINGS msvc:_CRT_SECURE_NO_DEPRECATE intel-win:_SCL_SECURE_NO_WARNINGS intel-win:_SCL_SECURE_NO_DEPRECATE intel-win:_CRT_SECURE_NO_WARNINGS intel-win:_CRT_SECURE_NO_DEPRECATE msvc:/bigobj msvc:/wd4503 # decorated name length exceeded, name was truncated msvc:/wd4456 # declaration of 'A' hides previous local declaration msvc:/wd4459 # declaration of 'A' hides global declaration # Disable Intel warnings: # warning #177: function "X" was declared but never referenced # warning #780: using-declaration ignored -- it refers to the current namespace # warning #2196: routine is both "inline" and "noinline" # remark #1782: #pragma once is obsolete. Use #ifndef guard instead. # remark #193: zero used for undefined preprocessing identifier "X" # remark #304: access control not specified ("public" by default) # remark #981: operands are evaluated in unspecified order # remark #1418: external function definition with no prior declaration # Mostly comes from Boost.Phoenix: warning #411: class "X" defines no constructor to initialize the following: reference member "Y"... # warning #734: "X" (declared at line N of "file.hpp"), required for copy that was eliminated, is inaccessible # warning #279: controlling expression is constant intel-win:"/Qwd177,780,2196,1782,193,304,981,1418,411,734,279" intel-linux:"-wd177,780,2196,1782,193,304,981,1418,411,734,279" intel-darwin:"-wd177,780,2196,1782,193,304,981,1418,411,734,279" darwin:-ftemplate-depth-1024 clang:-ftemplate-depth-1024 gcc:-ftemplate-depth-1024 gcc:-fno-strict-aliasing # avoids strict aliasing violations in other Boost components gcc,windows:-Wl,--enable-auto-import gcc,cygwin:-Wl,--enable-auto-import /boost/date_time//boost_date_time /boost/filesystem//boost_filesystem /boost/system//boost_system single:BOOST_LOG_NO_THREADS multi:/boost/thread//boost_thread windows:ws2_32 windows:mswsock cygwin:__USE_W32_SOCKETS cygwin:ws2_32 cygwin:mswsock linux:rt linux:_XOPEN_SOURCE=600 linux:_GNU_SOURCE=1 solaris:_XOPEN_SOURCE=500 solaris:__EXTENSIONS__ solaris:socket solaris:nsl hpux,gcc:_XOPEN_SOURCE_EXTENDED hpux:ipv6 freebsd:rt qnxnto:socket pgi:rt : usage-requirements clang:-Wno-bind-to-temporary-copy clang:-Wno-unused-function ; local BOOST_LOG_COMMON_SRC = attribute_name.cpp attribute_set.cpp attribute_value_set.cpp code_conversion.cpp core.cpp record_ostream.cpp severity_level.cpp global_logger_storage.cpp named_scope.cpp process_name.cpp process_id.cpp thread_id.cpp timer.cpp exceptions.cpp default_attribute_names.cpp default_sink.cpp text_ostream_backend.cpp text_file_backend.cpp text_multifile_backend.cpp syslog_backend.cpp thread_specific.cpp once_block.cpp timestamp.cpp threadsafe_queue.cpp event.cpp trivial.cpp spirit_encoding.cpp format_parser.cpp date_time_format_parser.cpp named_scope_format_parser.cpp unhandled_exception_count.cpp dump.cpp ; local BOOST_LOG_COMMON_SSSE3_SRC = dump_ssse3 ; local BOOST_LOG_COMMON_AVX2_SRC = dump_avx2 ; rule ssse3-targets-cond ( properties * ) { local result = no ; if x86 in [ log-architecture.deduce-architecture $(properties) ] { local has_ssse3 = [ configure.builds /boost/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ; if $(has_ssse3) { result = ; if gcc in $(properties) || clang in $(properties) { result = "-march=core2 -msse -msse2 -msse3 -mssse3" ; } else if intel in $(properties) { if win in $(properties) { result = "/QxSSSE3" ; } else { result = "-march=core2" ; } } else if msvc in $(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 [ log-architecture.deduce-address-model $(properties) ] { result = "/arch:SSE2" ; } } } } # if ! no in $(result) # { # ECHO Boost.Log: Using SSSE3 optimized implementation ; # } # ECHO $(result) ; return $(result) ; } for local src in $(BOOST_LOG_COMMON_SSSE3_SRC) { obj $(src) : ## sources ## $(src).cpp : ## requirements ## @ssse3-targets-cond shared:BOOST_LOG_DLL BOOST_LOG_BUILDING_THE_LIB=1 : ## default-build ## : ## usage-requirements ## BOOST_LOG_USE_SSSE3 ; } rule avx2-targets-cond ( properties * ) { local result = no ; if x86 in [ log-architecture.deduce-architecture $(properties) ] { local has_ssse3 = [ configure.builds /boost/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ; if $(has_ssse3) { result = ; if gcc in $(properties) { result = "-march=core-avx2 -mavx -mavx2 -fabi-version=0" ; } else if clang in $(properties) { result = "-march=core-avx2 -mavx -mavx2" ; } else if intel in $(properties) { if win in $(properties) { result = "/arch:CORE-AVX2" ; } else { result = "-march=core-avx2 -fabi-version=0" ; } } else if msvc in $(properties) { result = "/arch:AVX" ; } } } # if ! no in $(result) # { # ECHO Boost.Log: Using AVX2 optimized implementation ; # } # ECHO $(result) ; return $(result) ; } for local src in $(BOOST_LOG_COMMON_AVX2_SRC) { obj $(src) : ## sources ## $(src).cpp : ## requirements ## @avx2-targets-cond shared:BOOST_LOG_DLL BOOST_LOG_BUILDING_THE_LIB=1 : ## default-build ## : ## usage-requirements ## BOOST_LOG_USE_AVX2 ; } alias platform-specific-sources : ## sources ## debug_output_backend.cpp light_rw_mutex.cpp : ## requirements ## windows ; alias platform-specific-sources ; rule select-log-api-specific-sources ( properties * ) { local result ; if winnt in $(properties) { result = simple_event_log.mc ; result += event_log_backend.cpp ; result += psapi ; DEPENDS event_log_backend.cpp : simple_event_log.mc ; } return $(result) ; } lib boost_log : ## sources ## $(BOOST_LOG_COMMON_SRC) $(BOOST_LOG_COMMON_SSSE3_SRC) $(BOOST_LOG_COMMON_AVX2_SRC) platform-specific-sources : ## requirements ## @select-log-api-specific-sources shared:BOOST_LOG_DLL BOOST_LOG_BUILDING_THE_LIB=1 : ## default-build ## : ## usage-requirements ## shared:BOOST_LOG_DYN_LINK=1 single:BOOST_LOG_NO_THREADS generic:BOOST_LOG_WITHOUT_EVENT_LOG unix:BOOST_LOG_WITHOUT_EVENT_LOG ; local BOOST_LOG_SETUP_COMMON_SRC = parser_utils.cpp init_from_stream.cpp init_from_settings.cpp settings_parser.cpp filter_parser.cpp formatter_parser.cpp default_filter_factory.cpp matches_relation_factory.cpp default_formatter_factory.cpp ; lib boost_log_setup : ## sources ## $(BOOST_LOG_SETUP_COMMON_SRC) : ## requirements ## shared:BOOST_LOG_DYN_LINK=1 shared:BOOST_LOG_SETUP_DLL BOOST_LOG_SETUP_BUILDING_THE_LIB=1 boost_log : ## default-build ## : ## usage-requirements ## shared:BOOST_LOG_SETUP_DYN_LINK=1 single:BOOST_LOG_NO_THREADS ;