added option to disable invariant checks and added more build documentation

This commit is contained in:
Arvid Norberg 2008-01-13 06:17:56 +00:00
parent 9304bd747c
commit 795bee4b2c
4 changed files with 52 additions and 1 deletions

View File

@ -152,6 +152,9 @@ rule building ( properties * )
feature bandwidth-limit-logging : off on : composite propagated link-incompatible ;
feature.compose <bandwidth-limit-logging>on : <define>TORRENT_VERBOSE_BANDWIDTH_LIMIT ;
feature invariant-checks : on off : composite propagated link-incompatible ;
feature.compose <invariant-checks>off : <define>TORRENT_DISABLE_INVARIANT_CHECKS ;
feature disk-stats : off on : composite propagated link-incompatible ;
feature.compose <disk-stats>on : <define>TORRENT_DISK_STATS ;

View File

@ -291,6 +291,26 @@ API is used.</li>
</ul>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">invariant-checks</span></tt></td>
<td><p class="first">This setting only affects debug builds (where
<tt class="docutils literal"><span class="pre">NDEBUG</span></tt> is not defined). It defaults to <tt class="docutils literal"><span class="pre">on</span></tt>.</p>
<ul class="last simple">
<li><tt class="docutils literal"><span class="pre">on</span></tt> - internal invariant checks are enabled.</li>
<li><tt class="docutils literal"><span class="pre">off</span></tt> - internal invariant checks are
disabled. The resulting executable will run
faster than a regular debug build.</li>
</ul>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">debug-symbols</span></tt></td>
<td><ul class="first last simple">
<li><tt class="docutils literal"><span class="pre">on</span></tt> - default for debug builds. This setting
is useful for building release builds with
symbols.</li>
<li><tt class="docutils literal"><span class="pre">off</span></tt> - default for release builds.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The <tt class="docutils literal"><span class="pre">variant</span></tt> feature is <em>implicit</em>, which means you don't need to specify
@ -558,6 +578,14 @@ non-ansi characters.</td>
<td>Defining this will disable the ability to
resolve countries of origin for peer IPs.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">TORRENT_DISABLE_INVARIANT_CHECKS</span></tt></td>
<td>This will disable internal invariant checks in
libtorrent. The invariant checks can sometime
be quite expensive, they typically don't scale
very well. This option can be used to still
build in debug mode, with asserts enabled, but
make the resulting executable faster.</td>
</tr>
</tbody>
</table>
<p>If you experience that libtorrent uses unreasonable amounts of cpu, it will

View File

@ -262,6 +262,19 @@ Build features:
| | * ``unicode`` - The unicode version of the win32 |
| | API is used. |
+------------------------+----------------------------------------------------+
| ``invariant-checks`` | This setting only affects debug builds (where |
| | ``NDEBUG`` is not defined). It defaults to ``on``. |
| | |
| | * ``on`` - internal invariant checks are enabled. |
| | * ``off`` - internal invariant checks are |
| | disabled. The resulting executable will run |
| | faster than a regular debug build. |
+------------------------+----------------------------------------------------+
| ``debug-symbols`` | * ``on`` - default for debug builds. This setting |
| | is useful for building release builds with |
| | symbols. |
| | * ``off`` - default for release builds. |
+------------------------+----------------------------------------------------+
The ``variant`` feature is *implicit*, which means you don't need to specify
the name of the feature, just the value.
@ -527,6 +540,13 @@ defines you can use to control the build.
| ``TORRENT_DISABLE_RESOLVE_COUNTRIES`` | Defining this will disable the ability to |
| | resolve countries of origin for peer IPs. |
+---------------------------------------+-------------------------------------------------+
| ``TORRENT_DISABLE_INVARIANT_CHECKS`` | This will disable internal invariant checks in |
| | libtorrent. The invariant checks can sometime |
| | be quite expensive, they typically don't scale |
| | very well. This option can be used to still |
| | build in debug mode, with asserts enabled, but |
| | make the resulting executable faster. |
+---------------------------------------+-------------------------------------------------+
If you experience that libtorrent uses unreasonable amounts of cpu, it will

View File

@ -66,7 +66,7 @@ namespace libtorrent
}
}
#ifndef NDEBUG
#if !defined NDEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS
#define INVARIANT_CHECK \
invariant_checker const& _invariant_check = make_invariant_checker(*this); \
(void)_invariant_check; \