UserExtensions: debugopt.bkl

File debugopt.bkl, 1.5 KB (added by Vaclav Slavik, 4 years ago)
Line 
1<?xml version="1.0" ?>
2<!-- $Id: simple.bkl,v 1.2 2004/04/30 21:55:10 vaclavslavik Exp $ -->
3
4<!--
5
6Adds the logic for handling a DEBUG=0/1 option, which switches between debug and
7release builds.
8
9Usage: use template "debugopt" for your targets:
10
11  <include file="presets/debugopt.bkl"/>
12
13  <exe id="myapp" template="debugopt">
14    <sources>myapp.cpp</sources>
15  </exe>
16
17-->
18
19<makefile>
20
21    <set var="DEBUG_DEFAULT" overwrite="0">0</set>
22    <option name="DEBUG">
23        <values>0,1</values>
24        <default-value>$(DEBUG_DEFAULT)</default-value>
25        <values-description>Release,Debug</values-description>
26        <description>Set to 1 to build debug version</description>
27    </option>
28
29    <template id="debugopt">
30        <define>
31            $(substituteFromDict(DEBUG,{'1':'','0':'NDEBUG'}))
32        </define>
33        <optimize>
34            $(substituteFromDict(DEBUG,{'1':'off','0':'speed'}))
35        </optimize>
36        <debug-info>
37            $(substituteFromDict(DEBUG,{'1':'on','0':'off'}))
38        </debug-info>
39        <warnings>
40            $(substituteFromDict(DEBUG,{'1':'max','0':'no'}))
41        </warnings>
42        <debug-runtime-libs>
43            $(substituteFromDict(DEBUG,{'1':'on','0':'off'}))
44        </debug-runtime-libs>
45    </template>
46
47
48    <!-- The DEBUGBUILDPOSTFIX variable is useful to set the BUILDDIR variable
49         as done in presets/setbuilddir.bkl -->
50    <set var="DEBUGBUILDPOSTFIX">
51        <if cond="DEBUG=='0'">rel</if>
52        <if cond="DEBUG=='1'">dbg</if>
53    </set>
54
55</makefile>