# # Copyright Andrey Semashev 2007 - 2016. # 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 ; import log-platform-config ; using mc ; local here = [ modules.binding $(__name__) ] ; project.push-current [ project.current ] ; project.load [ path.join [ path.make $(here:D) ] ../config/message-compiler ] ; project.load [ path.join [ path.make $(here:D) ] ../config/x86-ext ] ; project.load [ path.join [ path.make $(here:D) ] ../config/pthread-mutex-robust ] ; project.load [ path.join [ path.make $(here:D) ] ../config/native-syslog ] ; project.load [ path.join [ path.make $(here:D) ] ../config/atomic-int32 ] ; project.pop-current ; # Windows libs lib psapi ; lib advapi32 ; lib secur32 ; lib ws2_32 ; lib mswsock ; # UNIX libs lib rt ; lib socket ; lib nsl ; lib ipv6 ; rule has-config-flag ( flag : properties * ) { if ( "$(flag)" in $(properties) || "$(flag)=1" in $(properties) ) { return 1 ; } else { return ; } } 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-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 ! ( [ has-config-flag BOOST_LOG_WITHOUT_SETTINGS_PARSERS : $(properties) ] || [ has-config-flag BOOST_LOG_WITHOUT_DEFAULT_FACTORIES : $(properties) ] || [ has-config-flag BOOST_LOG_USE_STD_REGEX : $(properties) ] || [ has-config-flag BOOST_LOG_USE_BOOST_XPRESSIVE : $(properties) ] ) { result = /boost/regex//boost_regex ; } return $(result) ; } rule check-pthread-mutex-robust ( properties * ) { local result = ; local has_pthread_mutex_robust = [ configure.builds /boost/log/pthread-mutex-robust//pthread_mutex_robust : $(properties) : pthread-supports-robust-mutexes ] ; if $(has_pthread_mutex_robust) { result = BOOST_LOG_HAS_PTHREAD_MUTEX_ROBUST ; } return $(result) ; } rule check-atomic-int32 ( properties * ) { local result = ; local has_atomic_int32 = [ configure.builds /boost/log/atomic-int32//atomic_int32 : $(properties) : native-atomic-int32-supported ] ; if ! $(has_atomic_int32) { result = BOOST_LOG_WITHOUT_IPC ; } return $(result) ; } rule check-native-syslog ( properties * ) { local result = ; if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ] { local has_native_syslog = [ configure.builds /boost/log/native-syslog//native_syslog : $(properties) : native-syslog-supported ] ; if $(has_native_syslog) { result = BOOST_LOG_USE_NATIVE_SYSLOG ; } } return $(result) ; } rule check-message-compiler ( properties * ) { local result ; if windows in $(properties) { if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ] { local has_mc = [ configure.builds /boost/log/message-compiler//test-availability : $(properties) : message-compiler ] ; if ! $(has_mc) { result = BOOST_LOG_WITHOUT_EVENT_LOG ; } } else { # This branch is needed to fix building with MinGW result = BOOST_LOG_WITHOUT_EVENT_LOG ; } } else { result = BOOST_LOG_WITHOUT_EVENT_LOG ; } return $(result) ; } project boost/log : source-location ../src : requirements @check-instruction-set @check-atomic-int32 @select-regex-backend @check-pthread-mutex-robust @check-native-syslog @check-message-compiler @log-platform-config.set-platform-defines ../src __STDC_CONSTANT_MACROS # Use system-defined macros for integer constants, if possible 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 msvc:/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 # 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 single:BOOST_LOG_NO_THREADS multi:/boost/atomic//boost_atomic multi:/boost/thread//boost_thread windows:ws2_32 windows:mswsock windows:advapi32 cygwin:ws2_32 cygwin:mswsock cygwin:advapi32 # Boost.Interprocess does not compile on Cygwin: https://github.com/boostorg/interprocess/issues/76 cygwin:BOOST_LOG_WITHOUT_IPC linux:rt solaris:socket solaris:nsl 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 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 permissions.cpp dump.cpp ; BOOST_LOG_COMMON_SSSE3_SRC = dump_ssse3 ; 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/log/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ; if $(has_ssse3) { result = ; if gcc in $(properties) || clang in $(properties) { result = "-msse -msse2 -msse3 -mssse3" ; } else if intel in $(properties) { if win in $(properties) { result = "/QxSSSE3" ; } else { result = "-xSSSE3" ; } } 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 ; explicit $(src) ; } rule avx2-targets-cond ( properties * ) { local result = no ; if x86 in [ log-architecture.deduce-architecture $(properties) ] { local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ; if $(has_avx2) { result = ; if gcc in $(properties) { result = "-mavx -mavx2 -fabi-version=0" ; } else if clang in $(properties) { result = "-mavx -mavx2" ; } else if intel in $(properties) { if win in $(properties) { result = "/arch:CORE-AVX2" ; } else { result = "-xCORE-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 ; explicit $(src) ; } rule select-arch-specific-sources ( properties * ) { local result ; if x86 in [ log-architecture.deduce-architecture $(properties) ] { local has_ssse3 = [ configure.builds /boost/log/x86-extensions//ssse3 : $(properties) : compiler-supports-ssse3 ] ; if $(has_ssse3) { result += BOOST_LOG_USE_SSSE3 ; result += $(BOOST_LOG_COMMON_SSSE3_SRC) ; } local has_avx2 = [ configure.builds /boost/log/x86-extensions//avx2 : $(properties) : compiler-supports-avx2 ] ; if $(has_avx2) { result += BOOST_LOG_USE_AVX2 ; result += $(BOOST_LOG_COMMON_AVX2_SRC) ; } } # ECHO Arch sources: $(result) ; return $(result) ; } rule select-platform-specific-sources ( properties * ) { local result ; if windows in $(properties) { result += windows/light_rw_mutex.cpp ; if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ] { result += windows/object_name.cpp ; result += windows/mapped_shared_memory.cpp ; result += windows/ipc_sync_wrappers.cpp ; result += windows/ipc_reliable_message_queue.cpp ; result += secur32 ; } if ! [ has-config-flag BOOST_LOG_WITHOUT_DEBUG_OUTPUT : $(properties) ] { result += windows/debug_output_backend.cpp ; } if ! [ has-config-flag BOOST_LOG_WITHOUT_EVENT_LOG : $(properties) ] { result += windows/simple_event_log.mc ; result += windows/event_log_backend.cpp ; result += psapi ; DEPENDS windows/event_log_backend.cpp : windows/simple_event_log.mc ; } } else { result += BOOST_LOG_WITHOUT_EVENT_LOG ; result += BOOST_LOG_WITHOUT_DEBUG_OUTPUT ; if ! [ has-config-flag BOOST_LOG_WITHOUT_IPC : $(properties) ] { result += posix/object_name.cpp ; result += posix/ipc_reliable_message_queue.cpp ; } } if ! [ has-config-flag BOOST_LOG_WITHOUT_SYSLOG : $(properties) ] { result += syslog_backend.cpp ; } # ECHO Platform sources: $(result) ; return $(result) ; } lib boost_log : ## sources ## $(BOOST_LOG_COMMON_SRC) : ## requirements ## @select-arch-specific-sources @select-platform-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 ; 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 ## setup/$(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 ; boost-install boost_log boost_log_setup ;