# # Copyright Andrey Semashev 2007 - 2013. # 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 ; lib psapi ; lib ws2_32 ; 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) ; } project boost/log : source-location ../src : requirements @select-log-api @check-instruction-set BOOST_SPIRIT_USE_PHOENIX_V3=1 BOOST_THREAD_DONT_USE_CHRONO=1 # Don't introduce false dependency on Boost.Chrono msvc:_SCL_SECURE_NO_WARNINGS msvc:_SCL_SECURE_NO_DEPRECATE msvc:_CRT_SECURE_NO_WARNINGS msvc:_CRT_SECURE_NO_DEPRECATE msvc:/bigobj intel-win:_SCL_SECURE_NO_WARNINGS intel-win:_SCL_SECURE_NO_DEPRECATE intel-win:_CRT_SECURE_NO_WARNINGS intel-win:_CRT_SECURE_NO_DEPRECATE darwin:-ftemplate-depth-1024 gcc:-ftemplate-depth-1024 gcc:-fno-strict-aliasing # avoids strict aliasing violations in other Boost components gcc-mingw:-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 freebsd:"-lrt" linux:"-lrt -lpthread" pgi:"-lrt" : 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 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 -msse -msse2 -msse3 -mssse3" ; } } 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 = "/QxAVX2" ; } else { result = "-march=core-avx2 -mavx -mavx2 -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 ; 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 ;