| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <!DOCTYPE chapter PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" |
|---|
| 3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd" |
|---|
| 4 | [ |
|---|
| 5 | <!ENTITY toolset_ops "<optional><replaceable>version</replaceable></optional> : <optional><replaceable>c++-compile-command</replaceable></optional> : <optional><replaceable>compiler options</replaceable></optional>"> |
|---|
| 6 | <!ENTITY option_list_intro "<para>The following options can be provided, using <literal><<replaceable>option-name</replaceable>><replaceable>option-value</replaceable></literal> syntax:</para>"> |
|---|
| 7 | <!ENTITY using_repeation "<para>This statement may be repeated several times, if you want to configure several versions of the compiler.</para>"> |
|---|
| 8 | ]> |
|---|
| 9 | |
|---|
| 10 | <chapter id="bbv2.reference" |
|---|
| 11 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
|---|
| 12 | <title>Detailed reference</title> |
|---|
| 13 | |
|---|
| 14 | <section id="bbv2.reference.general"> |
|---|
| 15 | <title>General information</title> |
|---|
| 16 | |
|---|
| 17 | <section id="bbv2.reference.init"> |
|---|
| 18 | <title>Initialization</title> |
|---|
| 19 | |
|---|
| 20 | <para>bjam's first job upon startup is to load the Jam code that |
|---|
| 21 | implements the build system. To do this, it searches for a file |
|---|
| 22 | called <filename>boost-build.jam</filename>, first in the invocation directory, then |
|---|
| 23 | in its parent and so forth up to the filesystem root, and finally |
|---|
| 24 | in the directories specified by the environment variable |
|---|
| 25 | BOOST_BUILD_PATH. When found, the file is interpreted, and should |
|---|
| 26 | specify the build system location by calling the boost-build |
|---|
| 27 | rule:</para> |
|---|
| 28 | |
|---|
| 29 | <programlisting> |
|---|
| 30 | rule boost-build ( location ? ) |
|---|
| 31 | </programlisting> |
|---|
| 32 | |
|---|
| 33 | <para> |
|---|
| 34 | If location is a relative path, it is treated as relative to |
|---|
| 35 | the directory of <filename>boost-build.jam</filename>. The directory specified by |
|---|
| 36 | that location and the directories in BOOST_BUILD_PATH are then searched for |
|---|
| 37 | a file called <filename>bootstrap.jam</filename>, which is expected to |
|---|
| 38 | bootstrap the build system. This arrangement allows the build |
|---|
| 39 | system to work without any command-line or environment variable |
|---|
| 40 | settings. For example, if the build system files were located in a |
|---|
| 41 | directory "build-system/" at your project root, you might place a |
|---|
| 42 | <filename>boost-build.jam</filename> at the project root containing: |
|---|
| 43 | |
|---|
| 44 | <programlisting> |
|---|
| 45 | boost-build build-system ; |
|---|
| 46 | </programlisting> |
|---|
| 47 | |
|---|
| 48 | In this case, running bjam anywhere in the project tree will |
|---|
| 49 | automatically find the build system.</para> |
|---|
| 50 | |
|---|
| 51 | <para>The default <filename>bootstrap.jam</filename>, after loading some standard |
|---|
| 52 | definitions, loads two files, which can be provided/customised by |
|---|
| 53 | user: <filename>site-config.jam</filename> and <filename>user-config.jam</filename>.</para> |
|---|
| 54 | |
|---|
| 55 | <para>Locations where those files are searched are summarized below:</para> |
|---|
| 56 | |
|---|
| 57 | <table id="bbv2.reference.init.config"> |
|---|
| 58 | <title>Search paths for configuration files</title> |
|---|
| 59 | |
|---|
| 60 | <tgroup cols="3"> |
|---|
| 61 | <thead> |
|---|
| 62 | |
|---|
| 63 | <row> |
|---|
| 64 | <entry></entry> |
|---|
| 65 | |
|---|
| 66 | <entry>site-config.jam</entry> |
|---|
| 67 | |
|---|
| 68 | <entry>user-config.jam</entry> |
|---|
| 69 | </row> |
|---|
| 70 | |
|---|
| 71 | </thead> |
|---|
| 72 | <tbody> |
|---|
| 73 | |
|---|
| 74 | <row> |
|---|
| 75 | <entry>Linux</entry> |
|---|
| 76 | |
|---|
| 77 | <entry> |
|---|
| 78 | <simpara><code>/etc</code></simpara> |
|---|
| 79 | <simpara><code>$HOME</code></simpara> |
|---|
| 80 | <simpara><code>$BOOST_BUILD_PATH</code></simpara> |
|---|
| 81 | </entry> |
|---|
| 82 | |
|---|
| 83 | <entry> |
|---|
| 84 | <simpara><code>$HOME</code></simpara> |
|---|
| 85 | <simpara><code>$BOOST_BUILD_PATH</code></simpara> |
|---|
| 86 | </entry> |
|---|
| 87 | </row> |
|---|
| 88 | |
|---|
| 89 | <row> |
|---|
| 90 | <entry>Windows</entry> |
|---|
| 91 | |
|---|
| 92 | <entry> |
|---|
| 93 | <simpara><code>%SystemRoot%</code></simpara> |
|---|
| 94 | <simpara><code>%HOMEDRIVE%%HOMEPATH%</code></simpara> |
|---|
| 95 | <simpara><code>%HOME%</code></simpara> |
|---|
| 96 | <simpara><code>%BOOST_BUILD_PATH%</code></simpara> |
|---|
| 97 | </entry> |
|---|
| 98 | |
|---|
| 99 | <entry> |
|---|
| 100 | <simpara><code>%HOMEDRIVE%%HOMEPATH%</code></simpara> |
|---|
| 101 | <simpara><code>%HOME%</code></simpara> |
|---|
| 102 | <simpara><code>%BOOST_BUILD_PATH%</code></simpara> |
|---|
| 103 | </entry> |
|---|
| 104 | </row> |
|---|
| 105 | </tbody> |
|---|
| 106 | </tgroup> |
|---|
| 107 | </table> |
|---|
| 108 | |
|---|
| 109 | <para> |
|---|
| 110 | Boost.Build comes with default versions of those files, |
|---|
| 111 | <!-- Where are those files installed? The user can't use them as templates unless she can find them --> |
|---|
| 112 | which can serve as templates for customized versions. |
|---|
| 113 | </para> |
|---|
| 114 | |
|---|
| 115 | </section> |
|---|
| 116 | <section id="bbv2.reference.commandline"> |
|---|
| 117 | <title>Command line</title> |
|---|
| 118 | |
|---|
| 119 | <para>The command line may contain:</para> |
|---|
| 120 | |
|---|
| 121 | <itemizedlist> |
|---|
| 122 | <listitem><simpara>Jam options,</simpara></listitem> |
|---|
| 123 | |
|---|
| 124 | <listitem><simpara>Boost.Build <link linkend= |
|---|
| 125 | "bbv2.reference.init.options">options</link>,</simpara></listitem> |
|---|
| 126 | |
|---|
| 127 | <listitem><simpara>Command line arguments</simpara></listitem> |
|---|
| 128 | </itemizedlist> |
|---|
| 129 | |
|---|
| 130 | <section id="bbv2.reference.init.args"> |
|---|
| 131 | <title>Command line arguments</title> |
|---|
| 132 | |
|---|
| 133 | <para> |
|---|
| 134 | Command line arguments specify targets and build |
|---|
| 135 | request using the following rules. |
|---|
| 136 | </para> |
|---|
| 137 | |
|---|
| 138 | <itemizedlist> |
|---|
| 139 | <listitem> |
|---|
| 140 | <simpara> |
|---|
| 141 | An argument that does not contain slashes or the <code>=</code> |
|---|
| 142 | symbol is either a value of an implicit feature or of a target to |
|---|
| 143 | be built. It is taken to be value of a feature if an appropriate |
|---|
| 144 | feature exists. Otherwise, it is considered a <link linkend= |
|---|
| 145 | "bbv2.reference.ids">target id</link>. Building the |
|---|
| 146 | special target name “clean” has the same effect as |
|---|
| 147 | using the <code>--clean</code> option. |
|---|
| 148 | </simpara> |
|---|
| 149 | </listitem> |
|---|
| 150 | |
|---|
| 151 | <listitem> |
|---|
| 152 | <para> |
|---|
| 153 | An argument containing either slashes or |
|---|
| 154 | the <code>=</code> symbol specifies a number of build |
|---|
| 155 | request elements (see <xref |
|---|
| 156 | linkend="bbv2.advanced.build_request"/>). In its simplest |
|---|
| 157 | form, it's just a set of properties, separated by |
|---|
| 158 | slashes, which become a single build request element, |
|---|
| 159 | for example: |
|---|
| 160 | |
|---|
| 161 | <programlisting> |
|---|
| 162 | borland/<runtime-link>static |
|---|
| 163 | </programlisting> |
|---|
| 164 | |
|---|
| 165 | A more complex form can be used to save typing. For example, |
|---|
| 166 | instead of |
|---|
| 167 | |
|---|
| 168 | <programlisting> |
|---|
| 169 | borland/runtime-link=static borland/runtime-link=dynamic |
|---|
| 170 | </programlisting> |
|---|
| 171 | |
|---|
| 172 | one can use |
|---|
| 173 | |
|---|
| 174 | <programlisting> |
|---|
| 175 | borland/runtime-link=static,dynamic |
|---|
| 176 | </programlisting> |
|---|
| 177 | |
|---|
| 178 | Exactly, the conversion from argument to build request |
|---|
| 179 | elements is performed by (1) splitting the argument at each slash, |
|---|
| 180 | (2) converting each split part into a set of properties and (3) |
|---|
| 181 | taking all possible combinations |
|---|
| 182 | <!-- Be specific. Do you mean the cross-product? --> |
|---|
| 183 | of the property sets. Each split |
|---|
| 184 | part should have either the form |
|---|
| 185 | |
|---|
| 186 | <programlisting> |
|---|
| 187 | <emphasis>feature-name</emphasis>=<emphasis>feature-value1</emphasis>[","<emphasis>feature-valueN</emphasis>]* |
|---|
| 188 | </programlisting> |
|---|
| 189 | |
|---|
| 190 | or, in case of implicit features |
|---|
| 191 | |
|---|
| 192 | <programlisting> |
|---|
| 193 | <emphasis>feature-value1</emphasis>[","<emphasis>feature-valueN</emphasis>;]* |
|---|
| 194 | </programlisting> |
|---|
| 195 | |
|---|
| 196 | will be converted into the property set |
|---|
| 197 | |
|---|
| 198 | <programlisting> |
|---|
| 199 | <feature-name>feature-value1 .... <feature-name>feature-valueN |
|---|
| 200 | </programlisting> |
|---|
| 201 | |
|---|
| 202 | <!-- There's absolutely no explanation of how arguments are combined. Fix that. --> |
|---|
| 203 | |
|---|
| 204 | </para> |
|---|
| 205 | </listitem> |
|---|
| 206 | </itemizedlist> |
|---|
| 207 | |
|---|
| 208 | <para> |
|---|
| 209 | For example, the command line |
|---|
| 210 | |
|---|
| 211 | <programlisting> |
|---|
| 212 | target1 debug gcc/runtime-link=dynamic,static |
|---|
| 213 | </programlisting> |
|---|
| 214 | |
|---|
| 215 | would cause target called <literal>target1</literal> to be rebuilt in |
|---|
| 216 | debug mode, except that for gcc, both dynamically and statically |
|---|
| 217 | linked binaries would be created. |
|---|
| 218 | </para> |
|---|
| 219 | |
|---|
| 220 | </section> |
|---|
| 221 | <section id="bbv2.reference.init.options"> |
|---|
| 222 | <title>Command line options</title> |
|---|
| 223 | |
|---|
| 224 | <para>All of the Boost.Build options start with the "--" prefix. |
|---|
| 225 | They are described in the following table.</para> |
|---|
| 226 | |
|---|
| 227 | <para>FIXME: That table has moved into "User documentation" section |
|---|
| 228 | and there's nothing we can add here. Remove this part?</para> |
|---|
| 229 | |
|---|
| 230 | |
|---|
| 231 | </section> |
|---|
| 232 | </section> |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | </section> |
|---|
| 236 | |
|---|
| 237 | <section id="bbv2.reference.rules"> |
|---|
| 238 | <title>Builtin rules</title> |
|---|
| 239 | |
|---|
| 240 | <para>This section contains the list of all rules that |
|---|
| 241 | can be used in Jamfile—both rules that define new |
|---|
| 242 | targets and auxiliary rules.</para> |
|---|
| 243 | |
|---|
| 244 | <variablelist> |
|---|
| 245 | <varlistentry> |
|---|
| 246 | <term><literal>exe</literal></term> |
|---|
| 247 | |
|---|
| 248 | <listitem><para>Creates an executable file. See |
|---|
| 249 | <xref linkend="bbv2.tasks.programs"/>.</para></listitem> |
|---|
| 250 | </varlistentry> |
|---|
| 251 | |
|---|
| 252 | <varlistentry> |
|---|
| 253 | <term><literal>lib</literal></term> |
|---|
| 254 | |
|---|
| 255 | <listitem><para>Creates an library file. See |
|---|
| 256 | <xref linkend="bbv2.tasks.libraries"/>.</para></listitem> |
|---|
| 257 | </varlistentry> |
|---|
| 258 | |
|---|
| 259 | <varlistentry> |
|---|
| 260 | <term><literal>install</literal></term> |
|---|
| 261 | |
|---|
| 262 | <listitem><para>Installs built targets and other files. See |
|---|
| 263 | <xref linkend="bbv2.tasks.installing"/>.</para></listitem> |
|---|
| 264 | </varlistentry> |
|---|
| 265 | |
|---|
| 266 | <varlistentry> |
|---|
| 267 | <term><literal>alias</literal></term> |
|---|
| 268 | |
|---|
| 269 | <listitem><para>Creates an alias for other targets. See |
|---|
| 270 | <xref linkend="bbv2.tasks.alias"/>.</para></listitem> |
|---|
| 271 | </varlistentry> |
|---|
| 272 | |
|---|
| 273 | <varlistentry> |
|---|
| 274 | <term><literal>unit-test</literal></term> |
|---|
| 275 | |
|---|
| 276 | <listitem><para>Creates an executable that will be automatically run. See |
|---|
| 277 | <xref linkend="bbv2.tutorial.testing"/>.</para></listitem> |
|---|
| 278 | </varlistentry> |
|---|
| 279 | |
|---|
| 280 | <varlistentry> |
|---|
| 281 | <term><literal>compile</literal></term> |
|---|
| 282 | <term><literal>compile-fail</literal></term> |
|---|
| 283 | <term><literal>link</literal></term> |
|---|
| 284 | <term><literal>link-fail</literal></term> |
|---|
| 285 | <term><literal>run</literal></term> |
|---|
| 286 | <term><literal>run-fail</literal></term> |
|---|
| 287 | |
|---|
| 288 | <listitem><para>Specialized rules for testing. See |
|---|
| 289 | <xref linkend="bbv2.tutorial.testing"/>.</para></listitem> |
|---|
| 290 | </varlistentry> |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | <varlistentry> |
|---|
| 294 | <term><literal>obj</literal></term> |
|---|
| 295 | |
|---|
| 296 | <listitem><para>Creates an object file. Useful when a single source |
|---|
| 297 | file must be compiled with special properties.</para></listitem> |
|---|
| 298 | </varlistentry> |
|---|
| 299 | |
|---|
| 300 | <varlistentry> |
|---|
| 301 | <term><literal>glob</literal></term> |
|---|
| 302 | |
|---|
| 303 | <listitem><para>The <code>glob</code> rule takes a list shell pattern |
|---|
| 304 | and returns the list of files in the project's source directory that |
|---|
| 305 | match the pattern. For example: |
|---|
| 306 | <programlisting> |
|---|
| 307 | lib tools : [ glob *.cpp ] ; |
|---|
| 308 | </programlisting> |
|---|
| 309 | It is possible to also pass a second argument—the list of |
|---|
| 310 | exclude patterns. The result will then include the list of |
|---|
| 311 | files patching any of include patterns, and not matching any |
|---|
| 312 | of the exclude patterns. For example: |
|---|
| 313 | <programlisting> |
|---|
| 314 | lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ; |
|---|
| 315 | </programlisting> |
|---|
| 316 | </para></listitem> |
|---|
| 317 | </varlistentry> |
|---|
| 318 | |
|---|
| 319 | <varlistentry> |
|---|
| 320 | <term><literal>glob-tree</literal></term> |
|---|
| 321 | |
|---|
| 322 | <listitem><para>The <code>glob-tree</code> is similar to the |
|---|
| 323 | <code>glob</code> except that it operates recursively from |
|---|
| 324 | the directory of the containing Jamfile. For example: |
|---|
| 325 | <programlisting> |
|---|
| 326 | ECHO [ glob-tree *.cpp : .svn ] ; |
|---|
| 327 | </programlisting> |
|---|
| 328 | will print the names of all C++ files in your project. The |
|---|
| 329 | <literal>.svn</literal> exclude pattern prevents the |
|---|
| 330 | <code>glob-tree</code> rule from entering administrative |
|---|
| 331 | directories of the Subverion version control system. |
|---|
| 332 | </para></listitem> |
|---|
| 333 | </varlistentry> |
|---|
| 334 | |
|---|
| 335 | <varlistentry> |
|---|
| 336 | <term><literal>project</literal></term> |
|---|
| 337 | |
|---|
| 338 | <listitem><para>Declares project id and attributes, including |
|---|
| 339 | project requirements. See <xref linkend="bbv2.advanced.projects"/>. |
|---|
| 340 | </para></listitem> |
|---|
| 341 | </varlistentry> |
|---|
| 342 | |
|---|
| 343 | <varlistentry> |
|---|
| 344 | <term><literal>use-project</literal></term> |
|---|
| 345 | |
|---|
| 346 | <listitem><para>Assigns a symbolic project ID to a project at |
|---|
| 347 | a given path. This rule must be better documented! |
|---|
| 348 | </para></listitem> |
|---|
| 349 | </varlistentry> |
|---|
| 350 | |
|---|
| 351 | <varlistentry> |
|---|
| 352 | <term><literal>explicit</literal></term> |
|---|
| 353 | |
|---|
| 354 | <listitem><para>The <literal>explicit</literal> rule takes a single |
|---|
| 355 | parameter—a list of target names. The named targets will |
|---|
| 356 | be marked explicit, and will be built only if they are explicitly |
|---|
| 357 | requested on the command line, or if their dependents are built. |
|---|
| 358 | Compare this to ordinary targets, that are built implicitly when |
|---|
| 359 | their containing project is built.</para></listitem> |
|---|
| 360 | </varlistentry> |
|---|
| 361 | |
|---|
| 362 | <varlistentry> |
|---|
| 363 | <term><literal>constant</literal></term> |
|---|
| 364 | |
|---|
| 365 | <listitem><para>Sets project-wide constant. Takes two |
|---|
| 366 | parameters: variable name and a value and makes the specified |
|---|
| 367 | variable name accessible in this Jamfile and any child Jamfiles. |
|---|
| 368 | For example: |
|---|
| 369 | <programlisting> |
|---|
| 370 | constant VERSION : 1.34.0 ; |
|---|
| 371 | </programlisting> |
|---|
| 372 | </para></listitem> |
|---|
| 373 | </varlistentry> |
|---|
| 374 | |
|---|
| 375 | <varlistentry> |
|---|
| 376 | <term><literal>path-constant</literal></term> |
|---|
| 377 | |
|---|
| 378 | <listitem><para>Same as <literal>constant</literal> except that |
|---|
| 379 | the value is treated as path relative to Jamfile location. For example, |
|---|
| 380 | if <command>bjam</command> is invoked in the current directory, |
|---|
| 381 | and Jamfile in <filename>helper</filename> subdirectory has: |
|---|
| 382 | <programlisting> |
|---|
| 383 | path-constant DATA : data/a.txt ; |
|---|
| 384 | </programlisting> |
|---|
| 385 | then the variable <varname>DATA</varname> will be set to |
|---|
| 386 | <literal>helper/data/a.txt</literal>, and if <command>bjam</command> |
|---|
| 387 | is invoked from the <filename>helper</filename> directory, then |
|---|
| 388 | the variable <varname>DATA</varname> will be set to |
|---|
| 389 | <literal>data/a.txt</literal>. |
|---|
| 390 | </para></listitem> |
|---|
| 391 | </varlistentry> |
|---|
| 392 | |
|---|
| 393 | <varlistentry> |
|---|
| 394 | <term><literal>build-project</literal></term> |
|---|
| 395 | |
|---|
| 396 | <listitem><para>Cause some other project to be built. This rule |
|---|
| 397 | takes a single parameter—a directory name relative to |
|---|
| 398 | the containing Jamfile. When the containing Jamfile is built, |
|---|
| 399 | the project located at that directory will be built as well. |
|---|
| 400 | At the moment, the parameter to this rule should be a directory |
|---|
| 401 | name. Project ID or general target references are not allowed. |
|---|
| 402 | </para></listitem> |
|---|
| 403 | </varlistentry> |
|---|
| 404 | |
|---|
| 405 | <varlistentry> |
|---|
| 406 | <term><literal>test-suite</literal></term> |
|---|
| 407 | |
|---|
| 408 | <listitem><para>This rule is deprecated and equivalent to |
|---|
| 409 | <code>alias</code>.</para></listitem> |
|---|
| 410 | </varlistentry> |
|---|
| 411 | |
|---|
| 412 | </variablelist> |
|---|
| 413 | |
|---|
| 414 | </section> |
|---|
| 415 | |
|---|
| 416 | <section id="bbv2.advanced.builtins.features"> |
|---|
| 417 | <title>Builtin features</title> |
|---|
| 418 | |
|---|
| 419 | <variablelist> |
|---|
| 420 | <varlistentry><term><literal>variant</literal></term> |
|---|
| 421 | |
|---|
| 422 | <listitem> |
|---|
| 423 | <para> |
|---|
| 424 | A feature that combines several low-level features, making |
|---|
| 425 | it easy to request common build configurations. |
|---|
| 426 | </para> |
|---|
| 427 | |
|---|
| 428 | <para><emphasis role="bold">Allowed values:</emphasis> <literal>debug</literal>, <literal>release</literal>, |
|---|
| 429 | <literal>profile</literal>.</para> |
|---|
| 430 | |
|---|
| 431 | <para>The value <literal>debug</literal> expands to</para> |
|---|
| 432 | |
|---|
| 433 | <programlisting> |
|---|
| 434 | <optimization>off <debug-symbols>on <inlining>off <runtime-debugging>on |
|---|
| 435 | </programlisting> |
|---|
| 436 | |
|---|
| 437 | <para>The value <literal>release</literal> expands to</para> |
|---|
| 438 | |
|---|
| 439 | <programlisting> |
|---|
| 440 | <optimization>speed <debug-symbols>off <inlining>full <runtime-debugging>off |
|---|
| 441 | </programlisting> |
|---|
| 442 | |
|---|
| 443 | <para>The value <literal>profile</literal> expands to the same as |
|---|
| 444 | <literal>release</literal>, plus:</para> |
|---|
| 445 | |
|---|
| 446 | <programlisting> |
|---|
| 447 | <profiling>on <debug-symbols>on |
|---|
| 448 | </programlisting> |
|---|
| 449 | |
|---|
| 450 | <para>User can define his own build variants using the <code>variant</code> rule from the <code>common</code> |
|---|
| 451 | module.</para> |
|---|
| 452 | |
|---|
| 453 | <para><emphasis role="bold">Notee:</emphasis> Runtime |
|---|
| 454 | debugging is on in debug builds to suit the expectations of |
|---|
| 455 | people used to various IDEs. |
|---|
| 456 | <!-- Define "runtime debugging." Why will those people expect it to be on in debug builds? --> |
|---|
| 457 | </para> |
|---|
| 458 | </listitem></varlistentry> |
|---|
| 459 | |
|---|
| 460 | <varlistentry id="bbv2.advanced.builtins.features.link"> |
|---|
| 461 | <term><literal>link</literal></term> |
|---|
| 462 | |
|---|
| 463 | <listitem> |
|---|
| 464 | <simpara> |
|---|
| 465 | A feature that controls how libraries are built. |
|---|
| 466 | </simpara> |
|---|
| 467 | |
|---|
| 468 | <para><emphasis role="bold">Allowed values:</emphasis> <literal>shared</literal>, |
|---|
| 469 | <literal>static</literal></para> |
|---|
| 470 | </listitem></varlistentry> |
|---|
| 471 | |
|---|
| 472 | <varlistentry><term><literal>source</literal></term> |
|---|
| 473 | |
|---|
| 474 | <listitem> |
|---|
| 475 | <simpara> |
|---|
| 476 | The <code><source>X</code> feature has the same effect on |
|---|
| 477 | building a target as putting X in the list of sources. |
|---|
| 478 | It's useful when you want to add |
|---|
| 479 | the same source to all targets in the project |
|---|
| 480 | (you can put <source> in requirements) or to conditionally |
|---|
| 481 | include a source (using conditional requirements, see <xref linkend="bbv2.tutorial.conditions"/>) |
|---|
| 482 | See also the <code><library></code> feature. |
|---|
| 483 | </simpara> |
|---|
| 484 | </listitem> |
|---|
| 485 | </varlistentry> |
|---|
| 486 | |
|---|
| 487 | <varlistentry><term><literal>library</literal></term> |
|---|
| 488 | |
|---|
| 489 | <listitem> |
|---|
| 490 | <simpara> |
|---|
| 491 | This feature is almost equivalent to the <code><source></code> feature, |
|---|
| 492 | except that it takes effect only for linking. When you want to |
|---|
| 493 | link all targets in a Jamfile to certain library, the |
|---|
| 494 | <code><library></code> feature is preferred over |
|---|
| 495 | <code><source>X</code> -- the latter will add the library to |
|---|
| 496 | all targets, even those that have nothing to do with libraries. |
|---|
| 497 | </simpara> |
|---|
| 498 | </listitem> |
|---|
| 499 | </varlistentry> |
|---|
| 500 | |
|---|
| 501 | <varlistentry><term><anchor id="bbv2.builtin.features.dependency"/> |
|---|
| 502 | <literal>dependency</literal></term> |
|---|
| 503 | |
|---|
| 504 | <listitem> |
|---|
| 505 | <simpara> |
|---|
| 506 | Introduces a dependency on the target named by the |
|---|
| 507 | value of this feature (so it will be brought |
|---|
| 508 | up-to-date whenever the target being declared is). |
|---|
| 509 | The dependency is not used in any other way. For example, in |
|---|
| 510 | application with plugins, the plugins are not used when linking |
|---|
| 511 | the application, |
|---|
| 512 | application might have dependency on its plugins, even though |
|---|
| 513 | |
|---|
| 514 | |
|---|
| 515 | , and |
|---|
| 516 | adds its usage requirements to the build properties |
|---|
| 517 | of the target being declared. |
|---|
| 518 | |
|---|
| 519 | The primary use case is when you want |
|---|
| 520 | the usage requirements (such as <code>#include</code> paths) of some |
|---|
| 521 | library to be applied, but don't want to link to it. |
|---|
| 522 | <!-- It's hard to picture why anyone would want to do |
|---|
| 523 | that. Please flesh out this motivation --> |
|---|
| 524 | </simpara> |
|---|
| 525 | </listitem> |
|---|
| 526 | </varlistentry> |
|---|
| 527 | |
|---|
| 528 | |
|---|
| 529 | <varlistentry><term><anchor id="bbv2.builtin.features.use"/> |
|---|
| 530 | <literal>use</literal></term> |
|---|
| 531 | |
|---|
| 532 | <listitem> |
|---|
| 533 | <simpara> |
|---|
| 534 | Introduces a dependency on the target named by the |
|---|
| 535 | value of this feature (so it will be brought |
|---|
| 536 | up-to-date whenever the target being declared is), and |
|---|
| 537 | adds its usage requirements to the build properties |
|---|
| 538 | <!-- Do you really mean "to the requirements?" --> |
|---|
| 539 | of the target being declared. The dependency is not used |
|---|
| 540 | in any other way. The primary use case is when you want |
|---|
| 541 | the usage requirements (such as <code>#include</code> paths) of some |
|---|
| 542 | library to be applied, but don't want to link to it. |
|---|
| 543 | <!-- It's hard to picture why anyone would want to do |
|---|
| 544 | that. Please flesh out this motivation --> |
|---|
| 545 | </simpara> |
|---|
| 546 | </listitem> |
|---|
| 547 | </varlistentry> |
|---|
| 548 | |
|---|
| 549 | <varlistentry><term><anchor id="bbv2.reference.features.dll-path"/> |
|---|
| 550 | <literal>dll-path</literal></term> |
|---|
| 551 | |
|---|
| 552 | <listitem> |
|---|
| 553 | <simpara> |
|---|
| 554 | Specify an additional directory where the system should |
|---|
| 555 | look for shared libraries when the executable or shared |
|---|
| 556 | library is run. This feature only affects Unix |
|---|
| 557 | compilers. Plase see <xref linkend="bbv2.faq.dll-path"/> |
|---|
| 558 | in <xref linkend="bbv2.faq"/> for details. |
|---|
| 559 | </simpara> |
|---|
| 560 | </listitem></varlistentry> |
|---|
| 561 | |
|---|
| 562 | <varlistentry><term><literal>hardcode-dll-paths</literal></term> |
|---|
| 563 | |
|---|
| 564 | <listitem> |
|---|
| 565 | <simpara> |
|---|
| 566 | Controls automatic generation of dll-path properties. |
|---|
| 567 | </simpara> |
|---|
| 568 | |
|---|
| 569 | <para><emphasis role="bold">Allowed values:</emphasis> |
|---|
| 570 | <literal>true</literal>, <literal>false</literal>. This property |
|---|
| 571 | is specific to Unix systems. If an executable is built with |
|---|
| 572 | <code><hardcode-dll-paths>true</code>, the generated binary |
|---|
| 573 | will contain the list of all the paths to the used shared |
|---|
| 574 | libraries. As the result, the executable can be run without |
|---|
| 575 | changing system paths to shared libraries or installing the |
|---|
| 576 | libraries to system paths. This |
|---|
| 577 | <!-- you need an antecedent. This _what_? --> |
|---|
| 578 | is very convenient during |
|---|
| 579 | development. Plase see the <link |
|---|
| 580 | linkend="bbv2.faq.dll-path">FAQ entry</link> for details. |
|---|
| 581 | Note that on Mac OSX, the paths are unconditionally hardcoded by |
|---|
| 582 | the linker, and it's not possible to disable that behaviour. |
|---|
| 583 | </para> |
|---|
| 584 | </listitem></varlistentry> |
|---|
| 585 | |
|---|
| 586 | <varlistentry> |
|---|
| 587 | <term><literal>cflags</literal></term> |
|---|
| 588 | <term><literal>cxxflags</literal></term> |
|---|
| 589 | <term><literal>linkflags</literal></term> |
|---|
| 590 | |
|---|
| 591 | <listitem> |
|---|
| 592 | <simpara> |
|---|
| 593 | The value of those features is passed without modification to the |
|---|
| 594 | corresponding tools. For <code>cflags</code> that's both the C and C++ |
|---|
| 595 | compilers, for <code>cxxflags</code> that's the C++ compiler and for |
|---|
| 596 | <code>linkflags</code> that's the linker. The features are handy when |
|---|
| 597 | you're trying to do something special that cannot be achieved by |
|---|
| 598 | higher-level feature in Boost.Build. |
|---|
| 599 | </simpara> |
|---|
| 600 | </listitem> |
|---|
| 601 | </varlistentry> |
|---|
| 602 | |
|---|
| 603 | <varlistentry><term><literal>warnings</literal></term> |
|---|
| 604 | |
|---|
| 605 | <listitem> |
|---|
| 606 | <simpara> |
|---|
| 607 | The <code><warnings></code> feature controls the warning level of compilers. It has the following values: |
|---|
| 608 | <itemizedlist> |
|---|
| 609 | <listitem><para><code>off</code> - disables all warnings.</para></listitem> |
|---|
| 610 | <listitem><para><code>on</code> - enables default warning level for the tool.</para></listitem> |
|---|
| 611 | <listitem><para><code>all</code> - enables all warnings.</para></listitem> |
|---|
| 612 | </itemizedlist> |
|---|
| 613 | Default value is <code>all</code>. |
|---|
| 614 | </simpara> |
|---|
| 615 | </listitem> |
|---|
| 616 | </varlistentry> |
|---|
| 617 | |
|---|
| 618 | <varlistentry><term><literal>warnings-as-errors</literal></term> |
|---|
| 619 | |
|---|
| 620 | <listitem> |
|---|
| 621 | <simpara> |
|---|
| 622 | The <code><warnings-as-errors></code> makes it possible to treat warnings as errors and abort |
|---|
| 623 | compilation on a warning. The value <code>on</code> enables this behaviour. The default value is |
|---|
| 624 | <code>off</code>. |
|---|
| 625 | </simpara> |
|---|
| 626 | </listitem> |
|---|
| 627 | </varlistentry> |
|---|
| 628 | |
|---|
| 629 | <varlistentry><term><literal>build</literal></term> |
|---|
| 630 | |
|---|
| 631 | <listitem> |
|---|
| 632 | <para><emphasis role="bold">Allowed values:</emphasis> <literal>no</literal></para> |
|---|
| 633 | |
|---|
| 634 | <para> |
|---|
| 635 | The <code>build</code> feature is used to conditionally disable build of a target. If <code><build>no</code> |
|---|
| 636 | is in properties when building a target, build of that target is skipped. Combined with conditional requirements this |
|---|
| 637 | allows to skip building some target in configurations where the build is known to fail. |
|---|
| 638 | </para> |
|---|
| 639 | </listitem> |
|---|
| 640 | </varlistentry> |
|---|
| 641 | |
|---|
| 642 | <varlistentry><term><literal>tag</literal></term> |
|---|
| 643 | |
|---|
| 644 | <listitem><para>The <literal>tag</literal> feature is used to customize |
|---|
| 645 | the name of the generated files. The value should have the form: |
|---|
| 646 | <programlisting>@<replaceable>rulename</replaceable></programlisting> where |
|---|
| 647 | <replaceable>rulename</replaceable> should be a name of a rule with |
|---|
| 648 | the following signature: |
|---|
| 649 | <programlisting>rule tag ( name : type ? : property-set )</programlisting> |
|---|
| 650 | The rule will be called for each target with the default name computed |
|---|
| 651 | by Boost.Build, the type of the target, and property set. The rule |
|---|
| 652 | can either return a string that must be used as the name of the |
|---|
| 653 | target, or empty string, in which case the default name will be used. |
|---|
| 654 | </para> |
|---|
| 655 | |
|---|
| 656 | <para>Most typical use of the <literal>tag</literal> feature is |
|---|
| 657 | to encode build properties, or library version in library target names. |
|---|
| 658 | You should take care to return non-empty string from the tag rule |
|---|
| 659 | only for types you care about — otherwise, you might |
|---|
| 660 | end up modifying names of object files, generated header file and |
|---|
| 661 | other targets for which changing names does not make sense.</para> |
|---|
| 662 | </listitem> |
|---|
| 663 | |
|---|
| 664 | </varlistentry> |
|---|
| 665 | |
|---|
| 666 | <varlistentry><term><literal>debug-symbols</literal></term> |
|---|
| 667 | |
|---|
| 668 | <listitem> |
|---|
| 669 | <para><emphasis role="bold">Allowed values:</emphasis> <literal>on</literal>, <literal>off</literal>.</para> |
|---|
| 670 | |
|---|
| 671 | <para>The <literal>debug-symbols</literal> feature specifies if |
|---|
| 672 | produced object files, executables and libraries should include |
|---|
| 673 | debug information. |
|---|
| 674 | Typically, the value of this feature is implicitly set by the |
|---|
| 675 | <literal>variant</literal> feature, but it can be explicitly |
|---|
| 676 | specified by the user. The most common usage is to build |
|---|
| 677 | release variant with debugging information.</para> |
|---|
| 678 | </listitem> |
|---|
| 679 | </varlistentry> |
|---|
| 680 | |
|---|
| 681 | |
|---|
| 682 | |
|---|
| 683 | </variablelist> |
|---|
| 684 | </section> |
|---|
| 685 | |
|---|
| 686 | <section id="bbv2.reference.tools"> |
|---|
| 687 | <title>Builtin tools</title> |
|---|
| 688 | |
|---|
| 689 | <para>Boost.Build comes with support for a large number of C++ compilers, |
|---|
| 690 | and other tools. This section documents how to use those tools.</para> |
|---|
| 691 | |
|---|
| 692 | <para>Before using any tool, you must declare your intention, and possibly |
|---|
| 693 | specify additional information about tool's configuration. This is done |
|---|
| 694 | with the <code>using</code> rule, for example: |
|---|
| 695 | <programlisting> |
|---|
| 696 | using gcc ; |
|---|
| 697 | </programlisting> |
|---|
| 698 | additional parameters can be passed just like for other rules, for example: |
|---|
| 699 | <programlisting> |
|---|
| 700 | using gcc : 4.0 : g++-4.0 ; |
|---|
| 701 | </programlisting> |
|---|
| 702 | The options that can be passed to each tool will be documented in the |
|---|
| 703 | subsequent sections.</para> |
|---|
| 704 | |
|---|
| 705 | <section id="bbv2.reference.tools.compilers"> |
|---|
| 706 | |
|---|
| 707 | <title>C++ Compilers</title> |
|---|
| 708 | |
|---|
| 709 | <para>This section lists all Boost.Build modules that support C++ |
|---|
| 710 | compilers and documents how each one can be initialized.</para> |
|---|
| 711 | |
|---|
| 712 | <section id="bbv2.reference.tools.compiler.gcc"> |
|---|
| 713 | |
|---|
| 714 | <title>GNU C++</title> |
|---|
| 715 | |
|---|
| 716 | <para>The <code>gcc</code> module supports the |
|---|
| 717 | <ulink url="http://gcc.gnu.org">GNU C++ compiler</ulink> |
|---|
| 718 | on Linux, a number of Unix-like system including MacOS X, SunOS and |
|---|
| 719 | BeOS, and on Windows (either <ulink url="http://www.cygwin.com">Cygwin</ulink> |
|---|
| 720 | or <ulink url="http://www.mingw.org">MinGW</ulink>). |
|---|
| 721 | </para> |
|---|
| 722 | |
|---|
| 723 | <para>The <code>gcc</code> module is initialized using the following |
|---|
| 724 | syntax:</para> |
|---|
| 725 | <programlisting> |
|---|
| 726 | using gcc : &toolset_ops; ;</programlisting> |
|---|
| 727 | |
|---|
| 728 | &using_repeation; |
|---|
| 729 | |
|---|
| 730 | <!-- FIXME: mention everywhere what is the semantic |
|---|
| 731 | of version is --> |
|---|
| 732 | |
|---|
| 733 | <para> |
|---|
| 734 | If the version is not explicitly specified, it will be |
|---|
| 735 | automatically detected by running the compiler with the <code>-v</code> |
|---|
| 736 | option. If the command is not specified, the <command>g++</command> |
|---|
| 737 | binary will be searched in <envar>PATH</envar>.</para> |
|---|
| 738 | |
|---|
| 739 | &option_list_intro; |
|---|
| 740 | <variablelist> |
|---|
| 741 | |
|---|
| 742 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 743 | parse="xml"/> |
|---|
| 744 | |
|---|
| 745 | <xi:include href="fragments.xml#xpointer(id('root_option')/*)" |
|---|
| 746 | parse="xml"/> |
|---|
| 747 | |
|---|
| 748 | <varlistentry> |
|---|
| 749 | <term><literal>rc</literal></term> |
|---|
| 750 | |
|---|
| 751 | <listitem> |
|---|
| 752 | <para>Specifies the resource compiler command |
|---|
| 753 | that will be used with the version of gcc that is being |
|---|
| 754 | configured. This setting makes sense only for Windows and only |
|---|
| 755 | if you plan to use resource files. By |
|---|
| 756 | default <command>windres</command> will be used.</para> |
|---|
| 757 | </listitem> |
|---|
| 758 | </varlistentry> |
|---|
| 759 | |
|---|
| 760 | <varlistentry> |
|---|
| 761 | <term><literal>rc-type</literal></term> |
|---|
| 762 | |
|---|
| 763 | <listitem> |
|---|
| 764 | <para>Specifies the type of resource compiler. The value can |
|---|
| 765 | be either <code>windres</code> for msvc resource compiler, |
|---|
| 766 | or <code>rc</code> for borland's resource compiler.</para> |
|---|
| 767 | </listitem> |
|---|
| 768 | </varlistentry> |
|---|
| 769 | |
|---|
| 770 | </variablelist> |
|---|
| 771 | |
|---|
| 772 | </section> |
|---|
| 773 | |
|---|
| 774 | |
|---|
| 775 | <section id="bbv2.reference.tools.compiler.msvc"> |
|---|
| 776 | |
|---|
| 777 | <title>Microsoft Visual C++</title> |
|---|
| 778 | |
|---|
| 779 | <para>The <code>msvc</code> module supports the |
|---|
| 780 | <ulink url="http://msdn.microsoft.com/visualc/">Microsoft Visual |
|---|
| 781 | C++</ulink> command-line tools on Microsoft Windows. The supported |
|---|
| 782 | products and versions of command line tools are listed below:</para> |
|---|
| 783 | <itemizedlist> |
|---|
| 784 | <listitem><para>Visual Studio 2005—8.0</para></listitem> |
|---|
| 785 | <listitem><para>Visual Studio .NET 2003—7.1</para></listitem> |
|---|
| 786 | <listitem><para>Visual Studio .NET—7.0</para></listitem> |
|---|
| 787 | <listitem><para>Visual Studio 6.0, Service Pack 5—6.5</para></listitem> |
|---|
| 788 | </itemizedlist> |
|---|
| 789 | |
|---|
| 790 | <para>The <code>msvc</code> module is initialized using the following |
|---|
| 791 | syntax:</para> |
|---|
| 792 | <programlisting> |
|---|
| 793 | using msvc : &toolset_ops; ; |
|---|
| 794 | </programlisting> |
|---|
| 795 | &using_repeation; |
|---|
| 796 | <para>If the version is not explicitly specified, the most recent |
|---|
| 797 | version found in the registry will be used instead. If the |
|---|
| 798 | special value <code>all</code> is passed as the version, all |
|---|
| 799 | versions found in the registry will be configured. If a version is |
|---|
| 800 | specified, but the command is not, the compiler binary will be |
|---|
| 801 | searched in standard installation paths for that version, followed |
|---|
| 802 | by <envar>PATH</envar>. |
|---|
| 803 | </para> |
|---|
| 804 | |
|---|
| 805 | <para>The compiler command should be specified using forward slashes, |
|---|
| 806 | and quoted.</para> |
|---|
| 807 | |
|---|
| 808 | &option_list_intro; |
|---|
| 809 | <variablelist> |
|---|
| 810 | |
|---|
| 811 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 812 | parse="xml"/> |
|---|
| 813 | |
|---|
| 814 | <varlistentry> |
|---|
| 815 | <term><literal>setup</literal></term> |
|---|
| 816 | |
|---|
| 817 | <listitem><para>The filename of the environment setup scripts |
|---|
| 818 | to run before invoking the compiler. If not specified, |
|---|
| 819 | <command>vcvars32.bat</command> alongside the compiler binary |
|---|
| 820 | will be used.</para> |
|---|
| 821 | </listitem> |
|---|
| 822 | </varlistentry> |
|---|
| 823 | |
|---|
| 824 | <varlistentry> |
|---|
| 825 | <term><literal>compiler</literal></term> |
|---|
| 826 | |
|---|
| 827 | <listitem><para>The command that compiles C and C++ sources. |
|---|
| 828 | If not specified, <command>cl</command> will be used. The |
|---|
| 829 | command will be invoked after the setup script was |
|---|
| 830 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 831 | </listitem> |
|---|
| 832 | </varlistentry> |
|---|
| 833 | |
|---|
| 834 | <varlistentry> |
|---|
| 835 | <term><literal>linker</literal></term> |
|---|
| 836 | |
|---|
| 837 | <listitem><para>The command that links executables and dynamic |
|---|
| 838 | libraries. |
|---|
| 839 | If not specified, <command>link</command> will be used. The |
|---|
| 840 | command will be invoked after the setup script was |
|---|
| 841 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 842 | </listitem> |
|---|
| 843 | </varlistentry> |
|---|
| 844 | |
|---|
| 845 | <varlistentry> |
|---|
| 846 | <term><literal>assembler</literal></term> |
|---|
| 847 | |
|---|
| 848 | <listitem><para>The command that compiles assember files. |
|---|
| 849 | If not specified, <command>cl</command> will be used. The |
|---|
| 850 | command will be invoked after the setup script was |
|---|
| 851 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 852 | </listitem> |
|---|
| 853 | </varlistentry> |
|---|
| 854 | |
|---|
| 855 | <varlistentry> |
|---|
| 856 | <term><literal>resource-compiler</literal></term> |
|---|
| 857 | |
|---|
| 858 | <listitem><para>The command that compiles resource files. |
|---|
| 859 | If not specified, <command>rc</command> will be used. The |
|---|
| 860 | command will be invoked after the setup script was |
|---|
| 861 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 862 | </listitem> |
|---|
| 863 | </varlistentry> |
|---|
| 864 | |
|---|
| 865 | <varlistentry> |
|---|
| 866 | <term><literal>idl-compiler</literal></term> |
|---|
| 867 | |
|---|
| 868 | <listitem><para>The command that compiles Microsoft COM |
|---|
| 869 | interface definition files. |
|---|
| 870 | If not specified, <command>midl</command> will be used. The |
|---|
| 871 | command will be invoked after the setup script was |
|---|
| 872 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 873 | </listitem> |
|---|
| 874 | </varlistentry> |
|---|
| 875 | |
|---|
| 876 | <varlistentry> |
|---|
| 877 | <term><literal>mc-compiler</literal></term> |
|---|
| 878 | |
|---|
| 879 | <listitem><para>The command that compiles Microsoft message |
|---|
| 880 | catalog files. |
|---|
| 881 | If not specified, <command>mt</command> will be used. The |
|---|
| 882 | command will be invoked after the setup script was |
|---|
| 883 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 884 | </listitem> |
|---|
| 885 | </varlistentry> |
|---|
| 886 | |
|---|
| 887 | |
|---|
| 888 | </variablelist> |
|---|
| 889 | |
|---|
| 890 | </section> |
|---|
| 891 | |
|---|
| 892 | <section id="bbv2.reference.tools.compiler.intel"> |
|---|
| 893 | |
|---|
| 894 | <title>Intel C++</title> |
|---|
| 895 | |
|---|
| 896 | <para>The <code>intel-linux</code> and <code>intel-win</code> modules |
|---|
| 897 | support the Intel C++ command-line compiler—the <ulink url= |
|---|
| 898 | "http://www.intel.com/software/products/compilers/clin/index.htm">Linux</ulink> |
|---|
| 899 | and <ulink url= |
|---|
| 900 | "http://www.intel.com/cd/software/products/asmo-na/eng/compilers/284527.htm"> |
|---|
| 901 | Windows</ulink> versions respectively.</para> |
|---|
| 902 | |
|---|
| 903 | <para>The module is initialized using the following syntax:</para> |
|---|
| 904 | <programlisting> |
|---|
| 905 | using intel-linux : &toolset_ops; ;</programlisting> |
|---|
| 906 | <para>or</para> |
|---|
| 907 | <programlisting> |
|---|
| 908 | using intel-win : &toolset_ops; ;</programlisting> |
|---|
| 909 | <para>respectively.</para> |
|---|
| 910 | |
|---|
| 911 | &using_repeation; |
|---|
| 912 | |
|---|
| 913 | <para> |
|---|
| 914 | If compiler command is not specified, then Boost.Build will |
|---|
| 915 | look in <envar>PATH</envar> for an executable <command>icpc</command> |
|---|
| 916 | (on Linux), or <command>icc.exe</command> (on Windows). |
|---|
| 917 | </para> |
|---|
| 918 | |
|---|
| 919 | &option_list_intro; |
|---|
| 920 | <variablelist> |
|---|
| 921 | |
|---|
| 922 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 923 | parse="xml"/> |
|---|
| 924 | |
|---|
| 925 | </variablelist> |
|---|
| 926 | |
|---|
| 927 | <para>The Linux version supports the following additional options:</para> |
|---|
| 928 | <variablelist> |
|---|
| 929 | |
|---|
| 930 | <xi:include href="fragments.xml#xpointer(id('root_option')/*)" |
|---|
| 931 | parse="xml"/> |
|---|
| 932 | |
|---|
| 933 | </variablelist> |
|---|
| 934 | |
|---|
| 935 | <!-- the compatibility option appears to be messed up --> |
|---|
| 936 | |
|---|
| 937 | </section> |
|---|
| 938 | |
|---|
| 939 | <section id="bbv2.reference.tools.compiler.acc"> |
|---|
| 940 | |
|---|
| 941 | <title>HP aC++ compiler</title> |
|---|
| 942 | |
|---|
| 943 | <para>The <code>acc</code> module supports the |
|---|
| 944 | <ulink url="http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,1740,00.html">HP aC++ compiler</ulink> |
|---|
| 945 | for the HP-UX operating system.</para> |
|---|
| 946 | |
|---|
| 947 | <para>The module is initialized using the following |
|---|
| 948 | syntax:</para> |
|---|
| 949 | <programlisting> |
|---|
| 950 | using acc ;</programlisting> |
|---|
| 951 | |
|---|
| 952 | <para>There are no configuration options. The |
|---|
| 953 | compiler will always be invoked as <command>aCC</command> and should |
|---|
| 954 | be in <envar>PATH</envar>.</para> |
|---|
| 955 | |
|---|
| 956 | </section> |
|---|
| 957 | |
|---|
| 958 | <section id="bbv2.reference.tools.compiler.borland"> |
|---|
| 959 | |
|---|
| 960 | <title>Borland C++ Compiler</title> |
|---|
| 961 | |
|---|
| 962 | <para>The <code>borland</code> module supports the command line |
|---|
| 963 | C++ compiler included in |
|---|
| 964 | <ulink url="http://www.borland.com/us/products/cbuilder/index.html">C++ Builder 2006</ulink> |
|---|
| 965 | product and earlier version of it, running on Microsoft Windows.</para> |
|---|
| 966 | |
|---|
| 967 | <para>The supported products are listed below. The version reported |
|---|
| 968 | by the command lines tools is also listed for reference.:</para> |
|---|
| 969 | <itemizedlist> |
|---|
| 970 | <listitem><para>C++ Builder 2006—5.8.2</para></listitem> |
|---|
| 971 | <listitem><para>CBuilderX—5.6.5, 5.6.4 (depending on release)</para></listitem> |
|---|
| 972 | <listitem><para>CBuilder6—5.6.4</para></listitem> |
|---|
| 973 | <listitem><para>Free command line tools—5.5.1</para></listitem> |
|---|
| 974 | </itemizedlist> |
|---|
| 975 | |
|---|
| 976 | <para>The module is initialized using the following syntax:</para> |
|---|
| 977 | <programlisting> |
|---|
| 978 | using borland : &toolset_ops; ;</programlisting> |
|---|
| 979 | |
|---|
| 980 | &using_repeation; |
|---|
| 981 | |
|---|
| 982 | <para>If the command is not specified, Boost.Build will search for |
|---|
| 983 | a binary named <command>bcc32</command> in <envar>PATH</envar>.</para> |
|---|
| 984 | |
|---|
| 985 | &option_list_intro; |
|---|
| 986 | <variablelist> |
|---|
| 987 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 988 | parse="xml"/> |
|---|
| 989 | </variablelist> |
|---|
| 990 | |
|---|
| 991 | </section> |
|---|
| 992 | |
|---|
| 993 | <section id="bbv2.reference.tools.compiler.como"> |
|---|
| 994 | |
|---|
| 995 | <title>Comeau C/C++ Compiler</title> |
|---|
| 996 | |
|---|
| 997 | <para>The <code>como-linux</code> and the <code>como-win</code> |
|---|
| 998 | modules supports the |
|---|
| 999 | <ulink url="http://www.comeaucomputing.com/">Comeau C/C++ Compiler</ulink> |
|---|
| 1000 | on Linux and Windows respectively.</para> |
|---|
| 1001 | |
|---|
| 1002 | <para>The module is initialized using the following syntax:</para> |
|---|
| 1003 | <programlisting> |
|---|
| 1004 | using como-linux : &toolset_ops; ;</programlisting> |
|---|
| 1005 | |
|---|
| 1006 | &using_repeation; |
|---|
| 1007 | |
|---|
| 1008 | <para>If the command is not specified, Boost.Build will search for |
|---|
| 1009 | a binary named <command>como</command> in |
|---|
| 1010 | <envar>PATH</envar>.</para> |
|---|
| 1011 | |
|---|
| 1012 | &option_list_intro; |
|---|
| 1013 | <variablelist> |
|---|
| 1014 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 1015 | parse="xml"/> |
|---|
| 1016 | </variablelist> |
|---|
| 1017 | |
|---|
| 1018 | <para>Before using the windows version of the compiler, |
|---|
| 1019 | you need to setup necessary environment variables per compiler's |
|---|
| 1020 | documentation. In particular, the <envar>COMO_XXX_INCLUDE</envar> |
|---|
| 1021 | variable should be set, where <envar>XXX</envar> corresponds to the |
|---|
| 1022 | used backend C compiler.</para> |
|---|
| 1023 | |
|---|
| 1024 | </section> |
|---|
| 1025 | |
|---|
| 1026 | <section id="bbv2.reference.tools.compiler.cw"> |
|---|
| 1027 | |
|---|
| 1028 | <title>Code Warrior</title> |
|---|
| 1029 | |
|---|
| 1030 | <para>The <code>cw</code> module support CodeWarrior compiler, |
|---|
| 1031 | originally produced by Metrowerks and presently developed |
|---|
| 1032 | by Freescale. Boost.Build supports only the versions of the compiler |
|---|
| 1033 | that target x86 processors. All such versions were released by |
|---|
| 1034 | Metrowerks before aquisition and are not sold any longer. |
|---|
| 1035 | The last version known to work is 9.4</para> |
|---|
| 1036 | |
|---|
| 1037 | <para>The module is initialized using the following syntax:</para> |
|---|
| 1038 | <programlisting> |
|---|
| 1039 | using cw : &toolset_ops; ;</programlisting> |
|---|
| 1040 | |
|---|
| 1041 | &using_repeation; |
|---|
| 1042 | |
|---|
| 1043 | <para>If the command is not specified, Boost.Build will search for |
|---|
| 1044 | a binary named <command>mwcc</command> in default installation |
|---|
| 1045 | paths and in <envar>PATH</envar>.</para> |
|---|
| 1046 | |
|---|
| 1047 | &option_list_intro; |
|---|
| 1048 | <variablelist> |
|---|
| 1049 | |
|---|
| 1050 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 1051 | parse="xml"/> |
|---|
| 1052 | |
|---|
| 1053 | <xi:include href="fragments.xml#xpointer(id('root_option')/*)" |
|---|
| 1054 | parse="xml"/> |
|---|
| 1055 | |
|---|
| 1056 | <varlistentry> |
|---|
| 1057 | <term><literal>setup</literal></term> |
|---|
| 1058 | |
|---|
| 1059 | <listitem><para>The command that sets up environment variables |
|---|
| 1060 | prior to invoking the compiler. If not specified, |
|---|
| 1061 | <command>cwenv.bat</command> alongside the compiler binary |
|---|
| 1062 | will be used.</para> |
|---|
| 1063 | </listitem> |
|---|
| 1064 | </varlistentry> |
|---|
| 1065 | |
|---|
| 1066 | |
|---|
| 1067 | <varlistentry> |
|---|
| 1068 | <term><literal>compiler</literal></term> |
|---|
| 1069 | |
|---|
| 1070 | <listitem><para>The command that compiles C and C++ sources. |
|---|
| 1071 | If not specified, <command>mwcc</command> will be used. The |
|---|
| 1072 | command will be invoked after the setup script was |
|---|
| 1073 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 1074 | </listitem> |
|---|
| 1075 | </varlistentry> |
|---|
| 1076 | |
|---|
| 1077 | <varlistentry> |
|---|
| 1078 | <term><literal>linker</literal></term> |
|---|
| 1079 | |
|---|
| 1080 | <listitem><para>The command that links executables and dynamic |
|---|
| 1081 | libraries. |
|---|
| 1082 | If not specified, <command>mwld</command> will be used. The |
|---|
| 1083 | command will be invoked after the setup script was |
|---|
| 1084 | executed and adjusted the <envar>PATH</envar> variable.</para> |
|---|
| 1085 | </listitem> |
|---|
| 1086 | </varlistentry> |
|---|
| 1087 | |
|---|
| 1088 | </variablelist> |
|---|
| 1089 | |
|---|
| 1090 | </section> |
|---|
| 1091 | |
|---|
| 1092 | <section id="bbv2.reference.tools.compiler.dmc"> |
|---|
| 1093 | |
|---|
| 1094 | <title>Digital Mars C/C++ Compiler</title> |
|---|
| 1095 | |
|---|
| 1096 | <para>The <code>dmc</code> module supports the |
|---|
| 1097 | <ulink url="http://www.digitalmars.com/">Digital Mars C++ compiler.</ulink> |
|---|
| 1098 | </para> |
|---|
| 1099 | |
|---|
| 1100 | <para>The module is initialized using the following syntax:</para> |
|---|
| 1101 | <programlisting> |
|---|
| 1102 | using dmc : &toolset_ops; ;</programlisting> |
|---|
| 1103 | |
|---|
| 1104 | &using_repeation; |
|---|
| 1105 | |
|---|
| 1106 | <para>If the command is not specified, Boost.Build will search for |
|---|
| 1107 | a binary named <command>como</command> in |
|---|
| 1108 | <envar>PATH</envar>.</para> |
|---|
| 1109 | |
|---|
| 1110 | &option_list_intro; |
|---|
| 1111 | <variablelist> |
|---|
| 1112 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 1113 | parse="xml"/> |
|---|
| 1114 | </variablelist> |
|---|
| 1115 | |
|---|
| 1116 | </section> |
|---|
| 1117 | |
|---|
| 1118 | <section id="bbv2.reference.tools.compiler.hp_cxx"> |
|---|
| 1119 | |
|---|
| 1120 | <title>HP C++ Compiler for Tru64 Unix</title> |
|---|
| 1121 | |
|---|
| 1122 | <para>The <code>hp_cxx</code> modules supports the |
|---|
| 1123 | <ulink url="http://h30097.www3.hp.com/cplus/?jumpid=reg_R1002_USEN"> |
|---|
| 1124 | HP C++ Compiler</ulink> for Tru64 Unix.</para> |
|---|
| 1125 | |
|---|
| 1126 | <para>The module is initialized using the following syntax:</para> |
|---|
| 1127 | <programlisting> |
|---|
| 1128 | using hp_cxx : &toolset_ops; ;</programlisting> |
|---|
| 1129 | |
|---|
| 1130 | &using_repeation; |
|---|
| 1131 | |
|---|
| 1132 | <para>If the command is not specified, Boost.Build will search for |
|---|
| 1133 | a binary named <command>hp_cxx</command> in <envar>PATH</envar>.</para> |
|---|
| 1134 | |
|---|
| 1135 | &option_list_intro; |
|---|
| 1136 | <variablelist> |
|---|
| 1137 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 1138 | parse="xml"/> |
|---|
| 1139 | </variablelist> |
|---|
| 1140 | |
|---|
| 1141 | </section> |
|---|
| 1142 | |
|---|
| 1143 | <section id="bbv2.reference.tools.compiler.sun"> |
|---|
| 1144 | |
|---|
| 1145 | <title>Sun Studio</title> |
|---|
| 1146 | |
|---|
| 1147 | <para>The <code>sun</code> module supports the |
|---|
| 1148 | <ulink url="http://developers.sun.com/sunstudio/index.jsp"> |
|---|
| 1149 | Sun Studio</ulink> C++ compilers for the Solaris OS.</para> |
|---|
| 1150 | |
|---|
| 1151 | <para>The module is initialized using the following syntax:</para> |
|---|
| 1152 | <programlisting> |
|---|
| 1153 | using sun : &toolset_ops; ;</programlisting> |
|---|
| 1154 | |
|---|
| 1155 | &using_repeation; |
|---|
| 1156 | |
|---|
| 1157 | <para>If the command is not specified, Boost.Build will search for |
|---|
| 1158 | a binary named <command>CC</command> |
|---|
| 1159 | in <filename>/opt/SUNWspro/bin</filename> and in |
|---|
| 1160 | <envar>PATH</envar>.</para> |
|---|
| 1161 | |
|---|
| 1162 | <para>When using this compiler on complex C++ code, such as the |
|---|
| 1163 | <ulink url="http://boost.org">Boost C++ library</ulink>, it is |
|---|
| 1164 | recommended to specify the following options when intializing the |
|---|
| 1165 | <code>sun</code> module: |
|---|
| 1166 | <screen> |
|---|
| 1167 | -library=stlport4 -features=tmplife -features=tmplrefstatic |
|---|
| 1168 | </screen> See the <ulink url="http://blogs.sun.com/sga/entry/command_line_options"> |
|---|
| 1169 | Sun C++ Frontend Tales</ulink> for details.</para> |
|---|
| 1170 | |
|---|
| 1171 | &option_list_intro; |
|---|
| 1172 | <variablelist> |
|---|
| 1173 | <xi:include href="fragments.xml#xpointer(id('common_options')/*)" |
|---|
| 1174 | parse="xml"/> |
|---|
| 1175 | </variablelist> |
|---|
| 1176 | |
|---|
| 1177 | </section> |
|---|
| 1178 | |
|---|
| 1179 | <section id="bbv2.reference.tools.compiler.vacpp"> |
|---|
| 1180 | |
|---|
| 1181 | <title>IBM Visual Age</title> |
|---|
| 1182 | <para>The <code>vacpp</code> module supports the |
|---|
| 1183 | <ulink url="http://www.ibm.com/software/ad/vacpp">IBM Visual |
|---|
| 1184 | Age</ulink> C++ Compiler, for the AIX operating system. Versions |
|---|
| 1185 | 7.1 and 8.0 are known to work.</para> |
|---|
| 1186 | |
|---|
| 1187 | <para>The module is initialized using the following |
|---|
| 1188 | syntax:</para> |
|---|
| 1189 | <programlisting> |
|---|
| 1190 | using vacpp ;</programlisting> |
|---|
| 1191 | |
|---|
| 1192 | <para>The module does not accept any initialization options. The |
|---|
| 1193 | compiler should be installed in the <filename>/usr/vacpp/bin</filename> |
|---|
| 1194 | directory.</para> |
|---|
| 1195 | |
|---|
| 1196 | <para>Later versions of Visual Age are known as XL C/C++. They |
|---|
| 1197 | were not tested with the the <code>vacpp</code> module.</para> |
|---|
| 1198 | |
|---|
| 1199 | </section> |
|---|
| 1200 | |
|---|
| 1201 | |
|---|
| 1202 | </section> |
|---|
| 1203 | |
|---|
| 1204 | </section> |
|---|
| 1205 | |
|---|
| 1206 | <section id="bbv2.reference.buildprocess"> |
|---|
| 1207 | <title>Build process</title> |
|---|
| 1208 | |
|---|
| 1209 | <para>The general overview of the build process was given in the |
|---|
| 1210 | <link linkend="bbv2.advanced.build_process">user documentation</link>. |
|---|
| 1211 | This section provides additional details, and some specific rules. |
|---|
| 1212 | </para> |
|---|
| 1213 | |
|---|
| 1214 | <para>To recap, building a target with specific properties includes the |
|---|
| 1215 | following steps: |
|---|
| 1216 | <orderedlist> |
|---|
| 1217 | |
|---|
| 1218 | <listitem><para>applying default build,</para></listitem> |
|---|
| 1219 | |
|---|
| 1220 | <listitem><para>selecting the main target alternative to use, |
|---|
| 1221 | </para></listitem> |
|---|
| 1222 | |
|---|
| 1223 | <listitem><para>determining "common" properties,</para></listitem> |
|---|
| 1224 | |
|---|
| 1225 | <listitem><para>building targets referred by the sources list and |
|---|
| 1226 | dependency properties,</para></listitem> |
|---|
| 1227 | |
|---|
| 1228 | <listitem><para>adding the usage requirements produces when building |
|---|
| 1229 | dependencies to the "common" properties,</para></listitem> |
|---|
| 1230 | |
|---|
| 1231 | <listitem><para>building the target using generators,</para></listitem> |
|---|
| 1232 | |
|---|
| 1233 | <listitem><para>computing the usage requirements to be returned.</para></listitem> |
|---|
| 1234 | |
|---|
| 1235 | </orderedlist> |
|---|
| 1236 | </para> |
|---|
| 1237 | |
|---|
| 1238 | <section id="bbv2.reference.buildprocess.alternatives"> |
|---|
| 1239 | <title>Alternative selection</title> |
|---|
| 1240 | |
|---|
| 1241 | <para>When there are several alternatives, one of them must be |
|---|
| 1242 | selected. The process is as follows:</para> |
|---|
| 1243 | |
|---|
| 1244 | <orderedlist> |
|---|
| 1245 | <listitem> |
|---|
| 1246 | <simpara> |
|---|
| 1247 | For each alternative <emphasis>condition</emphasis> is defined |
|---|
| 1248 | as the set of base properies in requirements. [Note: it might be |
|---|
| 1249 | better to specify the condition explicitly, as in |
|---|
| 1250 | conditional requirements]. |
|---|
| 1251 | </simpara> |
|---|
| 1252 | </listitem> |
|---|
| 1253 | |
|---|
| 1254 | <listitem> |
|---|
| 1255 | <simpara> |
|---|
| 1256 | An alternative is viable only if all properties in condition |
|---|
| 1257 | are present in build request. |
|---|
| 1258 | </simpara> |
|---|
| 1259 | </listitem> |
|---|
| 1260 | |
|---|
| 1261 | <listitem> |
|---|
| 1262 | <simpara> |
|---|
| 1263 | If there's one viable alternative, it's choosen. Otherwise, |
|---|
| 1264 | an attempt is made to find one best alternative. An alternative |
|---|
| 1265 | a is better than another alternative b, iff the set of properties |
|---|
| 1266 | in b's condition is a strict subset of the set of properities of |
|---|
| 1267 | 'a's condition. If there's one viable alternative, which is |
|---|
| 1268 | better than all others, it's selected. Otherwise, an error is |
|---|
| 1269 | reported. |
|---|
| 1270 | </simpara> |
|---|
| 1271 | </listitem> |
|---|
| 1272 | </orderedlist> |
|---|
| 1273 | |
|---|
| 1274 | </section> |
|---|
| 1275 | |
|---|
| 1276 | <section id="bbv2.reference.buildprocess.common"> |
|---|
| 1277 | <title>Determining common properties</title> |
|---|
| 1278 | |
|---|
| 1279 | <para>The "common" properties is a somewhat artificial term. Those are |
|---|
| 1280 | the intermediate property set from which both the build request for |
|---|
| 1281 | dependencies and properties for building the target are derived. |
|---|
| 1282 | </para> |
|---|
| 1283 | |
|---|
| 1284 | <para>Since default build and alternatives are already handled, we have |
|---|
| 1285 | only two inputs: build requests and requirements. Here are the rules |
|---|
| 1286 | about common properties. |
|---|
| 1287 | </para> |
|---|
| 1288 | |
|---|
| 1289 | <orderedlist> |
|---|
| 1290 | <listitem><para>Non-free feature can have only one |
|---|
| 1291 | value</para></listitem> |
|---|
| 1292 | |
|---|
| 1293 | <listitem><para>A non-conditional property in requirement in always |
|---|
| 1294 | present in common properties.</para></listitem> |
|---|
| 1295 | |
|---|
| 1296 | <listitem><para>A property in build request is present in |
|---|
| 1297 | common properties, unless (2) tells otherwise.</para></listitem> |
|---|
| 1298 | |
|---|
| 1299 | <listitem><para>If either build request, or requirements (non-conditional |
|---|
| 1300 | or conditional) include an expandable property (either composite, |
|---|
| 1301 | or property with specified subfeature value), the behaviour is |
|---|
| 1302 | equivalent to explicitly adding all expanded properties to build |
|---|
| 1303 | request or requirements.</para></listitem> |
|---|
| 1304 | |
|---|
| 1305 | <listitem><para>If requirements include a conditional property, and |
|---|
| 1306 | condiiton of this property is true in context of common |
|---|
| 1307 | properties, then the conditional property should be in common |
|---|
| 1308 | properties as well.</para></listitem> |
|---|
| 1309 | |
|---|
| 1310 | <listitem><para>If no value for a feature is given by other rules |
|---|
| 1311 | here, it has default value in common properties.</para></listitem> |
|---|
| 1312 | </orderedlist> |
|---|
| 1313 | |
|---|
| 1314 | <para>Those rules are declarative, they don't specify how to compute the |
|---|
| 1315 | common properties. However, they provide enough information for the |
|---|
| 1316 | user. The important point is the handling of conditional |
|---|
| 1317 | requirements. The condition can be satisfied either by property in |
|---|
| 1318 | build request, by non-conditional requirements, or even by another |
|---|
| 1319 | conditional property. For example, the following example works as |
|---|
| 1320 | expected: |
|---|
| 1321 | <programlisting> |
|---|
| 1322 | exe a : a.cpp |
|---|
| 1323 | : <toolset>gcc:<variant>release |
|---|
| 1324 | <variant>release:<define>FOO ; |
|---|
| 1325 | </programlisting> |
|---|
| 1326 | </para> |
|---|
| 1327 | |
|---|
| 1328 | </section> |
|---|
| 1329 | |
|---|
| 1330 | </section> |
|---|
| 1331 | |
|---|
| 1332 | |
|---|
| 1333 | |
|---|
| 1334 | <section id="bbv2.reference.definitions"> |
|---|
| 1335 | |
|---|
| 1336 | <title>Definitions</title> |
|---|
| 1337 | |
|---|
| 1338 | <section id="bbv2.reference.features"> |
|---|
| 1339 | <title>Features and properties</title> |
|---|
| 1340 | |
|---|
| 1341 | <para>A <emphasis>feature</emphasis> is a normalized (toolset-independent) |
|---|
| 1342 | aspect of a build configuration, such as whether inlining is |
|---|
| 1343 | enabled. Feature names may not contain the '<literal>></literal>' |
|---|
| 1344 | character.</para> |
|---|
| 1345 | |
|---|
| 1346 | <!-- |
|---|
| 1347 | And what about dash? |
|---|
| 1348 | --> |
|---|
| 1349 | |
|---|
| 1350 | <para>Each feature in a build configuration has one or more |
|---|
| 1351 | associated <emphasis>value</emphasis>s. Feature values for non-free features |
|---|
| 1352 | may not contain the '<literal><</literal>', '<literal>:</literal>', or |
|---|
| 1353 | '<literal>=</literal>' characters. Feature values for free features may not |
|---|
| 1354 | contain the '<literal><</literal>' character.</para> |
|---|
| 1355 | |
|---|
| 1356 | <para>A <emphasis>property</emphasis> is a (feature,value) pair, expressed as |
|---|
| 1357 | <feature>value.</para> |
|---|
| 1358 | |
|---|
| 1359 | <para>A <emphasis>subfeature</emphasis> is a feature that only exists in the |
|---|
| 1360 | presence of its parent feature, and whose identity can be derived |
|---|
| 1361 | (in the context of its parent) from its value. A subfeature's |
|---|
| 1362 | parent can never be another subfeature. Thus, features and their |
|---|
| 1363 | subfeatures form a two-level hierarchy.</para> |
|---|
| 1364 | |
|---|
| 1365 | <para>A <emphasis>value-string</emphasis> for a feature <emphasis role="bold">F</emphasis> is a string of |
|---|
| 1366 | the form |
|---|
| 1367 | <literal>value-subvalue1-subvalue2</literal>...<literal>-subvalueN</literal>, where |
|---|
| 1368 | <literal>value</literal> is a legal value for <emphasis role="bold">F</emphasis> and |
|---|
| 1369 | <literal>subvalue1</literal>...<literal>subvalueN</literal> are legal values of some |
|---|
| 1370 | of <emphasis role="bold">F</emphasis>'s subfeatures. For example, the properties |
|---|
| 1371 | <literal><toolset>gcc <toolset-version>3.0.1</literal> can be |
|---|
| 1372 | expressed more conscisely using a value-string, as |
|---|
| 1373 | <literal><toolset>gcc-3.0.1</literal>.</para> |
|---|
| 1374 | |
|---|
| 1375 | <para>A <emphasis>property set</emphasis> is a set of properties (i.e. a |
|---|
| 1376 | collection without duplicates), for instance: |
|---|
| 1377 | <literal><toolset>gcc <runtime-link>static</literal>.</para> |
|---|
| 1378 | |
|---|
| 1379 | <para>A <emphasis>property path</emphasis> is a property set whose elements have |
|---|
| 1380 | been joined into a single string separated by slashes. A property |
|---|
| 1381 | path representation of the previous example would be |
|---|
| 1382 | <literal><toolset>gcc/<runtime-link>static</literal>.</para> |
|---|
| 1383 | |
|---|
| 1384 | <para>A <emphasis>build specification</emphasis> is a property set that fully |
|---|
| 1385 | describes the set of features used to build a target.</para> |
|---|
| 1386 | |
|---|
| 1387 | <section id="bbv2.reference.features.validity"> |
|---|
| 1388 | <title>Property Validity</title> |
|---|
| 1389 | |
|---|
| 1390 | <para> |
|---|
| 1391 | For <link linkend= |
|---|
| 1392 | "bbv2.reference.features.attributes.free">free</link> |
|---|
| 1393 | features, all values are valid. For all other features, |
|---|
| 1394 | the valid values are explicitly specified, and the build |
|---|
| 1395 | system will report an error for the use of an invalid |
|---|
| 1396 | feature-value. Subproperty validity may be restricted so |
|---|
| 1397 | that certain values are valid only in the presence of |
|---|
| 1398 | certain other subproperties. For example, it is possible |
|---|
| 1399 | to specify that the <code><gcc-target>mingw</code> |
|---|
| 1400 | property is only valid in the presence of |
|---|
| 1401 | <code><gcc-version>2.95.2</code>. |
|---|
| 1402 | </para> |
|---|
| 1403 | |
|---|
| 1404 | </section> |
|---|
| 1405 | <section id="bbv2.reference.features.attributes"> |
|---|
| 1406 | <title>Feature Attributes</title> |
|---|
| 1407 | |
|---|
| 1408 | <para>Each feature has a collection of zero or more of the following |
|---|
| 1409 | attributes. Feature attributes are low-level descriptions of how the |
|---|
| 1410 | build system should interpret a feature's values when they appear in |
|---|
| 1411 | a build request. We also refer to the attributes of properties, so |
|---|
| 1412 | that an <emphasis>incidental</emphasis> property, for example, is |
|---|
| 1413 | one whose feature has the <emphasis>incidental</emphasis> |
|---|
| 1414 | attribute.</para> |
|---|
| 1415 | |
|---|
| 1416 | <itemizedlist> |
|---|
| 1417 | <listitem> |
|---|
| 1418 | <para><emphasis>incidental</emphasis></para> |
|---|
| 1419 | |
|---|
| 1420 | <para>Incidental features are assumed not to affect build |
|---|
| 1421 | products at all. As a consequence, the build system may use |
|---|
| 1422 | the same file for targets whose build specification differs |
|---|
| 1423 | only in incidental features. A feature that controls a |
|---|
| 1424 | compiler's warning level is one example of a likely |
|---|
| 1425 | incidental feature.</para> |
|---|
| 1426 | |
|---|
| 1427 | <para>Non-incidental features are assumed to affect build |
|---|
| 1428 | products, so the files for targets whose build specification |
|---|
| 1429 | differs in non-incidental features are placed in different |
|---|
| 1430 | directories as described in "target paths" below. [ where? ] |
|---|
| 1431 | </para> |
|---|
| 1432 | </listitem> |
|---|
| 1433 | |
|---|
| 1434 | <listitem> |
|---|
| 1435 | <para> |
|---|
| 1436 | <anchor id="bbv2.reference.features.attributes.propagated"/> |
|---|
| 1437 | <emphasis>propagated</emphasis> |
|---|
| 1438 | </para> |
|---|
| 1439 | |
|---|
| 1440 | <para>Features of this kind are |
|---|
| 1441 | propagated to dependencies. That is, if a <link linkend= |
|---|
| 1442 | "bbv2.advanced.targets.main">main target</link> is built using a |
|---|
| 1443 | propagated |
|---|
| 1444 | property, the build systems attempts to use the same property |
|---|
| 1445 | when building any of its dependencies as part of that main |
|---|
| 1446 | target. For instance, when an optimized exectuable is |
|---|
| 1447 | requested, one usually wants it to be linked with optimized |
|---|
| 1448 | libraries. Thus, the <literal><optimization></literal> feature is |
|---|
| 1449 | propagated.</para> |
|---|
| 1450 | </listitem> |
|---|
| 1451 | |
|---|
| 1452 | <listitem> |
|---|
| 1453 | <para> |
|---|
| 1454 | <anchor id="bbv2.reference.features.attributes.free"/> |
|---|
| 1455 | <emphasis>free</emphasis> |
|---|
| 1456 | </para> |
|---|
| 1457 | |
|---|
| 1458 | <para>Most features have a finite set of allowed values, and can |
|---|
| 1459 | only take on a single value from that set in a given build |
|---|
| 1460 | specification. Free features, on the other hand, can have |
|---|
| 1461 | several values at a time and each value can be an arbitrary |
|---|
| 1462 | string. For example, it is possible to have several |
|---|
| 1463 | preprocessor symbols defined simultaneously:</para> |
|---|
| 1464 | |
|---|
| 1465 | <programlisting> |
|---|
| 1466 | <define>NDEBUG=1 <define>HAS_CONFIG_H=1 |
|---|
| 1467 | </programlisting> |
|---|
| 1468 | |
|---|
| 1469 | </listitem> |
|---|
| 1470 | |
|---|
| 1471 | <listitem> |
|---|
| 1472 | <para><emphasis>optional</emphasis></para> |
|---|
| 1473 | |
|---|
| 1474 | <para>An optional feature is a feature that is not required to |
|---|
| 1475 | appear in a build specification. Every non-optional non-free |
|---|
| 1476 | feature has a default value that is used when a value for |
|---|
| 1477 | the feature is not otherwise specified, either in a target's |
|---|
| 1478 | requirements or in the user's build request. [A feature's |
|---|
| 1479 | default value is given by the first value listed in the |
|---|
| 1480 | feature's declaration. -- move this elsewhere - dwa]</para> |
|---|
| 1481 | </listitem> |
|---|
| 1482 | |
|---|
| 1483 | <listitem> |
|---|
| 1484 | <para><emphasis>symmetric</emphasis></para> |
|---|
| 1485 | |
|---|
| 1486 | <para>A symmetric feature's default value is not automatically |
|---|
| 1487 | included in <link linkend= |
|---|
| 1488 | "bbv2.reference.variants">build variants</link>. Normally |
|---|
| 1489 | a feature only generates a subvariant directory when its |
|---|
| 1490 | value differs from the value specified by the build variant, |
|---|
| 1491 | leading to an assymmetric subvariant directory structure for |
|---|
| 1492 | certain values of the feature. A symmetric feature, when |
|---|
| 1493 | relevant to the toolset, always generates a corresponding |
|---|
| 1494 | subvariant directory.</para> |
|---|
| 1495 | </listitem> |
|---|
| 1496 | |
|---|
| 1497 | <listitem> |
|---|
| 1498 | <para><emphasis>path</emphasis></para> |
|---|
| 1499 | |
|---|
| 1500 | <para>The value of a path feature specifies a path. The path is |
|---|
| 1501 | treated as relative to the directory of Jamfile where path |
|---|
| 1502 | feature is used and is translated appropriately by the build |
|---|
| 1503 | system when the build is invoked from a different |
|---|
| 1504 | directory</para> |
|---|
| 1505 | </listitem> |
|---|
| 1506 | |
|---|
| 1507 | <listitem> |
|---|
| 1508 | <para><emphasis>implicit</emphasis></para> |
|---|
| 1509 | |
|---|
| 1510 | <para>Values of implicit features alone identify the feature. |
|---|
| 1511 | For example, a user is not required to write |
|---|
| 1512 | "<toolset>gcc", but can simply write "gcc". Implicit |
|---|
| 1513 | feature names also don't appear in variant paths, although |
|---|
| 1514 | the values do. Thus: bin/gcc/... as opposed to |
|---|
| 1515 | bin/toolset-gcc/.... There should typically be only a few |
|---|
| 1516 | such features, to avoid possible name clashes.</para> |
|---|
| 1517 | </listitem> |
|---|
| 1518 | |
|---|
| 1519 | <listitem> |
|---|
| 1520 | <para><emphasis>composite</emphasis></para> |
|---|
| 1521 | |
|---|
| 1522 | <para>Composite features actually correspond to groups of |
|---|
| 1523 | properties. For example, a build variant is a composite |
|---|
| 1524 | feature. When generating targets from a set of build |
|---|
| 1525 | properties, composite features are recursively expanded and |
|---|
| 1526 | <emphasis>added</emphasis> to the build property set, so rules can find |
|---|
| 1527 | them if necessary. Non-composite non-free features override |
|---|
| 1528 | components of composite features in a build property set.</para> |
|---|
| 1529 | </listitem> |
|---|
| 1530 | |
|---|
| 1531 | <listitem> |
|---|
| 1532 | <para><emphasis>dependency</emphasis></para> |
|---|
| 1533 | |
|---|
| 1534 | <para>The value of dependency feature if a target reference. |
|---|
| 1535 | When used for building of a main target, the value of |
|---|
| 1536 | dependency feature is treated as additional dependency.</para> |
|---|
| 1537 | |
|---|
| 1538 | <para>For example, dependency features allow to state that |
|---|
| 1539 | library A depends on library B. As the result, whenever an |
|---|
| 1540 | application will link to A, it will also link to B. |
|---|
| 1541 | Specifying B as dependency of A is different from adding B to |
|---|
| 1542 | the sources of A. <!-- Need to clarify this. --></para> |
|---|
| 1543 | </listitem> |
|---|
| 1544 | </itemizedlist> |
|---|
| 1545 | |
|---|
| 1546 | <para>Features that are neither free nor incidental are called |
|---|
| 1547 | <emphasis>base</emphasis> features.</para> |
|---|
| 1548 | |
|---|
| 1549 | |
|---|
| 1550 | </section> |
|---|
| 1551 | <section id="bbv2.reference.features.declaration"> |
|---|
| 1552 | <title>Feature Declaration</title> |
|---|
| 1553 | |
|---|
| 1554 | <para>The low-level feature declaration interface is the |
|---|
| 1555 | <literal>feature</literal> rule from the |
|---|
| 1556 | <literal>feature</literal> module: |
|---|
| 1557 | |
|---|
| 1558 | <programlisting> |
|---|
| 1559 | rule feature ( name : allowed-values * : attributes * ) |
|---|
| 1560 | </programlisting> |
|---|
| 1561 | |
|---|
| 1562 | A feature's allowed-values may be extended with the |
|---|
| 1563 | <code>feature.extend</code> rule. |
|---|
| 1564 | </para> |
|---|
| 1565 | |
|---|
| 1566 | </section> |
|---|
| 1567 | </section> |
|---|
| 1568 | |
|---|
| 1569 | <section id="bbv2.reference.variants"> |
|---|
| 1570 | <title>Build Variants</title> |
|---|
| 1571 | |
|---|
| 1572 | <para> |
|---|
| 1573 | A build variant, or (simply variant) is a special kind of composite |
|---|
| 1574 | feature that automatically incorporates the default values of |
|---|
| 1575 | features that . Typically you'll want at least two separate |
|---|
| 1576 | variants: one for debugging, and one for your release code. [ |
|---|
| 1577 | Volodya says: "Yea, we'd need to mention that it's a composite |
|---|
| 1578 | feature and describe how they are declared, in pacticular that |
|---|
| 1579 | default values of non-optional features are incorporated into |
|---|
| 1580 | build variant automagically. Also, do we wan't some variant |
|---|
| 1581 | inheritance/extension/templates. I don't remember how it works in |
|---|
| 1582 | V1, so can't document this for V2.". Will clean up soon -DWA ] |
|---|
| 1583 | </para> |
|---|
| 1584 | |
|---|
| 1585 | </section> |
|---|
| 1586 | |
|---|
| 1587 | <section id="bbv2.reference.variants.proprefine"> |
|---|
| 1588 | <title>Property refinement</title> |
|---|
| 1589 | |
|---|
| 1590 | <para>When a target with certain properties is requested, and that |
|---|
| 1591 | target requires some set of properties, it is needed to find the |
|---|
| 1592 | set of properties to use for building. This process is called |
|---|
| 1593 | <emphasis>property refinement</emphasis> and is performed by these rules</para> |
|---|
| 1594 | |
|---|
| 1595 | <orderedlist> |
|---|
| 1596 | |
|---|
| 1597 | <listitem> |
|---|
| 1598 | <simpara> |
|---|
| 1599 | Each property in the required set is added to the original |
|---|
| 1600 | property set |
|---|
| 1601 | </simpara> |
|---|
| 1602 | </listitem> |
|---|
| 1603 | |
|---|
| 1604 | <listitem> |
|---|
| 1605 | <simpara> |
|---|
| 1606 | If the original property set includes property with a different |
|---|
| 1607 | value of non free feature, that property is removed. |
|---|
| 1608 | </simpara> |
|---|
| 1609 | </listitem> |
|---|
| 1610 | </orderedlist> |
|---|
| 1611 | </section> |
|---|
| 1612 | |
|---|
| 1613 | <section id="bbv2.reference.variants.propcond"> |
|---|
| 1614 | <title>Conditional properties</title> |
|---|
| 1615 | |
|---|
| 1616 | <para>Sometime it's desirable to apply certain requirements only for |
|---|
| 1617 | a specific combination of other properties. For example, one of |
|---|
| 1618 | compilers that you use issues a pointless warning that you want to |
|---|
| 1619 | suppress by passing a command line option to it. You would not |
|---|
| 1620 | want to pass that option to other compilers. Conditional |
|---|
| 1621 | properties allow you to do just that. Their syntax is:</para> |
|---|
| 1622 | |
|---|
| 1623 | <programlisting> |
|---|
| 1624 | property ( "," property ) * ":" property |
|---|
| 1625 | </programlisting> |
|---|
| 1626 | |
|---|
| 1627 | <para> |
|---|
| 1628 | For example, the problem above would be solved by: |
|---|
| 1629 | |
|---|
| 1630 | <programlisting> |
|---|
| 1631 | exe hello : hello.cpp : <toolset>yfc:<cxxflags>-disable-pointless-warning ; |
|---|
| 1632 | </programlisting> |
|---|
| 1633 | </para> |
|---|
| 1634 | |
|---|
| 1635 | <para>The syntax also allows several properties in the condition, for |
|---|
| 1636 | example: |
|---|
| 1637 | <programlisting> |
|---|
| 1638 | exe hello : hello.cpp : <os>NT,<toolset>gcc:<link>static ; |
|---|
| 1639 | </programlisting> |
|---|
| 1640 | </para> |
|---|
| 1641 | |
|---|
| 1642 | </section> |
|---|
| 1643 | |
|---|
| 1644 | <section id="bbv2.reference.ids"> |
|---|
| 1645 | <title>Target identifiers and references</title> |
|---|
| 1646 | |
|---|
| 1647 | <para><emphasis>Target identifier</emphasis> is used to denote a |
|---|
| 1648 | target. The syntax is:</para> |
|---|
| 1649 | |
|---|
| 1650 | <programlisting> |
|---|
| 1651 | target-id -> (project-id | target-name | file-name ) |
|---|
| 1652 | | (project-id | directory-name) "//" target-name |
|---|
| 1653 | project-id -> path |
|---|
| 1654 | target-name -> path |
|---|
| 1655 | file-name -> path |
|---|
| 1656 | directory-name -> path |
|---|
| 1657 | </programlisting> |
|---|
| 1658 | |
|---|
| 1659 | <para> |
|---|
| 1660 | This grammar allows some elements to be recognized as either |
|---|
| 1661 | |
|---|
| 1662 | <itemizedlist> |
|---|
| 1663 | <listitem> |
|---|
| 1664 | <simpara> |
|---|
| 1665 | project id (at this point, all project ids start with slash). |
|---|
| 1666 | </simpara> |
|---|
| 1667 | </listitem> |
|---|
| 1668 | |
|---|
| 1669 | <listitem> |
|---|
| 1670 | <simpara> |
|---|
| 1671 | name of target declared in current Jamfile (note that target |
|---|
| 1672 | names may include slash). |
|---|
| 1673 | </simpara> |
|---|
| 1674 | </listitem> |
|---|
| 1675 | |
|---|
| 1676 | <listitem> |
|---|
| 1677 | <simpara> |
|---|
| 1678 | a regular file, denoted by absolute name or name relative to |
|---|
| 1679 | project's sources location. |
|---|
| 1680 | </simpara> |
|---|
| 1681 | </listitem> |
|---|
| 1682 | </itemizedlist> |
|---|
| 1683 | |
|---|
| 1684 | To determine the real meaning a check is made if project-id |
|---|
| 1685 | by the specified name exists, and then if main target of that |
|---|
| 1686 | name exists. For example, valid target ids might be: |
|---|
| 1687 | |
|---|
| 1688 | <screen> |
|---|
| 1689 | a -- target in current project |
|---|
| 1690 | lib/b.cpp -- regular file |
|---|
| 1691 | /boost/thread -- project "/boost/thread" |
|---|
| 1692 | /home/ghost/build/lr_library//parser -- target in specific project |
|---|
| 1693 | </screen> |
|---|
| 1694 | |
|---|
| 1695 | </para> |
|---|
| 1696 | |
|---|
| 1697 | <para><emphasis role="bold">Rationale:</emphasis>Target is separated from project by special |
|---|
| 1698 | separator (not just slash), because:</para> |
|---|
| 1699 | |
|---|
| 1700 | <itemizedlist> |
|---|
| 1701 | <listitem> |
|---|
| 1702 | <simpara> |
|---|
| 1703 | It emphasises that projects and targets are different things. |
|---|
| 1704 | </simpara> |
|---|
| 1705 | </listitem> |
|---|
| 1706 | |
|---|
| 1707 | <listitem> |
|---|
| 1708 | <simpara> |
|---|
| 1709 | It allows to have main target names with slashes. |
|---|
| 1710 | |
|---|
| 1711 | <!-- The motivation for which is: |
|---|
| 1712 | |
|---|
| 1713 | So, to summarize: |
|---|
| 1714 | |
|---|
| 1715 | 1. The project that extract tarfile may extract all possible kinds |
|---|
| 1716 | of targets, and it's reasonable to use them directly from other |
|---|
| 1717 | project. |
|---|
| 1718 | |
|---|
| 1719 | 2. The rule for unpacking tar is inplemented in terms of |
|---|
| 1720 | "patch-file", for maintainability, and therefore, must use main |
|---|
| 1721 | target name that contains slashes? |
|---|
| 1722 | |
|---|
| 1723 | 3. Using sub-Jamfile in "foo" to declare extracted file "foo/b" is |
|---|
| 1724 | not an option, because you should not change existing tree |
|---|
| 1725 | |
|---|
| 1726 | That makes good rationale for why main target must contain names. |
|---|
| 1727 | --> |
|---|
| 1728 | </simpara> |
|---|
| 1729 | </listitem> |
|---|
| 1730 | </itemizedlist> |
|---|
| 1731 | |
|---|
| 1732 | <para id="bbv2.reference.targets.references"> |
|---|
| 1733 | <emphasis>Target reference</emphasis> is used to |
|---|
| 1734 | specify a source target, and may additionally specify desired |
|---|
| 1735 | properties for that target. It has this syntax:</para> |
|---|
| 1736 | |
|---|
| 1737 | <programlisting> |
|---|
| 1738 | target-reference -> target-id [ "/" requested-properties ] |
|---|
| 1739 | requested-properties -> property-path |
|---|
| 1740 | </programlisting> |
|---|
| 1741 | |
|---|
| 1742 | <para> |
|---|
| 1743 | For example, |
|---|
| 1744 | |
|---|
| 1745 | <programlisting> |
|---|
| 1746 | exe compiler : compiler.cpp libs/cmdline/<optimization>space ; |
|---|
| 1747 | </programlisting> |
|---|
| 1748 | |
|---|
| 1749 | would cause the version of <literal>cmdline</literal> library, |
|---|
| 1750 | optimized for space, to be linked in even if the |
|---|
| 1751 | <literal>compiler</literal> executable is build with optimization for |
|---|
| 1752 | speed. |
|---|
| 1753 | </para> |
|---|
| 1754 | </section> |
|---|
| 1755 | |
|---|
| 1756 | </section> |
|---|
| 1757 | |
|---|
| 1758 | <section id="bbv2.reference.generators"> |
|---|
| 1759 | <title>Generators</title> |
|---|
| 1760 | |
|---|
| 1761 | <warning><para>The information is this section is likely to be outdated |
|---|
| 1762 | and misleading. |
|---|
| 1763 | </para></warning> |
|---|
| 1764 | |
|---|
| 1765 | <para>To construct a main target with given properties from sources, |
|---|
| 1766 | it is required to create a dependency graph for that main target, |
|---|
| 1767 | which will also include actions to be run. The algorithm for |
|---|
| 1768 | creating the dependency graph is described here.</para> |
|---|
| 1769 | |
|---|
| 1770 | <para>The fundamental concept is <emphasis>generator</emphasis>. If encapsulates |
|---|
| 1771 | the notion of build tool and is capable to converting a set of |
|---|
| 1772 | input targets into a set of output targets, with some properties. |
|---|
| 1773 | Generator matches a build tool as closely as possible: it works |
|---|
| 1774 | only when the tool can work with requested properties (for |
|---|
| 1775 | example, msvc compiler can't work when requested toolset is gcc), |
|---|
| 1776 | and should produce exactly the same targets as the tool (for |
|---|
| 1777 | example, if Borland's linker produces additional files with debug |
|---|
| 1778 | information, generator should also).</para> |
|---|
| 1779 | |
|---|
| 1780 | <para>Given a set of generators, the fundamental operation is to |
|---|
| 1781 | construct a target of a given type, with given properties, from a |
|---|
| 1782 | set of targets. That operation is performed by rule |
|---|
| 1783 | <literal>generators.construct</literal> and the used algorithm is described |
|---|
| 1784 | below.</para> |
|---|
| 1785 | |
|---|
| 1786 | <section> |
|---|
| 1787 | <title>Selecting and ranking viable generators</title> |
|---|
| 1788 | |
|---|
| 1789 | <para>Each generator, in addition to target types that it can |
|---|
| 1790 | produce, have attribute that affects its applicability in |
|---|
| 1791 | particular sitiation. Those attributes are:</para> |
|---|
| 1792 | |
|---|
| 1793 | <orderedlist> |
|---|
| 1794 | <listitem> |
|---|
| 1795 | <simpara> |
|---|
| 1796 | Required properties, which are properties absolutely |
|---|
| 1797 | necessary for the generator to work. For example, generator |
|---|
| 1798 | encapsulating the gcc compiler would have <toolset>gcc as |
|---|
| 1799 | required property. |
|---|
| 1800 | </simpara> |
|---|
| 1801 | </listitem> |
|---|
| 1802 | |
|---|
| 1803 | <listitem> |
|---|
| 1804 | <simpara> |
|---|
| 1805 | Optional properties, which increase the generators |
|---|
| 1806 | suitability for a particual build. |
|---|
| 1807 | </simpara> |
|---|
| 1808 | </listitem> |
|---|
| 1809 | </orderedlist> |
|---|
| 1810 | |
|---|
| 1811 | <para> |
|---|
| 1812 | Generator's required and optional properties may not include |
|---|
| 1813 | either free or incidental properties. (Allowing this would |
|---|
| 1814 | greatly complicate caching targets). |
|---|
| 1815 | </para> |
|---|
| 1816 | |
|---|
| 1817 | <para>When trying to construct a target, the first step is to select |
|---|
| 1818 | all possible generators for the requested target type, which |
|---|
| 1819 | required properties are a subset of requested properties. |
|---|
| 1820 | Generators that were already selected up the call stack are |
|---|
| 1821 | excluded. In addition, if any composing generators were selected |
|---|
| 1822 | up the call stack, all other composing generators are ignored |
|---|
| 1823 | (TODO: define composing generators). The found generators |
|---|
| 1824 | are assigned a rank, which is the number of optional properties |
|---|
| 1825 | present in requested properties. Finally, generators with highest |
|---|
| 1826 | rank are selected for futher processing.</para> |
|---|
| 1827 | |
|---|
| 1828 | </section> |
|---|
| 1829 | <section> |
|---|
| 1830 | <title>Running generators</title> |
|---|
| 1831 | |
|---|
| 1832 | <para>When generators are selected, each is run to produce a list of |
|---|
| 1833 | created targets. This list might include targets that are not of |
|---|
| 1834 | requested types, because generators create the same targets as |
|---|
| 1835 | some tool, and tool's behaviour is fixed. (Note: should specify |
|---|
| 1836 | that in some cases we actually want extra targets). If generator |
|---|
| 1837 | fails, it returns an empty list. Generator is free to call |
|---|
| 1838 | 'construct' again, to convert sources to the types it can handle. |
|---|
| 1839 | It also can pass modified properties to 'construct'. However, a |
|---|
| 1840 | generator is not allowed to modify any propagated properties, |
|---|
| 1841 | otherwise when actually consuming properties we might discover |
|---|
| 1842 | that the set of propagated properties is different from what was |
|---|
| 1843 | used for building sources.</para> |
|---|
| 1844 | |
|---|
| 1845 | <para>For all targets that are not of requested types, we try to |
|---|
| 1846 | convert them to requested type, using a second call to |
|---|
| 1847 | <literal>construct</literal>. This is done in order to support |
|---|
| 1848 | transformation sequences where single source file expands to |
|---|
| 1849 | several later. See <ulink url= |
|---|
| 1850 | "http://groups.yahoo.com/group/jamboost/message/1667">this |
|---|
| 1851 | message</ulink> for details.</para> |
|---|
| 1852 | |
|---|
| 1853 | </section> |
|---|
| 1854 | |
|---|
| 1855 | <section> |
|---|
| 1856 | <title>Selecting dependency graph</title> |
|---|
| 1857 | |
|---|
| 1858 | <para> |
|---|
| 1859 | After all generators are run, |
|---|
| 1860 | it is necessary to decide which of successfull invocation will be |
|---|
| 1861 | taken as final result. At the moment, this is not done. Instead, |
|---|
| 1862 | it is checked whether all successfull generator invocation |
|---|
| 1863 | returned the same target list. Error is issued otherwise. |
|---|
| 1864 | </para> |
|---|
| 1865 | |
|---|
| 1866 | </section> |
|---|
| 1867 | |
|---|
| 1868 | <section> |
|---|
| 1869 | <title>Property adjustment</title> |
|---|
| 1870 | |
|---|
| 1871 | <para>Because target location is determined by the build system, it |
|---|
| 1872 | is sometimes necessary to adjust properties, in order to not |
|---|
| 1873 | break actions. For example, if there's an action that generates |
|---|
| 1874 | a header, say "a_parser.h", and a source file "a.cpp" which |
|---|
| 1875 | includes that file, we must make everything work as if a_parser.h |
|---|
| 1876 | is generated in the same directory where it would be generated |
|---|
| 1877 | without any subvariants.</para> |
|---|
| 1878 | |
|---|
| 1879 | <para>Correct property adjustment can be done only after all targets |
|---|
| 1880 | are created, so the approach taken is:</para> |
|---|
| 1881 | |
|---|
| 1882 | <orderedlist> |
|---|
| 1883 | <listitem> |
|---|
| 1884 | <para> |
|---|
| 1885 | When dependency graph is constructed, each action can be |
|---|
| 1886 | assigned a rule for property adjustment. |
|---|
| 1887 | </para> |
|---|
| 1888 | </listitem> |
|---|
| 1889 | |
|---|
| 1890 | <listitem> |
|---|
| 1891 | <para> |
|---|
| 1892 | When virtual target is actualized, that rule is run and |
|---|
| 1893 | return the final set of properties. At this stage it can use |
|---|
| 1894 | information of all created virtual targets. |
|---|
| 1895 | </para> |
|---|
| 1896 | </listitem> |
|---|
| 1897 | </orderedlist> |
|---|
| 1898 | |
|---|
| 1899 | <para>In case of quoted includes, no adjustment can give 100% correct |
|---|
| 1900 | results. If target dirs are not changed by build system, quoted |
|---|
| 1901 | includes are searched in "." and then in include path, while angle |
|---|
| 1902 | includes are searched only in include path. When target dirs are |
|---|
| 1903 | changed, we'd want to make quoted includes to be search in "." then in |
|---|
| 1904 | additional dirs and then in the include path and make angle includes |
|---|
| 1905 | be searched in include path, probably with additional paths added at |
|---|
| 1906 | some position. Unless, include path already has "." as the first |
|---|
| 1907 | element, this is not possible. So, either generated headers should not |
|---|
| 1908 | be included with quotes, or first element of include path should be |
|---|
| 1909 | ".", which essentially erases the difference between quoted and angle |
|---|
| 1910 | includes. <emphasis role="bold">Note:</emphasis> the only way to get |
|---|
| 1911 | "." as include path into compiler command line is via verbatim |
|---|
| 1912 | compiler option. In all other case, Boost.Build will convert "." into |
|---|
| 1913 | directory where it occurs.</para> |
|---|
| 1914 | |
|---|
| 1915 | </section> |
|---|
| 1916 | |
|---|
| 1917 | <section> |
|---|
| 1918 | <title>Transformations cache</title> |
|---|
| 1919 | |
|---|
| 1920 | <para> |
|---|
| 1921 | Under certain conditions, an |
|---|
| 1922 | attempt is made to cache results of transformation search. First, |
|---|
| 1923 | the sources are replaced with targets with special name and the |
|---|
| 1924 | found target list is stored. Later, when properties, requested |
|---|
| 1925 | type, and source type are the same, the store target list is |
|---|
| 1926 | retrieved and cloned, with appropriate change in names. |
|---|
| 1927 | </para> |
|---|
| 1928 | |
|---|
| 1929 | </section> |
|---|
| 1930 | </section> |
|---|
| 1931 | |
|---|
| 1932 | </chapter> |
|---|
| 1933 | |
|---|
| 1934 | <!-- |
|---|
| 1935 | Local Variables: |
|---|
| 1936 | mode: xml |
|---|
| 1937 | sgml-indent-data: t |
|---|
| 1938 | sgml-parent-document: ("userman.xml" "chapter") |
|---|
| 1939 | sgml-set-face: t |
|---|
| 1940 | End: |
|---|
| 1941 | --> |
|---|