forked from arvidn/libtorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clang_tidy.jam
105 lines (81 loc) · 3.89 KB
/
clang_tidy.jam
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright (c) 2018 Arvid Norberg ([email protected])
#
# 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 : <toolset>clang_tidy ;
generators.register-c-compiler clang_tidy.compile.c : C : OBJ : <toolset>clang_tidy ;
generators.register-archiver clang_tidy.archive : OBJ : STATIC_LIB : <toolset>clang_tidy ;
generators.register-linker clang_tidy.link : OBJ SEARCHED_LIB STATIC_LIB : EXE : <toolset>clang_tidy ;
generators.register-linker clang_tidy.link.dll : OBJ SEARCHED_LIB STATIC_LIB : SHARED_LIB : <toolset>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 <cflags> ;
toolset.flags clang_tidy.compile.c++ OPTIONS <cxxflags> ;
toolset.flags clang_tidy.compile DEFINES <define> ;
toolset.flags clang_tidy.compile INCLUDES <include> ;
toolset.flags clang_tidy.compile OPTIONS <optimization>off : ;
toolset.flags clang_tidy.compile OPTIONS <optimization>speed : -O3 ;
toolset.flags clang_tidy.compile OPTIONS <optimization>space : -Os ;
toolset.flags clang_tidy.compile OPTIONS <inlining>off : -fno-inline ;
# For clang, 'on' and 'full' are identical.
toolset.flags clang_tidy.compile OPTIONS <inlining>on : -Wno-inline ;
toolset.flags clang_tidy.compile OPTIONS <inlining>full : -Wno-inline ;
toolset.flags clang_tidy.compile OPTIONS <warnings>off : -w ;
toolset.flags clang_tidy.compile OPTIONS <warnings>on : -Wall ;
toolset.flags clang_tidy.compile OPTIONS <warnings>all : -Wall -pedantic ;
toolset.flags clang_tidy.compile OPTIONS <warnings-as-errors>on : -Werror ;
toolset.flags clang_tidy.compile OPTIONS <debug-symbols>on : -g ;
toolset.flags clang_tidy.compile OPTIONS <profiling>on : -pg ;
toolset.flags clang_tidy.compile OPTIONS <rtti>off : -fno-rtti ;
local rule cxxstd-flags ( toolset : condition * : options * )
{
toolset.flags $(toolset).compile.c++ OPTIONS $(condition) : $(options) : unchecked ;
toolset.flags $(toolset).link OPTIONS $(condition) : $(options) : unchecked ;
}
cxxstd-flags clang_tidy : <cxxstd>11/<cxxstd-dialect>iso : -std=c++11 ;
cxxstd-flags clang_tidy : <cxxstd>11/<cxxstd-dialect>gnu : -std=gnu++11 ;
cxxstd-flags clang_tidy : <cxxstd>14/<cxxstd-dialect>iso : -std=c++14 ;
cxxstd-flags clang_tidy : <cxxstd>14/<cxxstd-dialect>gnu : -std=gnu++14 ;
cxxstd-flags clang_tidy : <cxxstd>17/<cxxstd-dialect>iso : -std=c++17 ;
cxxstd-flags clang_tidy : <cxxstd>17/<cxxstd-dialect>gnu : -std=gnu++17 ;
###############################################################################
# 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) "$(<)"
}