mirror of
https://github.com/boostorg/config.git
synced 2025-11-02 00:31:53 +01:00
Revert "Add new build-time configuration feature."
This reverts commit dad7bc5b30.
Conflicts:
checks/config.jam
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
|
||||
[section:build_config Build Time Configuration]
|
||||
|
||||
There are times when you want to control whether a build target gets built or not, based
|
||||
on what features the compiler supports. For example, suppose you have a test file
|
||||
"test_constexpr_128.cpp" which requires three key features in order to build:
|
||||
|
||||
* The `constexpr` keyword as detected by BOOST_NO_CXX11_CONSTEXPR.
|
||||
* User defined literals, as detected by BOOST_NO_CXX11_USER_DEFINED_LITERALS.
|
||||
* The `__int128` data type, as detected by BOOST_HAS_INT128.
|
||||
|
||||
Clearly we know that if these features are not supported by the compiler, then
|
||||
there's simply no point in even trying to build the test program. The main advantages being:
|
||||
|
||||
* Faster compile times - build configuration uses lightweight tests the results of which are also cached.
|
||||
* Less noise in build output - there's no reason to be faced with pages of template
|
||||
instantiation backtrace if we know the file can never compile anyway.
|
||||
* Less noise in the online test results - the test will show up as blank, rather than as a fail
|
||||
in the online test matrix.
|
||||
* A better experience for end users building all of Boost, if those libraries which can not be built
|
||||
for the current target compiler are simply skipped, rather than generating pages of error output.
|
||||
|
||||
Returning to our example, the test case is probably executed in it's Jamfile via the "run" rule:
|
||||
|
||||
run test_constexpr_128.cpp ;
|
||||
|
||||
We now need to make this target conditional on the necessary features.
|
||||
We can do that by first importing the necessary rule at the start of the Jamfile:
|
||||
|
||||
import path-to-config-lib/checks/config : requires ;
|
||||
|
||||
Assuming that the test case is in the usual directory:
|
||||
|
||||
libs/yourlib/test
|
||||
|
||||
then the import rule will actually be:
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
|
||||
Then add a "requires" rule invocation to the requirements section of the target:
|
||||
|
||||
run test_constexpr_128.cpp
|
||||
: : : #requirements:
|
||||
[ requires cxx11_constexpr cxx11_user_defined_literals int128 ] ;
|
||||
|
||||
Notice that multiple arguments can be added to the requires rule, and that these are
|
||||
always the same as the Boost.Config macro name, but in lower case and with the ['boost_no_]
|
||||
or ['boost_has_] prefix removed.
|
||||
|
||||
When building the above example, you will see at the start of the build process the results
|
||||
of the configuration, for example GCC in C++11 mode gives:
|
||||
|
||||
- Boost.Config Feature Check: int128 : yes
|
||||
- Boost.Config Feature Check: cxx11_constexpr : yes
|
||||
- Boost.Config Feature Check: cxx11_user_defined_literals : yes
|
||||
|
||||
That's all there is to this handy feature, should at any time you be unsure of the feature-test
|
||||
names you can pass to the "requires" rule, then search for the Boost.Config macro of interest in
|
||||
libs/config/checks/Jamfiles.v2, and the name of the feature check will follow it.
|
||||
|
||||
And finally, this feature is built around the Boost.Build built in rule ['check-target-builds]
|
||||
which can be used to perform more generalized build-time feature testing. The checks in this
|
||||
library are provided as a convenient shorthand without the need for you to write the test cases yourself.
|
||||
|
||||
[endsect]
|
||||
@@ -50,7 +50,6 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
[include configuring_boost.qbk]
|
||||
[include macro_reference.qbk]
|
||||
[include build_time.qbk]
|
||||
[include cstdint.qbk]
|
||||
[include guidelines.qbk]
|
||||
[include rationale.qbk]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<link rel="home" href="../index.html" title="Boost.Config">
|
||||
<link rel="up" href="../index.html" title="Boost.Config">
|
||||
<link rel="prev" href="../index.html" title="Boost.Config">
|
||||
<link rel="next" href="build_config.html" title="Build Time Configuration">
|
||||
<link rel="next" href="cstdint.html" title="Standard Integer Types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="build_config.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cstdint.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
@@ -5613,7 +5613,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="build_config.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="../index.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cstdint.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||
<title>Build Time Configuration</title>
|
||||
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<link rel="home" href="../index.html" title="Boost.Config">
|
||||
<link rel="up" href="../index.html" title="Boost.Config">
|
||||
<link rel="prev" href="boost_macro_reference.html" title="Boost Macro Reference">
|
||||
<link rel="next" href="cstdint.html" title="Standard Integer Types">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table cellpadding="2" width="100%"><tr>
|
||||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
|
||||
<td align="center"><a href="../../../../../index.html">Home</a></td>
|
||||
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||||
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost_macro_reference.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cstdint.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="boost_config.build_config"></a><a class="link" href="build_config.html" title="Build Time Configuration">Build Time Configuration</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
There are times when you want to control whether a build target gets built
|
||||
or not, based on what features the compiler supports. For example, suppose
|
||||
you have a test file "test_constexpr_128.cpp" which requires three
|
||||
key features in order to build:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
The <code class="computeroutput"><span class="keyword">constexpr</span></code> keyword as detected
|
||||
by BOOST_NO_CXX11_CONSTEXPR.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
User defined literals, as detected by BOOST_NO_CXX11_USER_DEFINED_LITERALS.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
The <code class="computeroutput"><span class="identifier">__int128</span></code> data type,
|
||||
as detected by BOOST_HAS_INT128.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Clearly we know that if these features are not supported by the compiler, then
|
||||
there's simply no point in even trying to build the test program. The main
|
||||
advantages being:
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
Faster compile times - build configuration uses lightweight tests the results
|
||||
of which are also cached.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Less noise in build output - there's no reason to be faced with pages of
|
||||
template instantiation backtrace if we know the file can never compile
|
||||
anyway.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
Less noise in the online test results - the test will show up as blank,
|
||||
rather than as a fail in the online test matrix.
|
||||
</li>
|
||||
<li class="listitem">
|
||||
A better experience for end users building all of Boost, if those libraries
|
||||
which can not be built for the current target compiler are simply skipped,
|
||||
rather than generating pages of error output.
|
||||
</li>
|
||||
</ul></div>
|
||||
<p>
|
||||
Returning to our example, the test case is probably executed in it's Jamfile
|
||||
via the "run" rule:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">run</span> <span class="identifier">test_constexpr_128</span><span class="special">.</span><span class="identifier">cpp</span> <span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
We now need to make this target conditional on the necessary features. We can
|
||||
do that by first importing the necessary rule at the start of the Jamfile:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">import</span> <span class="identifier">path</span><span class="special">-</span><span class="identifier">to</span><span class="special">-</span><span class="identifier">config</span><span class="special">-</span><span class="identifier">lib</span><span class="special">/</span><span class="identifier">checks</span><span class="special">/</span><span class="identifier">config</span> <span class="special">:</span> <span class="identifier">requires</span> <span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
Assuming that the test case is in the usual directory:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">yourlib</span><span class="special">/</span><span class="identifier">test</span>
|
||||
</pre>
|
||||
<p>
|
||||
then the import rule will actually be:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">import</span> <span class="special">../../</span><span class="identifier">config</span><span class="special">/</span><span class="identifier">checks</span><span class="special">/</span><span class="identifier">config</span> <span class="special">:</span> <span class="identifier">requires</span> <span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
Then add a "requires" rule invocation to the requirements section
|
||||
of the target:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">run</span> <span class="identifier">test_constexpr_128</span><span class="special">.</span><span class="identifier">cpp</span>
|
||||
<span class="special">:</span> <span class="special">:</span> <span class="special">:</span> <span class="special">#</span><span class="identifier">requirements</span><span class="special">:</span>
|
||||
<span class="special">[</span> <span class="identifier">requires</span> <span class="identifier">cxx11_constexpr</span> <span class="identifier">cxx11_user_defined_literals</span> <span class="identifier">int128</span> <span class="special">]</span> <span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
Notice that multiple arguments can be added to the requires rule, and that
|
||||
these are always the same as the Boost.Config macro name, but in lower case
|
||||
and with the <span class="emphasis"><em>boost_no_</em></span> or <span class="emphasis"><em>boost_has_</em></span>
|
||||
prefix removed.
|
||||
</p>
|
||||
<p>
|
||||
When building the above example, you will see at the start of the build process
|
||||
the results of the configuration, for example GCC in C++11 mode gives:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="special">-</span> <span class="identifier">Boost</span><span class="special">.</span><span class="identifier">Config</span> <span class="identifier">Feature</span> <span class="identifier">Check</span><span class="special">:</span> <span class="identifier">int128</span> <span class="special">:</span> <span class="identifier">yes</span>
|
||||
<span class="special">-</span> <span class="identifier">Boost</span><span class="special">.</span><span class="identifier">Config</span> <span class="identifier">Feature</span> <span class="identifier">Check</span><span class="special">:</span> <span class="identifier">cxx11_constexpr</span> <span class="special">:</span> <span class="identifier">yes</span>
|
||||
<span class="special">-</span> <span class="identifier">Boost</span><span class="special">.</span><span class="identifier">Config</span> <span class="identifier">Feature</span> <span class="identifier">Check</span><span class="special">:</span> <span class="identifier">cxx11_user_defined_literals</span> <span class="special">:</span> <span class="identifier">yes</span>
|
||||
</pre>
|
||||
<p>
|
||||
That's all there is to this handy feature, should at any time you be unsure
|
||||
of the feature-test names you can pass to the "requires" rule, then
|
||||
search for the Boost.Config macro of interest in libs/config/checks/Jamfiles.v2,
|
||||
and the name of the feature check will follow it.
|
||||
</p>
|
||||
<p>
|
||||
And finally, this feature is built around the Boost.Build built in rule <span class="emphasis"><em>check-target-builds</em></span>
|
||||
which can be used to perform more generalized build-time feature testing. The
|
||||
checks in this library are provided as a convenient shorthand without the need
|
||||
for you to write the test cases yourself.
|
||||
</p>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"></td>
|
||||
<td align="right"><div class="copyright-footer">Copyright © 2001-2007 Beman Dawes, Vesa Karvonen, John
|
||||
Maddock<p>
|
||||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
|
||||
</p>
|
||||
</div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="boost_macro_reference.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="cstdint.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
|
||||
<link rel="home" href="../index.html" title="Boost.Config">
|
||||
<link rel="up" href="../index.html" title="Boost.Config">
|
||||
<link rel="prev" href="build_config.html" title="Build Time Configuration">
|
||||
<link rel="prev" href="boost_macro_reference.html" title="Boost Macro Reference">
|
||||
<link rel="next" href="guidelines_for_boost_authors.html" title="Guidelines for Boost Authors">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
@@ -20,7 +20,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="build_config.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="guidelines_for_boost_authors.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="boost_macro_reference.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="guidelines_for_boost_authors.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
@@ -283,7 +283,7 @@
|
||||
</tr></table>
|
||||
<hr>
|
||||
<div class="spirit-nav">
|
||||
<a accesskey="p" href="build_config.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="guidelines_for_boost_authors.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
<a accesskey="p" href="boost_macro_reference.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="guidelines_for_boost_authors.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
<dt><span class="section"><a href="boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code">Macros
|
||||
for libraries with separate source code</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="section"><a href="boost_config/build_config.html">Build Time Configuration</a></span></dt>
|
||||
<dt><span class="section"><a href="boost_config/cstdint.html">Standard Integer Types</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="section"><a href="boost_config/cstdint.html#boost_config.cstdint.overview">Overview</a></span></dt>
|
||||
@@ -968,7 +967,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: June 05, 2014 at 17:41:22 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: June 01, 2014 at 09:50:01 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user