Skip to content

Commit 2da87ab

Browse files
committed
Add feature for each library
Signed-off-by: Uilian Ries <[email protected]>
1 parent 22982db commit 2da87ab

File tree

2 files changed

+52
-20
lines changed

2 files changed

+52
-20
lines changed

boost-stacktrace-features.jam

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@
66
#
77
import feature ;
88

9+
feature.feature boost.stacktrace.noop : on off : optional propagated ;
10+
feature.feature boost.stacktrace.backtrace : on off : optional propagated ;
11+
feature.feature boost.stacktrace.addr2line : on off : optional propagated ;
12+
feature.feature boost.stacktrace.basic : on off : optional propagated ;
13+
feature.feature boost.stacktrace.windbg : on off : optional propagated ;
14+
feature.feature boost.stacktrace.windbg_cached : on off : optional propagated ;
915
feature.feature boost.stacktrace.from_exception : on off : optional propagated ;

build/Jamfile.v2

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import boost-stacktrace-features ;
1111
import config : requires ;
1212
import property ;
1313

14+
constant stacktrace_common_requirements :
15+
<warnings>all
16+
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
17+
<define>BOOST_STACKTRACE_NO_LIB=1
18+
;
19+
1420
constant boost_dependencies_private :
1521
<library>/boost/assert//boost_assert
1622
;
@@ -63,87 +69,108 @@ explicit WinDbg ;
6369
mp-run-simple has_windbg_cached.cpp : : : <library>Dbgeng <library>ole32 : WinDbgCached ;
6470
explicit WinDbgCached ;
6571

72+
rule build-stacktrace-feature ( name : props * )
73+
{
74+
local enabled = [ property.select <boost.stacktrace.$(name)> : $(props) ] ;
75+
switch $(enabled:G=)
76+
{
77+
case "on" : return ;
78+
case "off" : return <build>no ;
79+
}
80+
}
81+
6682
lib boost_stacktrace_noop
6783
: # sources
6884
../src/noop.cpp
6985
: # requirements
70-
<warnings>all
71-
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
86+
$(stacktrace_common_requirements)
87+
# Enable build when explicitly requested
88+
<conditional>@$(build-stacktrace-feature noop)
7289
: # default build
7390
: # usage-requirements
7491
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
75-
<define>BOOST_STACKTRACE_NO_LIB=1
7692
;
7793

7894
lib boost_stacktrace_backtrace
7995
: # sources
8096
../src/backtrace.cpp
8197
: # requirements
82-
<warnings>all
98+
$(stacktrace_common_requirements)
8399
<target-os>linux:<library>dl
84100
<library>backtrace
85-
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
86101
[ check-target-builds libbacktrace : : <build>no ]
102+
<conditional>@$(build-stacktrace-feature backtrace)
87103
: # default build
88104
: # usage-requirements
89105
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
90-
<define>BOOST_STACKTRACE_NO_LIB=1
91106
;
92107

108+
rule build-stacktrace-addr2line ( props * )
109+
{
110+
local enabled = [ property.select <boost.stacktrace.addr2line> : $(props) ] ;
111+
switch $(enabled:G=)
112+
{
113+
case "on" : return ;
114+
case "off" : return <build>no ;
115+
}
116+
117+
# Disable by default on Windows when not using Cygwin
118+
if <target-os>windows in $(props) && ! ( <target-os>cygwin in $(props) )
119+
{
120+
return <build>no ;
121+
}
122+
}
123+
93124
lib boost_stacktrace_addr2line
94125
: # sources
95126
../src/addr2line.cpp
96127
: # requirements
97-
<warnings>all
128+
$(stacktrace_common_requirements)
98129
<target-os>linux:<library>dl
99-
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
100130
[ check-target-builds addr2line : : <build>no ]
131+
<conditional>@build-stacktrace-addr2line
101132
: # default build
102133
: # usage-requirements
103134
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
104-
<define>BOOST_STACKTRACE_NO_LIB=1
105135
;
106136

107137
lib boost_stacktrace_basic
108138
: # sources
109139
../src/basic.cpp
110140
: # requirements
111-
<warnings>all
141+
$(stacktrace_common_requirements)
112142
<target-os>linux:<library>dl
113-
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
114143
[ check-target-builds WinDbg : <build>no ]
144+
<conditional>@$(build-stacktrace-feature basic)
115145
: # default build
116146
: # usage-requirements
117147
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
118-
<define>BOOST_STACKTRACE_NO_LIB=1
119148
;
120149

121150
lib boost_stacktrace_windbg
122151
: # sources
123152
../src/windbg.cpp
124153
: # requirements
125-
<warnings>all
154+
$(stacktrace_common_requirements)
126155
<library>Dbgeng <library>ole32
127-
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
128156
[ check-target-builds WinDbg : : <build>no ]
157+
<conditional>@$(build-stacktrace-feature windbg)
129158
: # default build
130159
: # usage-requirements
131160
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
132-
<define>BOOST_STACKTRACE_NO_LIB=1
133161
;
134162

135163
lib boost_stacktrace_windbg_cached
136164
: # sources
137165
../src/windbg_cached.cpp
138166
: # requirements
139-
<warnings>all
167+
$(stacktrace_common_requirements)
140168
<library>Dbgeng <library>ole32
141-
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
142169
[ check-target-builds WinDbgCached : : <build>no ]
170+
<conditional>@$(build-stacktrace-feature windbg-cached)
143171
: # default build
144172
: # usage-requirements
145173
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
146-
<define>BOOST_STACKTRACE_NO_LIB=1
147174
;
148175

149176
rule build-stacktrace-from-exception ( props * )
@@ -166,7 +193,7 @@ lib boost_stacktrace_from_exception
166193
: # sources
167194
../src/from_exception.cpp
168195
: # requirements
169-
<warnings>all
196+
$(stacktrace_common_requirements)
170197
<target-os>linux:<library>dl
171198

172199
# Enable build when explicitly requested, or by default, when on x86
@@ -177,5 +204,4 @@ lib boost_stacktrace_from_exception
177204
: # default build
178205
: # usage-requirements
179206
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
180-
<define>BOOST_STACKTRACE_NO_LIB=1
181207
;

0 commit comments

Comments
 (0)