# Copyright (c) 2018 Arvid Norberg (arvid@libtorrent.org) # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE_1_0.txt or # http://www.boost.org/LICENSE_1_0.txt) import common ; import toolset ; import feature ; feature.extend toolset : clang_tidy ; generators.register-c-compiler clang_tidy.compile.c++ : CPP : OBJ : clang_tidy ; generators.register-c-compiler clang_tidy.compile.c : C : OBJ : clang_tidy ; generators.register-archiver clang_tidy.archive : OBJ : STATIC_LIB : clang_tidy ; generators.register-linker clang_tidy.link : OBJ SEARCHED_LIB STATIC_LIB : EXE : clang_tidy ; generators.register-linker clang_tidy.link.dll : OBJ SEARCHED_LIB STATIC_LIB : SHARED_LIB : clang_tidy ; rule init ( version ? : command * : options * ) { command = [ common.get-invocation-command clang_tidy : clang-tidy : $(command) ] ; # Determine the version if $(command) { local command-string = \"$(command)\" ; command-string = $(command-string:J=" ") ; version ?= [ MATCH "version ([0-9.]+)" : [ SHELL "$(command-string) --version" ] ] ; } local condition = [ common.check-init-parameters clang_tidy : version $(version) ] ; common.handle-options clang_tidy : $(condition) : $(command) : $(options) ; } ############################################################################### # Flags toolset.flags clang_tidy.compile OPTIONS ; toolset.flags clang_tidy.compile.c++ OPTIONS ; toolset.flags clang_tidy.compile DEFINES ; toolset.flags clang_tidy.compile INCLUDES ; toolset.flags clang_tidy.compile OPTIONS off : ; toolset.flags clang_tidy.compile OPTIONS speed : -O3 ; toolset.flags clang_tidy.compile OPTIONS space : -Os ; toolset.flags clang_tidy.compile OPTIONS off : -fno-inline ; # For clang, 'on' and 'full' are identical. toolset.flags clang_tidy.compile OPTIONS on : -Wno-inline ; toolset.flags clang_tidy.compile OPTIONS full : -Wno-inline ; toolset.flags clang_tidy.compile OPTIONS off : -w ; toolset.flags clang_tidy.compile OPTIONS on : -Wall ; toolset.flags clang_tidy.compile OPTIONS all : -Wall -pedantic ; toolset.flags clang_tidy.compile OPTIONS on : -Werror ; toolset.flags clang_tidy.compile OPTIONS on : -g ; toolset.flags clang_tidy.compile OPTIONS on : -pg ; toolset.flags clang_tidy.compile OPTIONS off : -fno-rtti ; ############################################################################### # C and C++ compilation TOUCH = [ common.file-creation-command ] ; actions compile.c++ { "$(CONFIG_COMMAND)" -quiet -header-filter=* -warnings-as-errors=* "$(>)" -- -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" \ && $(TOUCH) "$(<)" } actions compile.c { "$(CONFIG_COMMAND)" -quiet -header-filter=* -warnings-as-errors=* "$(>)" -- -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" \ && $(TOUCH) "$(<)" } ############################################################################### # Linking actions archive { $(TOUCH) "$(<)" } actions link { $(TOUCH) "$(<)" } actions link.dll { $(TOUCH) "$(<)" }