Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Detailed reference 詳細參考手冊

General information 總體說明
Builtin rules 內建規則
Builtin features 內建特性
Builtin tools 內建工具
Build process 構建過程
Definitions 定義
Generators 生成器

General information 總體說明

Initialization 初始化

bjam's first job upon startup is to load the Jam code that implements the build system. To do this, it searches for a file called boost-build.jam, first in the invocation directory, then in its parent and so forth up to the filesystem root, and finally in the directories specified by the environment variable BOOST_BUILD_PATH. When found, the file is interpreted, and should specify the build system location by calling the boost-build rule:
bjam 在啟動時的第一項任務是,裝入實現該構建系統的 Jam 代碼。為此,它要搜索一個名為 boost-build.jam 的文件,首先是調用目錄,然後到它的父目錄,等等,直至文件系統的根目錄,最後是環境變量 BOOST_BUILD_PATH 所指定的目錄。找到該文件後,該文件是解釋性的,並應通過調用 boost-build 規則指定構建系統的位置:

rule boost-build ( location ? )

If location is a relative path, it is treated as relative to the directory of boost-build.jam. The directory specified by that location and the directories in BOOST_BUILD_PATH are then searched for a file called bootstrap.jam, which is expected to bootstrap the build system. This arrangement allows the build system to work without any command-line or environment variable settings. For example, if the build system files were located in a directory "build-system/" at your project root, you might place a boost-build.jam at the project root containing:
如果 location 是相對路徑的,則被視為相對於 boost-build.jam 的目錄。由 location 指定的目錄以及在 BOOST_BUILD_PATH 中的目錄都被用於查找一個名為 bootstrap.jam 的文件,該文件被作為構建系統的自舉文件。這種安排允許構建系統在沒有任何命令行或環境變量設置時工作。例如,如果構建系統文件位於你的工程根目錄中的 "build-system/" 目錄,那麼你可以將一個 boost-build.jam 放置在工程根目錄中,它包含有:

boost-build build-system ;

In this case, running bjam anywhere in the project tree will automatically find the build system.
這種情況下,在工程樹的任意位置運行 bjam 都可以自動找到這個構建系統。

The default bootstrap.jam, after loading some standard definitions, loads two files, which can be provided/customised by user: site-config.jam and user-config.jam.
在裝入一些標準定義後,缺省的 bootstrap.jam 將裝入兩個文件,它們可以由用戶提供或定制:site-config.jamuser-config.jam.

Locations where those files are searched are summarized below:
這些文件的位置的搜索總結如下:

Table 28.2. Search paths for configuration files
表 28.2. 配置文件的搜索路徑

  site-config.jam user-config.jam
Linux

/etc

$HOME

$BOOST_BUILD_PATH

$HOME

$BOOST_BUILD_PATH

Windows

%SystemRoot%

%HOMEDRIVE%%HOMEPATH%

%HOME%

%BOOST_BUILD_PATH%

%HOMEDRIVE%%HOMEPATH%

%HOME%

%BOOST_BUILD_PATH%


Boost.Build comes with default versions of those files, which can serve as templates for customized versions.
Boost.Build 帶有這些文件的缺省版本,它們可作為定製版本的模板。

Command line 命令行

The command line may contain:
命令行可以包含:

  • Jam options,
    Jam 選項,
  • Boost.Build options,
    Boost.Build 選項
  • Command line arguments
    命令行參數
Command line arguments 命令行參數

Command line arguments specify targets and build request using the following rules.
命令行參數按以下規則指定了目標和構建請求。

  • An argument that does not contain slashes or the = symbol is either a value of an implicit feature or of a target to be built. It is taken to be value of a feature if an appropriate feature exists. Otherwise, it is considered a target id. Building the special target name 「clean」 has the same effect as using the --clean option.
    一個不含斜槓和 = 號的參數,要麼是某個隱式特性的值,要麼是被構建目標的值。如果存在適當的特性,它就被視為該特性的值。否則,它被視為一個目標id。構建名為"clean"的特定目標與使用 --clean 選項具有相同效果。
  • An argument containing either slashes or the = symbol specifies a number of build request elements (see the section called 「Build Request」). In its simplest form, it is just a set of properties, separated by slashes, which become a single build request element, for example:
    一個含有斜槓或 = 號的參數,指定了一組構建請求元素(參見 「構建請求」一節)。以最簡單的格式來看,它只是一組以斜槓分隔的屬性,每個屬性成為一個構建請求元素,例如:

    borland/runtime-link=static

    A more complex form can be used to save typing. For example, instead of
    更為複雜的格式可以節約打字。例如,取代

    borland/runtime-link=static borland/runtime-link=dynamic

    one can use
    你可以用

    borland/runtime-link=static,dynamic

    Exactly, the conversion from argument to build request elements is performed by (1) splitting the argument at each slash, (2) converting each split part into a set of properties and (3) taking all possible combinations of the property sets. Each split part should have either the form
    準確地說,從參數到構建請求元素的轉換是這樣執行的,(1) 按每個斜槓分隔參數,(2) 將每個分好的部分轉換為一組屬性,(3) 接受屬性集的所有可能的組合。每個分隔的部分應具有以下格式

    feature-name=feature-value1[","feature-valueN]*

    or, in case of implicit features
    或者,以下隱式特性

    feature-value1[","feature-valueN;]*

    will be converted into the property set
    將被轉換為以下屬性集

    <feature-name>feature-value1 .... <feature-name>feature-valueN

For example, the command line
例如,命令行

target1 debug gcc/runtime-link=dynamic,static

would cause target called target1 to be rebuilt in debug mode, except that for gcc, both dynamically and statically linked binaries would be created.
將導致名為 target1 的目標被重新以調試模式構建,除了對於 gcc,同時創建動態和靜態鏈接的二進制文件。

Command line options 命令行選項

All of the Boost.Build options start with the "--" prefix. They are described in the following table.
所有 Boost.Build 選項都以 "--" 前綴開始。它們以下表中說明。

FIXME: That table has moved into "User documentation" section and there is nothing we can add here. Remove this part?
修正:該表格移至"用戶文檔"一節,我們在此沒什麼可加的。是否刪除這一部分?

Builtin rules 內建規則

This section contains the list of all rules that can be used in Jamfile—both rules that define new targets and auxiliary rules.
本節包含了可以在 Jamfile 中使用的所有規則—包括定義新目標的規則和輔助規則。

exe

Creates an executable file. See the section called 「Programs」.
創建一個可執行文件。參見 「程序」一節

lib

Creates an library file. See the section called 「Libraries」.
創建一個庫文件。參見 「庫」一節

install

Installs built targets and other files. See the section called 「Installing」.
安裝被構建目標和其它文件。參見 「安裝」一節

alias

Creates an alias for other targets. See the section called 「Alias」.
創建某個目標的一個別名。參見 「別名」一節

unit-test

Creates an executable that will be automatically run. See the section called 「Testing」.
創建一個可執行文件並自動運行。參見 「測試」一節

compile, compile-fail, link, link-fail, run, run-fail

Specialized rules for testing. See the section called 「Testing」.
用於測試的特殊規則。參見 「測試」一節

obj

Creates an object file. Useful when a single source file must be compiled with special properties.
創建一個目標文件。當某一個源文件必須以特殊屬性進行編譯時使用。

glob

The glob rule takes a list shell pattern and returns the list of files in the project's source directory that match the pattern. For example:
glob 規則接受一列 shell 模式,返回在工程源目錄中與該模式匹配的文件列表。例如:

lib tools : [ glob *.cpp ] ;

It is possible to also pass a second argument—the list of exclude patterns. The result will then include the list of files patching any of include patterns, and not matching any of the exclude patterns. For example:
還可以傳入第二個參數—被排除的模式列表。這時返回的結果是包含與包含模式相匹配的文件且不包含與排除模式相匹配的文件的列表。例如:

lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ;

glob-tree

The glob-tree is similar to the glob except that it operates recursively from the directory of the containing Jamfile. For example:
glob-tree 類似於 glob,但它是從包含 Jamfile 的目錄開始進行遞歸的操作。例如:

ECHO [ glob-tree *.cpp : .svn ] ;

will print the names of all C++ files in your project. The .svn exclude pattern prevents the glob-tree rule from entering administrative directories of the Subversion version control system.
將打印你的工程中的所有 C++ 文件的名字。排除模式 .svn 防止 glob-tree 規則進入 Subversion 版本控制系統的管理目錄。

project

Declares project id and attributes, including project requirements. See the section called 「Projects」.
聲明工程 id 和屬性,包括工程要求。參見 「工程」一節

use-project

Assigns a symbolic project ID to a project at a given path. This rule must be better documented!
將一個符號工程 ID 賦給指定路徑中的工程。該規則必須要好好地說明清楚!

explicit

The explicit rule takes a single parameter—a list of target names. The named targets will be marked explicit, and will be built only if they are explicitly requested on the command line, or if their dependents are built. Compare this to ordinary targets, that are built implicitly when their containing project is built.
explicit 規則接受一個參數—一個目標名列表。被標記為顯式的命名目標,僅當它們在命令行中被明確請求,或依賴於它們的目標被構建時,才進行構建。相比之下,普通的目標在包含它們的工程被構建時就會隱式地進行構建。

constant

Sets project-wide constant. Takes two parameters: variable name and a value and makes the specified variable name accessible in this Jamfile and any child Jamfiles. For example:
設置工程範圍的常量。它接受兩個參數:變量名和一個值,並且使得指定的變量名在本 Jamfile 及所有子 Jamfiles 中可訪問。例如:

constant VERSION : 1.34.0 ;

path-constant

Same as constant except that the value is treated as path relative to Jamfile location. For example, if bjam is invoked in the current directory, and Jamfile in helper subdirectory has:
和 constant 相似,除了變量值被視為相對於 Jamfile 位置的路徑。例如,如果在當前路徑調用 bjam,且在 helper 子目錄中的 Jamfile 有:

path-constant DATA : data/a.txt ;

then the variable DATA will be set to helper/data/a.txt, and if bjam is invoked from the helper directory, then the variable DATA will be set to data/a.txt.
則變量 DATA 將被設為 helper/data/a.txt,而如果 bjam 是從 helper 目錄調用的,則變量 DATA 將被設為 data/a.txt

build-project

Cause some other project to be built. This rule takes a single parameter—a directory name relative to the containing Jamfile. When the containing Jamfile is built, the project located at that directory will be built as well. At the moment, the parameter to this rule should be a directory name. Project ID or general target references are not allowed.
引起其它一些工程被構建。該規則接受一個參數—一個相對於所含 Jamfile 的目錄名。當所含的 Jamfile 被構建時,位於此目錄中的工程也將被構建。目前,傳給該規則的參數應是一個目錄名。不可以是工程ID或普通的目標引用。

test-suite

This rule is deprecated and equivalent to alias.
該規則已不建議使用,它等同於 alias

Builtin features 內建特性

variant

A feature that combines several low-level features, making it easy to request common build configurations.
組合了多個低級特性的特性,使得構建配置的請求更為易用。

Allowed values: debug, release, profile.
允許值:debug, release, profile.

The value debug expands to
值 debug 展開為

<optimization>off <debug-symbols>on <inlining>off <runtime-debugging>on

The value release expands to
值 release 展開為

<optimization>speed <debug-symbols>off <inlining>full <runtime-debugging>off

The value profile expands to the same as release, plus:
值 profile 展開為與 release 一樣,再加上:

<profiling>on <debug-symbols>on

User can define his own build variants using the variant rule from the common module.
用戶可以用 common 模塊的 variant 規則定義自己的構建變體。

Notee: Runtime debugging is on in debug builds to suit the expectations of people used to various IDEs.
註:在 debug 構建中打開運行期調試開關,是符合使用各種 IDE 的用戶預期的。

link

Allowed values: shared, static
允許值:shared, static

A feature that controls how libraries are built.
控制如何構建庫的一個特性。

runtime-link

Allowed values: shared, static
允許值:shared, static

Controls if a static or shared C/C++ runtime should be used. There are some restrictions how this feature can be used, for example on some compilers an application using static runtime should not use shared libraries at all, and on some compilers, mixing static and shared runtime requires extreme care. Check your compiler documentation for more details.
控制使用靜態或共享的 C/C++ 運行庫。對於如何使用該特性,有一些限制,例如,在某些編譯器上,使用靜態運行庫的應用程序就根本不能使用共享庫,而在另一些編譯器上,混合使用靜態和共享運行庫要求非常小心。更多詳情請查閱你的編譯器文檔。

source
The <source>X feature has the same effect on building a target as putting X in the list of sources. It is useful when you want to add the same source to all targets in the project (you can put <source> in requirements) or to conditionally include a source (using conditional requirements, see the section called 「Conditions and alternatives」). See also the <library> feature.
特性 <source>X 與將 X 置於源列表中進行構建目標具有相同的效果。當你想增加某些源文件到工程的所有目標中時(你可以把 <source> 放在要求中),或者想有條件地包含一個源文件時(使用條件要求,參見 「條件與選擇」一節),它非常有用。參見 <library> 特性。
library
This feature is almost equivalent to the <source> feature, except that it takes effect only for linking. When you want to link all targets in a Jamfile to certain library, the <library> feature is preferred over <source>X -- the latter will add the library to all targets, even those that have nothing to do with libraries.
該特性基本等同於 <source> 特性,不過它只對鏈接起作用。當你想將 Jamfile 中的所有目標都鏈接到某個特定庫時,<library> 特性優於 <source>X -- 後者會把庫加到所有目標中,即使是那些不需要這個庫的目標。
dependency
Introduces a dependency on the target named by the value of this feature (so it will be brought up-to-date whenever the target being declared is). The dependency is not used in any other way.
引入對由該特性的值所命名的目標的依賴關係(因此無論何時目標被聲明,它都會被引發更新)。這個依賴關係沒有其它用途。
use
Introduces a dependency on the target named by the value of this feature (so it will be brought up-to-date whenever the target being declared is), and adds its usage requirements to the build properties of the target being declared. The dependency is not used in any other way. The primary use case is when you want the usage requirements (such as #include paths) of some library to be applied, but do not want to link to it.
引入對由該特性的值所命名的目標的依賴關係(因此無論何時目標被聲明,它都會被引發更新),並將它的使用要求增加到被聲明目標的構建屬性中。這個依賴關係沒有其它用途。主要的用途是當你希望應用某些庫的使用要求(如 #include 路徑),而又不想鏈接它的時候。
dll-path
Specify an additional directory where the system should look for shared libraries when the executable or shared library is run. This feature only affects Unix compilers. Plase see the section called 「Why are the dll-path and hardcode-dll-paths properties useful? 」 in the section called 「Frequently Asked Questions」 for details.
指定一個額外的目錄,當運行可執行文件或共享庫時,系統會從該目錄查找共享庫。該特性只對 Unix 有影響。詳情請見 「常見問題」 中的 「為什麼 dll-pathhardcode-dll-paths 屬性是有用的? 」條目
hardcode-dll-paths

Controls automatic generation of dll-path properties.
控制 dll-path 屬性的自動生成。

Allowed values: true, false. This property is specific to Unix systems. If an executable is built with <hardcode-dll-paths>true, the generated binary will contain the list of all the paths to the used shared libraries. As the result, the executable can be run without changing system paths to shared libraries or installing the libraries to system paths. This is very convenient during development. Plase see the FAQ entry for details. Note that on Mac OSX, the paths are unconditionally hardcoded by the linker, and it is not possible to disable that behaviour.
允許值:true, false. 該屬性是為 Unix 系統指定的。如果一個可執行程序是以 <hardcode-dll-paths>true 構建的,則所生成的二進制文件將包含到所用共享庫的所有路徑的列表。這樣,這個可執行文件的運行可以無需修改系統的共享庫路徑設置或將共享庫安裝到系統路徑中。這在開發階段是很方便的。詳情請見這個 FAQ 條目。注意,在 Mac OSX 上,這些路徑是無條件地由鏈接器進行硬編碼的,而且不可能禁止這一行為。

cflags, cxxflags, linkflags
The value of those features is passed without modification to the corresponding tools. For cflags that is both the C and C++ compilers, for cxxflags that is the C++ compiler and for linkflags that is the linker. The features are handy when you are trying to do something special that cannot be achieved by a higher-level feature in Boost.Build.
這些特性的值會被照原樣傳遞給相應的工具。cflags 用於 C 和 C++ 編譯器,cxxflags 用於 C++ 編譯器,而 linkflags 則用於鏈接器。當你想做一些不能通過 Boost.Build 的高級特性來完成的特殊事情時,這個特性就很方便了。
warnings
The <warnings> feature controls the warning level of compilers. It has the following values:
<warnings> 特性控制編譯器的告警級別。它具有以下值:
  • off - disables all warnings.
    off - 禁止所有告警。

  • on - enables default warning level for the tool.
    on - 打開工具的缺省告警級別。

  • all - enables all warnings.
    all - 打開所有告警。

Default value is all.
缺省值是 all.
warnings-as-errors
The <warnings-as-errors> makes it possible to treat warnings as errors and abort compilation on a warning. The value on enables this behaviour. The default value is off.
<warnings-as-errors> 可以把告警視為錯誤,在出現告警時退出編譯。值 on 打開這一行為。缺省值為 off.
build

Allowed values: no
允許值:no

The build feature is used to conditionally disable build of a target. If <build>no is in properties when building a target, build of that target is skipped. Combined with conditional requirements this allows you to skip building some target in configurations where the build is known to fail.
build 特性用於有條件地禁止某個目標的構建。如果在構建一個目標時 <build>no 在其屬性中,則跳過對該目標的構建。通過與條件要求的組合,可以讓你在配置中跳過某些已知將會失敗的目標的構建。

tag

The tag feature is used to customize the name of the generated files. The value should have the form:
tag 特性用於定制所生成文件的名字。其值應具有以下格式:

@rulename

where rulename should be a name of a rule with the following signature:
其中 rulename 為一個具有以下簽名的規則的名稱:

rule tag ( name : type ? : property-set )

The rule will be called for each target with the default name computed by Boost.Build, the type of the target, and property set. The rule can either return a string that must be used as the name of the target, or an empty string, in which case the default name will be used.
該規則將被各個目標以 Boost.Build 計算得到的缺省名字、目標的類型、屬性集來調用。該規則可以返回一個必須被用作該目標的名字的字符串,或者一個空字符串,這時將使用缺省名字。

Most typical use of the tag feature is to encode build properties, or library version in library target names. You should take care to return non-empty string from the tag rule only for types you care about — otherwise, you might end up modifying names of object files, generated header file and other targets for which changing names does not make sense.
tag 特性通常用於將構建屬性或庫的版本號編入庫目標的名字中。你要注意,從 tag 規則返回的非空字符串必須與類型相匹配 — 否則,你可能會改變了目標文件、生成頭文件或其它不應改變名字的目標的名字。

debug-symbols

Allowed values: on, off.
允許值:on, off.

The debug-symbols feature specifies if produced object files, executables and libraries should include debug information. Typically, the value of this feature is implicitly set by the variant feature, but it can be explicitly specified by the user. The most common usage is to build release variant with debugging information.
debug-symbols 特性指明所產生的目標文件、可執行文件和庫文件是否要包含調試信息。通常,該特性的值是由 variant 特性隱式設置的,不過它也可以由用戶明確指定。最常見的用途是,構建帶有調試信息的發佈版本。

architecture

The architecture features specifies the general processor familty to generate code for.
architecture 特性指定生成代碼的通用處理器家族。

instruction-set

Allowed values for this feature depend on used toolset.
該特性所允許的值取決於所用的工具集。

The instruction-set specifies for which specific instruction set the code should be generated. The code in general might not run on processors with older/different instruction sets.
instruction-set 指定代碼應生成那個特定的指令集。代碼通常不能運行於帶有舊的或不同的指令集的處理器之上。

While Boost.Build allows a large set of possible values for this features, whether a given value works depends on which compiler you use. Please see the section called 「C++ Compilers」 for details.
雖然 Boost.Build 允許這個特性有一個很大的可能值集合,但是一個給定的值是否可用取決於你所用的編譯器。詳情請見 「C++ 編譯器」

address-model

Allowed values: 32, 64.
允許值:32, 64.

The address-model specifies if 32-bit or 64-bit code should be generated by the compiler. Whether this feature works depends on the used compiler, its version, how the compiler is configured, and the values of the architecture instruction-set features. Please see the section called 「C++ Compilers」 for details.
address-model 指定編譯器是否生成32位或64位代碼。這個特性是否可用取決於所用的編譯器、版本號、編譯器的配置,和 architecture instruction-set 特性的值。詳情請見 「C++ 編譯器」

Builtin tools 內建工具

Boost.Build comes with support for a large number of C++ compilers, and other tools. This section documents how to use those tools.
Boost.Build 支持大量的 C++ 編譯器和其它工具。本節講述如何使用這些工具。

Before using any tool, you must declare your intention, and possibly specify additional information about the tool's configuration. This is done with the using rule, for example:
在使用任何工具之前,你必須聲明你的意圖,也許還要指明有關工具配置的其它信息。這是以 using 規則實現的,例如:

using gcc ;

additional parameters can be passed just like for other rules, for example:
可以像其它規則那樣傳遞更多的參數,例如:

using gcc : 4.0 : g++-4.0 ;

The options that can be passed to each tool will be documented in the subsequent sections.
可以傳遞給各個工具的選項在後面各章節中說明。

C++ Compilers  C++編譯器

This section lists all Boost.Build modules that support C++ compilers and documents how each one can be initialized.
本節列出了所有支持 C++ 編譯器的 Boost.Build 模塊,並逐個說明如何初始化。

GNU C++

The gcc module supports the GNU C++ compiler on Linux, a number of Unix-like system including MacOS X, SunOS and BeOS, and on Windows (either Cygwin or MinGW).
gcc 模塊支持 Linux,包括 MacOS X、SunOS、BeOS 在內的多個類-Unix系統,以及 Windows (CygwinMinGW)上的 GNU C++ 編譯器

The gcc module is initialized using the following syntax:
gcc 模塊用以下語法進行初始化:

using gcc : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the version is not explicitly specified, it will be automatically detected by running the compiler with the -v option. If the command is not specified, the g++ binary will be searched in PATH.
如果版本號沒有明確指定,將以 -v 選項運行編譯器進行自動檢測。如果該命令未指定,則在 PATH 中搜索 g++ 二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

root

Specifies root directory of the compiler installation. This option is necessary only if it is not possible to detect this information from the compiler command—for example if the specified compiler command is a user script.
指明編譯器安裝的根目錄。僅當不能從編譯器命令檢測得到該信息時才需要這個選項,例如當指定的編譯器命令為一個用戶腳本時。

rc

Specifies the resource compiler command that will be used with the version of gcc that is being configured. This setting makes sense only for Windows and only if you plan to use resource files. By default windres will be used.
指定與被配置的 gcc 版本一起使用的資源編譯器命令。該設置只對 Windows 有意義,且僅當你準備使用資源文件時有用。缺省使用 windres

rc-type

Specifies the type of resource compiler. The value can be either windres for msvc resource compiler, or rc for borland's resource compiler.
指定資源編譯器的類型。對於 msvc 資源編譯器,該值為 windres,對於 borland 的資源編譯器,該值為 rc

In order to compile 64-bit applications, you have to specify address-model=64, and the instruction-set feature should refer to a 64 bit processor. Currently, those include nocona, opteron, athlon64 and athlon-fx.
為了編譯器64位應用程序,你必須指定 address-model=64,且 instruction-set 特性應表示64位處理器。當前的64位處理器包括有 nocona, opteron, athlon64athlon-fx.
Microsoft Visual C++

The msvc module supports the Microsoft Visual C++ command-line tools on Microsoft Windows. The supported products and versions of command line tools are listed below:
msvc 模塊支持 Microsoft Windows 上的 Microsoft Visual C++ 命令行工具。可支持的產品和命令行工具版本列出如下:

  • Visual Studio 2008—9.0

  • Visual Studio 2005—8.0

  • Visual Studio .NET 2003—7.1

  • Visual Studio .NET—7.0

  • Visual Studio 6.0, Service Pack 5—6.5

The msvc module is initialized using the following syntax:
msvc 模塊使用以下語法進行初始化:

using msvc : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the version is not explicitly specified, the most recent version found in the registry will be used instead. If the special value all is passed as the version, all versions found in the registry will be configured. If a version is specified, but the command is not, the compiler binary will be searched in standard installation paths for that version, followed by PATH.
如果版本號沒有明確指定,則使用從註冊表找以的最新版本。如果傳入的版本指定值為 all,則從註冊表找到的所有版本都將被配置。如果指定了版本,但未指定命令,則在該版本的標準安裝路徑和 PATH 中搜索編譯器的二進制文件。

The compiler command should be specified using forward slashes, and quoted.
編譯器命令應該用前導的斜槓來指定,並且用引號引起來。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

assembler

The command that compiles assembler sources. If not specified, ml will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
編譯彙編源文件的命令。如果未指定,則使用 ml。該命令在執行設置腳本及調整 PATH 變量後被調用。

compiler

The command that compiles C and C++ sources. If not specified, cl will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
編譯 C 和 C++ 源文件的命令。如果未指定,則使用 cl。該命令在執行設置腳本及調整 PATH 變量後被調用。

compiler-filter

Command through which to pipe the output of running the compiler. For example to pass the output to STLfilt.
對運行編譯器的輸出進行管道操作的命令。例如,將輸出傳遞給 STLfilt。

idl-compiler

The command that compiles Microsoft COM interface definition files. If not specified, midl will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
編譯 Microsoft COM 接口定義文件的命令。如果未指定,則使用 midl。該命令在執行設置腳本及調整 PATH 變量後被調用。

linker

The command that links executables and dynamic libraries. If not specified, link will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
鏈接可執行文件和動態庫的命令。如果未指定,則使用 link。該命令在執行設置腳本及調整 PATH 變量後被調用。

mc-compiler

The command that compiles Microsoft message catalog files. If not specified, mc will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
編譯 Microsoft 消息目錄文件的命令。如果未指定,則使用 mc。該命令在執行設置腳本及調整 PATH 變量後被調用。

resource-compiler

The command that compiles resource files. If not specified, rc will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
編譯資源文件的命令。如果未指定,則使用 rc。該命令在執行設置腳本及調整 PATH 變量後被調用。

setup

The filename of the global environment setup script to run before invoking any of the tools defined in this toolset. Will not be used in case a target platform specific script has been explicitly specified for the current target platform. Used setup script will be passed the target platform identifier (x86, x86_amd64, x86_ia64, amd64 or ia64) as a arameter. If not specified a default script is chosen based on the used compiler binary, e.g. vcvars32.bat or vsvars32.bat.
全 局的環境設置腳本文件名,在調用該工具集中所定義的任一工具之前運行。如果已經為當前的目標平台明確指定一個目標平台專用腳本,則不再使用該選項。該設置 腳本將被傳入一個目標平台標識符(x86, x86_amd64, x86_ia64, amd64 或 ia64)作為參數。如果未指定該選項,則基於所用編譯器的二進制文件選擇一個缺省腳本,如 vcvars32.batvsvars32.bat

setup-amd64>, setup-i386>, setup-ia64>

The filename of the target platform specific environment setup script to run before invoking any of the tools defined in this toolset. If not specified the global environment setup script is used.
目標平台專用的環境設置腳本文件名,在調用該工具集中所定義的任一工具之前運行。如果未指定,則使用全局的環境設置腳本。

64-bit support 對64位的支持

Starting with version 8.0, Microsoft Visual Studio can generate binaries for 64-bit processor, both 64-bit flavours of x86 (codenamed AMD64/EM64T), and Itanium (codenamed IA64). In addition, compilers that are itself run in 64-bit mode, for better performance, are provided. The complete list of compiler configurations are as follows (we abbreviate AMD64/EM64T to just AMD64):
從 版本8.0開始,Microsoft Visual Studio 可以為64位處理器生成二進制代碼,包括64位的 x86 (代號 AMD64/EM64T),以及 Itanium (代號 IA64)。另外,為了更好的性能,還提供了本身運行在64位模式下的編譯器。編譯器配置的完整列表如下(we 把 AMD64/EM64T 縮寫為 AMD64):

  • 32-bit x86 host, 32-bit x86 target

  • 32-bit x86 host, 64-bit AMD64 target

  • 32-bit x86 host, 64-bit IA64 target

  • 64-bit AMD64 host, 64-bit AMD64 target

  • 64-bit IA64 host, 64-bit IA64 target

The 32-bit host compilers can be always used, even on 64-bit Windows. On the contrary, 64-bit host compilers require both 64-bit host processor and 64-bit Windows, but can be faster. By default, only 32-bit host, 32-bit target compiler is installed, and additional compilers need to be installed explicitly.
32位主機的編譯器也可以在64位 Windows 上使用。反之,64位主機的編譯器則同時要求64位的主機處理器和64位的 Windows,但是速度更快。缺省情況下,只安裝32位主機、32位目標的編譯器,其它編譯器需要明確指定安裝。

To use 64-bit compilation you should:
要使用64位編譯,你應該:

  1. Configure you compiler as usual. If you provide a path to the compiler explicitly, provide the path to the 32-bit compiler. If you try to specify the path to any of 64-bit compilers, configuration will not work.
    如常配置你的編譯器。如果你明確指定了編譯器的路徑,就指定32位編譯器的路徑。如果你試圖指定任一個64位編譯器的路徑,則配置將不能工作。

  2. When compiling, use address-model=64, to generate AMD64 code.
    編譯的時候,使用 address-model=64,以生成 AMD64 代碼。

  3. To generate IA64 code, use architecture=ia64
    要生成 IA64 代碼,使用 architecture=ia64

The (AMD64 host, AMD64 target) compiler will be used automatically when you are generating AMD64 code and are running 64-bit Windows on AMD64. The (IA64 host, IA64 target) compiler will never be used, since nobody has an IA64 machine to test.
當 你生成 AMD64 代碼並且在 AMD64 上運行64位 Windows 時,會自動使用(AMD64 host, AMD64 target)編譯器。(IA64 host, IA64 target)編譯器不會被用到,因為沒有人有一台 IA64 的機器來測試。

It is believed that AMD64 and EM64T targets are essentially compatible. The compiler options /favor:AMD64 and /favor:EM64T, which are accepted only by AMD64 targeting compilers, cause the generated code to be tuned to a specific flavor of 64-bit x86. Boost.Build will make use of those options depending on the value of theinstruction-set feature.
可以認為 AMD64 和 EM64T 的目標本質上是兼容的。編譯器選項 /favor:AMD64/favor:EM64T 只能由 AMD64 目標的編譯器所接受,它們將導致所生成的代碼特別適用於 64-bit x86。Boost.Build 如何使用這些選項,取決於 instruction-set 特性的值。

Intel C++

The intel-linux and intel-win modules support the Intel C++ command-line compiler—the Linux and Windows versions respectively.
intel-linuxintel-win 模塊支持 Intel C++ 命令行編譯器—分別對應於 Linux Windows 版本。

The module is initialized using the following syntax:
該模塊分別使用以下語法進行初始化:

using intel-linux : [version] : [c++-compile-command] : [compiler options] ;

or

using intel-win : [version] : [c++-compile-command] : [compiler options] ;

respectively.

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If compiler command is not specified, then Boost.Build will look in PATH for an executable icpc (on Linux), or icc.exe (on Windows).
如果未指定編譯器命令,Boost.Build 將在 PATH 中查找可執行文件 icpc (在 Linux 上),或 icc.exe (在 Windows 上)。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

The Linux version supports the following additional options:
Linux 版本還支持以下選項:

root

Specifies root directory of the compiler installation. This option is necessary only if it is not possible to detect this information from the compiler command—for example if the specified compiler command is a user script.
指明編譯器安裝的根目錄。僅當不能從編譯器命令檢測得到該信息時才需要這個選項,例如當指定的編譯器命令為一個用戶腳本時。

HP aC++ compiler

The acc module supports the HP aC++ compiler for the HP-UX operating system.
acc 模塊支持 HP-UX 操作系統上的 HP aC++ 編譯器

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using acc : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, the aCC binary will be searched in PATH.
如果未指定編譯器命令,則在 PATH 中搜索 aCC 二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

Borland C++ Compiler

The borland module supports the command line C++ compiler included in C++ Builder 2006 product and earlier version of it, running on Microsoft Windows.
borland 模塊支持包含在 C++ Builder 2006 產品中的命令行 C++ 編譯器及其更早版本,運行在 Microsoft Windows 上。

The supported products are listed below. The version reported by the command lines tools is also listed for reference.:
可支持的產品列出如下。由命令行工具報告的版本也作為參考列出:

  • C++ Builder 2006—5.8.2

  • CBuilderX—5.6.5, 5.6.4 (depending on release)

  • CBuilder6—5.6.4

  • Free command line tools—5.5.1
    免費命令行工具—5.5.1

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using borland : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, Boost.Build will search for a binary named bcc32 in PATH.
如果未指定編譯器命令,Boost.Build 將在 PATH 中搜索名為 bcc32 的二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

Comeau C/C++ Compiler

The como-linux and the como-win modules supports the Comeau C/C++ Compiler on Linux and Windows respectively.
como-linuxcomo-win 模塊分別支持 Linux 和 Windows 上的 Comeau C/C++ 編譯器

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using como-linux : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, Boost.Build will search for a binary named como in PATH.
如果未指定編譯器命令,Boost.Build 將在 PATH 中搜索名為 como 的二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

Before using the Windows version of the compiler, you need to setup necessary environment variables per compiler's documentation. In particular, the COMO_XXX_INCLUDE variable should be set, where XXX corresponds to the used backend C compiler.
在使用該編譯器的 Windows 版本之前,你必須根據編譯器的文檔設置必要的環境變量。特別是,應設置 COMO_XXX_INCLUDE 變量,其中 XXX 對應於所用的後端 C 編譯器。

Code Warrior

The cw module support CodeWarrior compiler, originally produced by Metrowerks and presently developed by Freescale. Boost.Build supports only the versions of the compiler that target x86 processors. All such versions were released by Metrowerks before aquisition and are not sold any longer. The last version known to work is 9.4.
cw 模塊支持 CodeWarrior 編譯器,早先由 Metrowerks 生產,現在由 Freescale 開發。Boost.Build 只支持以 x86 處理器為目標的編譯器版本。所有這些版本都是在收購前由 Metrowerks 發佈的,已不再銷售。已知可用的最後版本是 9.4.

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using cw : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, Boost.Build will search for a binary named mwcc in default installation paths and in PATH.
如果未指定編譯器命令,Boost.Build 將在 PATH 中搜索名為 mwcc 的二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

root

Specifies root directory of the compiler installation. This option is necessary only if it is not possible to detect this information from the compiler command—for example if the specified compiler command is a user script.
指明編譯器安裝的根目錄。僅當不能從編譯器命令檢測得到該信息時才需要這個選項,例如當指定的編譯器命令為一個用戶腳本時。

setup

The command that sets up environment variables prior to invoking the compiler. If not specified, cwenv.bat alongside the compiler binary will be used.
該命令在調用編譯器之前設置環境變量。如果未指定,則使用與編譯器二進制文件一起的 cwenv.bat

compiler

The command that compiles C and C++ sources. If not specified, mwcc will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
編譯 C 和 C++ 源文件的命令。如果未指定,則使用 mwcc。該命令在執行設置腳本及調整 PATH 變量後被調用。

linker

The command that links executables and dynamic libraries. If not specified, mwld will be used. The command will be invoked after the setup script was executed and adjusted the PATH variable.
鏈接可執行文件和動態庫的命令。如果未指定,則使用 mwld。該命令在執行設置腳本及調整 PATH 變量後被調用。

Digital Mars C/C++ Compiler

The dmc module supports the Digital Mars C++ compiler.
dmc 模塊支持 Digital Mars C++ 編譯器。

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using dmc : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, Boost.Build will search for a binary named como in PATH.
如果未指定編譯器命令,Boost.Build 將在 PATH 中搜索名為 como 的二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

HP C++ Compiler for Tru64 Unix

The hp_cxx modules supports the HP C++ Compiler for Tru64 Unix.
hp_cxx 模塊支持 Tru64 Unix 的 HP C++ 編譯器

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using hp_cxx : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, Boost.Build will search for a binary named hp_cxx in PATH.
如果未指定編譯器命令,Boost.Build 將在 PATH 中搜索名為 hp_cxx 的二進制文件。

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

Sun Studio

The sun module supports the Sun Studio C++ compilers for the Solaris OS.
sun 模塊支持 Solaris OS 的 Sun Studio C++ 編譯器。

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using sun : [version] : [c++-compile-command] : [compiler options] ;

This statement may be repeated several times, if you want to configure several versions of the compiler.
如果你想配置多個版本的編譯器,這一語句可以重複多次。

If the command is not specified, Boost.Build will search for a binary named CC in /opt/SUNWspro/bin and in PATH.
如果未指定編譯器命令,Boost.Build 將在 /opt/SUNWspro/binPATH 中搜索名為 CC 的二進制文件。

When using this compiler on complex C++ code, such as the Boost C++ library, it is recommended to specify the following options when intializing the sun module:
如果該編譯器用於複雜的 C++ 代碼,如 Boost C++ 庫,建議在初始化 sun 模塊時指定以下選項:

-library=stlport4 -features=tmplife -features=tmplrefstatic

See the Sun C++ Frontend Tales for details.
詳情請見 Sun C++ Frontend Tales

The following options can be provided, using <option-name>option-value syntax:
可使用 <option-name>option-value 語法提供以下選項:

cflags

Specifies additional compiler flags that will be used when compiling C sources.
指定在編譯 C 源文件時使用的其它編譯器選項。

cxxflags

Specifies additional compiler flags that will be used when compiling C++ sources.
指定在編譯 C++ 源文件時使用的其它編譯器選項。

compileflags

Specifies additional compiler flags that will be used when compiling both C and C++ sources.
指定在編譯 C 和 C++ 源文件時使用的其它編譯器選項。

linkflags

Specifies additional command line options that will be passed to the linker.
指定傳遞給鏈接器的其它命令行選項。

Starting with Sun Studio 12, you can create 64-bit applications by using the address-model=64 property.
從 Sun Studio 12 開始,你可以使用 address-model=64 屬性來創建64位應用。
IBM Visual Age

The vacpp module supports the IBM Visual Age C++ Compiler, for the AIX operating system. Versions 7.1 and 8.0 are known to work.
vacpp 模塊支持 AIX 操作系統的 IBM Visual Age C++ 編譯器。已知可用於版本 7.1 和 8.0。

The module is initialized using the following syntax:
該模塊使用以下語法進行初始化:

using vacpp ;

The module does not accept any initialization options. The compiler should be installed in the /usr/vacpp/bin directory.
該模塊不接受任何初始化選項。編譯器應安裝在 /usr/vacpp/bin 目錄。

Later versions of Visual Age are known as XL C/C++. They were not tested with the the vacpp module.
Visual Age 的後續版本稱為 XL C/C++。它們未與 vacpp 模塊測試過。

Third-party libraries 第三方庫

Boost.Build provides special support for some third-party C++ libraries, documented below.
Boost.Build 提供了對一些第三方 C++ 庫的支持,說明如下。

STLport library  STLport庫

The STLport library is an alternative implementation of C++ runtime library. Boost.Build supports using that library on Windows platfrom. Linux is hampered by different naming of libraries in each STLport version and is not officially supported.
STLport 庫是 C++ 運行庫一個可選的實現。Boost.Build 支持在 Windows 平台上使用該庫。Linux 則受制於各個 STLport 版本的庫名不同以及無官方支持。

Before using STLport, you need to configure it in user-config.jam using the following syntax:
在使用 STLport 前,你必須在 user-config.jam 中用以下語法對它進行配置:

using stlport : [version] : header-path : [library-path] ;

Where version is the version of STLport, for example 5.1.4, headers is the location where STLport headers can be found, and libraries is the location where STLport libraries can be found. The version should always be provided, and the library path should be provided if you're using STLport's implementation of iostreams. Note that STLport 5.* always uses its own iostream implementation, so the library path is required.
其中 version 為 STLport 的版本,如 5.1.4headers 為可找到 STLport 頭文件的位置,而 libraries 為可找到 STLport 庫的位置。版本號必須提供,如果你要使用 STLport 的 iostreams 實現,則庫路徑也要提供。注意,STLport 5.* 總是使用它自己的 iostream 實現,所以要求必須提供庫路徑。

When STLport is configured, you can build with STLport by requesting stdlib=stlport on the command line.
在配置完 STLport 後,你就可以通過在命令行請求 stdlib=stlport 來以 STLport 進行構建。

Build process 構建過程

The general overview of the build process was given in the user documentation. This section provides additional details, and some specific rules.
構建過程的概述已經在 用戶文檔 中給出。本節給出了更多細節,以及一些特殊的規則。

To recap, building a target with specific properties includes the following steps:
重溫一下,以特定屬性構建一個目標,包括以下步驟:

  1. applying default build,
    應用缺省的構建,

  2. selecting the main target alternative to use,
    選擇所用的主目標選擇,

  3. determining "common" properties,
    確定"公用"屬性,

  4. building targets referred by the sources list and dependency properties,
    構建由源列表和依賴關係屬性所指定的目標,

  5. adding the usage requirements produces when building dependencies to the "common" properties,
    將在構建信賴關係時產生的使用要求增加到"公用"屬性中,

  6. building the target using generators,
    使用生成器構建目標,

  7. computing the usage requirements to be returned.
    計算返回的使用要求。

Alternative selection 選擇

When there are several alternatives, one of them must be selected. The process is as follows:
當有多個可選物時,必須選擇其中一個。過程如下:

  1. For each alternative condition is defined as the set of base properties in requirements. [Note: it might be better to specify the condition explicitly, as in conditional requirements].
    對於每一個可選物,condition 被定義為在要求中的基本屬性集。[註:明確指定條件可能更好些,就像在條件要求中那樣]。
  2. An alternative is viable only if all properties in condition are present in build request.
    一個可選物僅當條件中的所有屬性都出現在構建請求中時才是可見的。
  3. If there's one viable alternative, it's choosen. Otherwise, an attempt is made to find one best alternative. An alternative a is better than another alternative b, iff the set of properties in b's condition is a strict subset of the set of properities of 'a's condition. If there's one viable alternative, which is better than all others, it's selected. Otherwise, an error is reported.
    如果只有一個可見的可選物,則它被選中。否則,嘗試找到最好的可選物。可選物 a 優於可選物 b,當且僅當 b 的條件中的屬性集是 a 的條件中的屬性集的嚴格子集。如果只有一個可見的可選物優於所有其它可選物,則它被選中。否則,報告一個錯誤。

Determining common properties 確定公用屬性

The "common" properties is a somewhat artificial term. Those are the intermediate property set from which both the build request for dependencies and properties for building the target are derived.
"公用"屬性是一個有點不太自然的術語。它們是一個中間屬性集,來自於依賴關係的構建請求和構建被派生目標的屬性。

Since default build and alternatives are already handled, we have only two inputs: build requests and requirements. Here are the rules about common properties.
由於缺省構建和可選物都已經被處理過了,所以我們只有兩個輸入:構建請求和要求。以下是關於公用屬性的規則。

  1. Non-free feature can have only one value
    非自由特性只能一個值。

  2. A non-conditional property in requirement in always present in common properties.
    要求中的非條件屬性總是出現在公用屬性中。

  3. A property in build request is present in common properties, unless (2) tells otherwise.
    構建請求中的屬性會出現在公用屬性中,除非被第 (2) 條否定。

  4. If either build request, or requirements (non-conditional or conditional) include an expandable property (either composite, or property with specified subfeature value), the behaviour is equivalent to explicitly adding all expanded properties to build request or requirements.
    如果構建請求或要求(非條件的或有條件的)中包含了一個可展開屬性(組合屬性或具有指定子特性值的屬性),則其行為相當於將所有展開後的屬性顯式增加到構建請求或要求中。

  5. If requirements include a conditional property, and condiiton of this property is true in context of common properties, then the conditional property should be in common properties as well.
    如果要求中包含一個條件屬性,且在公用屬性的上下文中該屬性的條件為真,則該條件屬性也應在公用屬性中。

  6. If no value for a feature is given by other rules here, it has default value in common properties.
    如果以上規則未能對一個特性給出值,則它在公用屬性中具有缺省值。

Those rules are declarative, they don't specify how to compute the common properties. However, they provide enough information for the user. The important point is the handling of conditional requirements. The condition can be satisfied either by property in build request, by non-conditional requirements, or even by another conditional property. For example, the following example works as expected:
這些規則是宣示性的,它們並未具體說明如何計算公用屬性。不過,它們為用戶提供了足夠的信息。重點是對條件要求的處理。條件可以由構建請求中的屬性得到滿足,也可以由非條件要求,甚至由另一個條件屬性而得到滿足。例如,以下例子可以按預期工作:

exe a : a.cpp
: <toolset>gcc:<variant>release
<variant>release:<define>FOO ;

Definitions 定義

Features and properties 特性和屬性

A feature is a normalized (toolset-independent) aspect of a build configuration, such as whether inlining is enabled. Feature names may not contain the '>' character.
特性 是指構建配置的一個規範化(與工具集無關)的方面,如是否打開內聯。特性名不能包含 '>' 符。

Each feature in a build configuration has one or more associated values. Feature values for non-free features may not contain the '<', ':', or '=' characters. Feature values for free features may not contain the '<' character.
在構建配置中的各個特性有一個或多個關聯的 。非自由特性的特性值不能包含 '<', ':', 或 '=' 符。自由特性的特性值不能包含 '<' 符。

A property is a (feature,value) pair, expressed as <feature>value.
屬性 是指一個(特性,值)對,表示為 <feature>value。

A subfeature is a feature that only exists in the presence of its parent feature, and whose identity can be derived (in the context of its parent) from its value. A subfeature's parent can never be another subfeature. Thus, features and their subfeatures form a two-level hierarchy.
子特性 是指只能存在於其父特性之中的特性,其標識可以派生(在其父特性的上下文中)自它的值。子特性的父特性不可以是另一個子特性。因此,特性及其子特性形成一個兩級的層次。

A value-string for a feature F is a string of the form value-subvalue1-subvalue2...-subvalueN, where value is a legal value for F and subvalue1...subvalueN are legal values of some of F's subfeatures. For example, the properties <toolset>gcc <toolset-version>3.0.1 can be expressed more conscisely using a value-string, as <toolset>gcc-3.0.1.
特性 F 的一個 值串 是指一個形如 value-subvalue1-subvalue2...-subvalueN 的字符串,其中 valueF 的一個合法值,而 subvalue1...subvalueNF 的某些子特性的合法值。例如,屬性 <toolset>gcc <toolset-version>3.0.1 可以更方便地用一個值串來表示,如 <toolset>gcc-3.0.1.

A property set is a set of properties (i.e. a collection without duplicates), for instance: <toolset>gcc <runtime-link>static.
屬性集 是指一組屬性(即一個無重複的集合),例如:<toolset>gcc <runtime-link>static.

A property path is a property set whose elements have been joined into a single string separated by slashes. A property path representation of the previous example would be <toolset>gcc/<runtime-link>static.
屬性路徑 是指一個其元素被以斜槓符分隔而合成單個字符串的屬性集。上一例子的屬性路徑表示為:<toolset>gcc/<runtime-link>static.

A build specification is a property set that fully describes the set of features used to build a target.
構建規格 是指這樣一個屬性集,它完整地描述了用於構建某個目標的特性集。

Property Validity 屬性的有效性

For free features, all values are valid. For all other features, the valid values are explicitly specified, and the build system will report an error for the use of an invalid feature-value. Subproperty validity may be restricted so that certain values are valid only in the presence of certain other subproperties. For example, it is possible to specify that the <gcc-target>mingw property is only valid in the presence of <gcc-version>2.95.2
對於 自由 特性,所有值都是有效的。對於其它特性,有效值應明確指定,構建系統會對一個無效特性值的使用報告錯誤。子屬性的有效性可能受到限制,如某個特定的值僅當另一個特定的子屬性出現時才是有效。例如,可以指定 <gcc-target>mingw 屬性僅當 <gcc-version>2.95.2 出現時有效。

Feature Attributes 特性的特徵

Each feature has a collection of zero or more of the following attributes. Feature attributes are low-level descriptions of how the build system should interpret a feature's values when they appear in a build request. We also refer to the attributes of properties, so that an incidental property, for example, is one whose feature has the incidental attribute.
每一個特性都具有以下特徵中的零個或多個。特性的特徵是構建系統如何解釋在構建請求中的特性值的一個底層說明。我們也稱為之屬性的特徵,因此例如,一個 附帶 屬性,是指其特性具有 附帶 特徵。

  • incidental 附帶的

    Incidental features are assumed not to affect build products at all. As a consequence, the build system may use the same file for targets whose build specification differs only in incidental features. A feature that controls a compiler's warning level is one example of a likely incidental feature.
    附帶特性被假定為不會對構建產品產生影響。結果是,構建系統可能會對構建規格中僅有附帶特性存在差異的目標使用相同的文件。控制編譯器告警級別的特性就是附帶特性一個好例子。

    Non-incidental features are assumed to affect build products, so the files for targets whose build specification differs in non-incidental features are placed in different directories as described in "target paths" below. [ where? ]
    非附帶特性被假定會影響構建產品,所以對於構建規格中有非附帶特性存在差異的目標,其目標文件被放在不同的目錄下,後面的"目標路徑"中會有說明。

  • propagated 被傳播的

    Features of this kind are propagated to dependencies. That is, if a main target is built using a propagated property, the build systems attempts to use the same property when building any of its dependencies as part of that main target. For instance, when an optimized exectuable is requested, one usually wants it to be linked with optimized libraries. Thus, the <optimization> feature is propagated.
    此類特性會被傳播至依賴物中。即,如果一個 主目標 是以某個被傳播特性構建的,則構建系統會在構建該主目標的依賴物時,嘗試使用同樣的特性。例如,當請求構建一個優化的可執行文件時,你通常希望它與優化的庫文件鏈接。因此,<optimization> 特性就是被傳播的。

  • free 自由的

    Most features have a finite set of allowed values, and can only take on a single value from that set in a given build specification. Free features, on the other hand, can have several values at a time and each value can be an arbitrary string. For example, it is possible to have several preprocessor symbols defined simultaneously:
    多數特性都具有有限的允許值集,而且在一個給定的構建規格中只能取這個集中一個值。另一方面,自由特性可以一次取多個值,且每個值都可以是任意的字符串。例如,可以同時定義多個預處理器符號:

    <define>NDEBUG=1 <define>HAS_CONFIG_H=1
  • optional 可選的

    An optional feature is a feature that is not required to appear in a build specification. Every non-optional non-free feature has a default value that is used when a value for the feature is not otherwise specified, either in a target's requirements or in the user's build request. [A feature's default value is given by the first value listed in the feature's declaration. -- move this elsewhere - dwa]
    可選特性是指不要求出現在構建規格中的特性。每個非可選的非自由特性都有一個缺省值,當該特性的值在目標要求及用戶構建請求中均未被指定時將使用該缺省值。[特性的缺省值由列在特性聲明中的第一個值給定]

  • symmetric 對稱的

    A symmetric feature's default value is not automatically included in build variants. Normally a feature only generates a subvariant directory when its value differs from the value specified by the build variant, leading to an assymmetric subvariant directory structure for certain values of the feature. A symmetric feature, when relevant to the toolset, always generates a corresponding subvariant directory.
    對稱特性的缺省值不會自動包含到 構建變體 中。通常,當一個特性的值與構建變體指定的值不同時,它只生成一個子變體目錄,這導致了對該特性的特定值有一個非對稱的子變體目錄結構。與工具有關的對稱特性,總是生成一個相應的子變體目錄。

  • path 路徑的

    The value of a path feature specifies a path. The path is treated as relative to the directory of Jamfile where path feature is used and is translated appropriately by the build system when the build is invoked from a different directory
    路徑特性的值指定一個路徑。該路徑被視為相對於使用該路徑特性的 Jamfile 的目錄,並且在從不同目錄進行調用該構建時被構建系統適當轉換。

  • implicit 隱式的

    Values of implicit features alone identify the feature. For example, a user is not required to write "<toolset>gcc", but can simply write "gcc". Implicit feature names also don't appear in variant paths, although the values do. Thus: bin/gcc/... as opposed to bin/toolset-gcc/.... There should typically be only a few such features, to avoid possible name clashes.
    隱 式特性的值獨自標識該特性。例如,用戶不需要寫 "<toolset>gcc",只要寫 "gcc" 即可。隱式特性的名字也不會出現在變體路徑中,但它的值會。因此:是 bin/gcc/... 而不是 bin/toolset-gcc/...。通常應該只有少數幾個這樣的特性,以避免可能的名字衝突。

  • composite 組合的

    Composite features actually correspond to groups of properties. For example, a build variant is a composite feature. When generating targets from a set of build properties, composite features are recursively expanded and added to the build property set, so rules can find them if necessary. Non-composite non-free features override components of composite features in a build property set.
    組合特性實際上相應於一個屬性組。例如,一個構建變體就是一個組合特性。當從一個構建屬性集生成目標時,組合特性被遞歸展開,並增加到構建屬性集中,規則在需要時就可找到它們。非組合的非自由特性會覆蓋構建屬性集中的組合特性的元素。

  • dependency 依賴的

    The value of dependency feature if a target reference. When used for building of a main target, the value of dependency feature is treated as additional dependency.
    依賴特性的值是一個目標引用。當它被用於一個主目標的構建時,依賴特性的值被視為附加的依賴關係。

    For example, dependency features allow to state that library A depends on library B. As the result, whenever an application will link to A, it will also link to B. Specifying B as dependency of A is different from adding B to the sources of A.
    例如,依賴特性允許聲明 A 庫依賴於 B 庫。這樣,當一個應用程序要鏈接 A 時,它一定也會鏈接 B。指明 B 是 A 的依賴物,與將 B 增加為 A 的源,是不同的。

Features that are neither free nor incidental are called base features.
即非自由亦非附帶的特性被稱為 基本 特性。

Feature Declaration 特性的聲明

The low-level feature declaration interface is the feature rule from the feature module:
低級特性的聲明接口是 feature 規則,它來自於 feature 模塊:

rule feature ( name : allowed-values * : attributes * )

A feature's allowed-values may be extended with the feature.extend rule.
特性的允許值可以用 feature.extend 規則來擴展。

Build Variants 構建變體

A build variant, or (simply variant) is a special kind of composite feature that automatically incorporates the default values of features that . Typically you'll want at least two separate variants: one for debugging, and one for your release code. [ Volodya says: "Yea, we'd need to mention that it's a composite feature and describe how they are declared, in pacticular that default values of non-optional features are incorporated into build variant automagically. Also, do we wan't some variant inheritance/extension/templates. I don't remember how it works in V1, so can't document this for V2.". Will clean up soon -DWA ]
構 建變體(或變體)是一種特殊的組合特性,它自動合併特性的缺省值。通常,你至少想要兩個獨立的變體:一個用於調試,另一個用於發佈代碼。[ Volodya 說:"是的,我們需要指出的是,它是一個組合特性並描述如何聲明它,具體地說,非可選特性的缺省值被自動合併到構建變體中。還有,我們希望有一些變體層 次、擴展或模板。我不記得在 V1 中它是如何工作的,所以不能在 V2 中說明它了。". 將盡快清理 -DWA ]

Property refinement 屬性的精化

When a target with certain properties is requested, and that target requires some set of properties, it is needed to find the set of properties to use for building. This process is called property refinement and is performed by these rules
當請求一個帶有特定屬性的目標,且該目標要求某些屬性集時,需要找出構建所用的屬性集。這一過程稱為 屬性精化,它由以下規則執行

  1. Each property in the required set is added to the original property set
    在要求集中的每個屬性被增加到原先的屬性集中
  2. If the original property set includes property with a different value of non free feature, that property is removed.
    如果原先的屬性集含有某個非自由特性的不同值屬性,則該屬性被移除。

Conditional properties 條件屬性

Sometime it's desirable to apply certain requirements only for a specific combination of other properties. For example, one of compilers that you use issues a pointless warning that you want to suppress by passing a command line option to it. You would not want to pass that option to other compilers. Conditional properties allow you to do just that. Their syntax is:
有時,我們希望僅對某些屬性的特定組合應用特定的要求。例如,你所使用的某個編譯器會發出一個毫無意義的警告,你想通過命令行選項來禁止它。但是你又不想將這個選項傳給其它編譯器。條件屬性允許你這樣做。其語法是:

        property ( "," property ) * ":" property

For example, the problem above would be solved by:
例如,以上問題可以這樣來解決:

exe hello : hello.cpp : <toolset>yfc:<cxxflags>-disable-pointless-warning ;

The syntax also allows several properties in the condition, for example:
該語法還允許在條件中使用多個屬性,例如:

exe hello : hello.cpp : <os>NT,<toolset>gcc:<link>static ;

Target identifiers and references 目標標識符和引用

Target identifier is used to denote a target. The syntax is:
目標標識符 用於表示一個目標。其語法是:

target-id -> (project-id | target-name | file-name )
| (project-id | directory-name) "//" target-name
project-id -> path
target-name -> path
file-name -> path
directory-name -> path

This grammar allows some elements to be recognized as either
該語法允許以下一些元素:

  • project id (at this point, all project ids start with slash).
    工程 id (當前,所有工程 id 要以斜槓符開頭)。
  • name of target declared in current Jamfile (note that target names may include slash).
    在當前 Jamfile 所聲明的目標名(注意,目標名可以含有斜槓符)。
  • a regular file, denoted by absolute name or name relative to project's sources location.
    一個普通文件,以絕對名字或相對於工程源文件位置的名字來表示。

To determine the real meaning a check is made if project-id by the specified name exists, and then if main target of that name exists. For example, valid target ids might be:
為了確定真正的意義,需要檢查指定名字的 project-id 是否存在,然後是是否有該名字的主目標存在。例如,有效的目標 id 可以是:

a                                    -- target in current project 在當前工程中的目標
lib/b.cpp -- regular file 普通文件
/boost/thread -- project "/boost/thread" 工程"/boost/thread"
/home/ghost/build/lr_library//parser -- target in specific project 指定工程中的目標

Rationale:Target is separated from project by special separator (not just slash), because:
原理:目標是以特定的分隔符(不僅是斜槓符)和工程分開的,因為:

  • It emphasises that projects and targets are different things.
    它強調工程和目標是不同的東西。
  • It allows to have main target names with slashes.
    它允許主目標名帶有斜槓符。

Target reference is used to specify a source target, and may additionally specify desired properties for that target. It has this syntax:
目標引用 用於指定一個源目標,還可以指定該目標所需要的屬性。它具有以下語法:

target-reference -> target-id [ "/" requested-properties ]
requested-properties -> property-path

For example,
例如,

          exe compiler : compiler.cpp libs/cmdline/<optimization>space ;

would cause the version of cmdline library, optimized for space, to be linked in even if the compiler executable is build with optimization for speed.
將導致這個版本的 cmdline 庫按空間優化並鏈接,即使 compiler 可執行文件是以按速度優化來構建的。

Generators 生成器

[Warning] Warning 警告

The information is this section is likely to be outdated and misleading.

本節中的信息可能是過期的和容易誤解的。

To construct a main target with given properties from sources, it is required to create a dependency graph for that main target, which will also include actions to be run. The algorithm for creating the dependency graph is described here.
要以來自於源目標的給定屬性構造一個主目標,就需要為主目標創建一個依賴關係圖,其中還應包含要運行的動作。以下講述創建該依賴關係圖的算法。

The fundamental concept is generator. If encapsulates the notion of build tool and is capable to converting a set of input targets into a set of output targets, with some properties. Generator matches a build tool as closely as possible: it works only when the tool can work with requested properties (for example, msvc compiler can't work when requested toolset is gcc), and should produce exactly the same targets as the tool (for example, if Borland's linker produces additional files with debug information, generator should also).
基礎的概念是 生成器。 它封裝了構建工具的概念,可以將一組輸入目標以某些屬性轉換為一組輸出目標。生成器盡可能地靠近構建工具:它僅當該工具可以按請求屬性使用時才可用(例 如,當請求工具集是 gcc 時,msvc 編譯器不能使用),並且應當與工具產生完全相同的目標(例如,如果 Borland 的鏈接器帶調試信息時產生額外的文件,則生成器也應如此)。

Given a set of generators, the fundamental operation is to construct a target of a given type, with given properties, from a set of targets. That operation is performed by rule generators.construct and the used algorithm is described below.
給定一組生成器,基本的操作是以給定屬性從一組目標構造給定類型的一個目標。該操作由規則 generators.construct 完成,所用的算法描述如下。

Selecting and ranking viable generators 選擇可行的生成器並進行排隊

Each generator, in addition to target types that it can produce, have attribute that affects its applicability in particular sitiation. Those attributes are:
每一個生成器,除了它可以產生的目標類型之外,還具有在特定情況下影響其適用性的特徵。這些牲有:

  1. Required properties, which are properties absolutely necessary for the generator to work. For example, generator encapsulating the gcc compiler would have <toolset>gcc as required property.
    必選屬性,使用生成器時必須要的屬性。例如,封裝了 gcc 編譯器的生成器應有一個 <toolset>gcc 作為必選屬性。
  2. Optional properties, which increase the generators suitability for a particual build.
    可選屬性,增加生成對特殊構建的適用性。

Generator's required and optional properties may not include either free or incidental properties. (Allowing this would greatly complicate caching targets).
生成器的必選屬性和可選屬性不允許包含自由屬性或附帶屬性。(如果允許會使得目標的緩存非常複雜)。

When trying to construct a target, the first step is to select all possible generators for the requested target type, which required properties are a subset of requested properties. Generators that were already selected up the call stack are excluded. In addition, if any composing generators were selected up the call stack, all other composing generators are ignored (TODO: define composing generators). The found generators are assigned a rank, which is the number of optional properties present in requested properties. Finally, generators with highest rank are selected for futher processing.
在 嘗試構造一個目標時,第一步是為請求的目標類型選擇所有可能的生成器,這些生成器的必選屬性是請求屬性的一個子集。在調用棧之上的已經選出來的生成器被排 除在外。此外,如果在調用棧之上已有某個組合生成器被選中,那麼所有其它組合生成器都將忽略(待辦:組合生成器的定義)。找到的生成器被賦予一個分數,它 是在請求屬性中出現的可選屬性的數量。最後,最高分數的生成器被選中作進一步的處理。

Running generators 運行生成器

When generators are selected, each is run to produce a list of created targets. This list might include targets that are not of requested types, because generators create the same targets as some tool, and tool's behaviour is fixed. (Note: should specify that in some cases we actually want extra targets). If generator fails, it returns an empty list. Generator is free to call 'construct' again, to convert sources to the types it can handle. It also can pass modified properties to 'construct'. However, a generator is not allowed to modify any propagated properties, otherwise when actually consuming properties we might discover that the set of propagated properties is different from what was used for building sources.
當 生成器被選中後,每一個都將被運行,以產生一個創建目標列表。該列表中可能包含不是請求類型的目標,因為生成器和某個工具一樣創建相同的目標,而工具的行 為是固定的(註:應該指出,在某些情況下,我們確實想要額外的目標)。如果生成器失敗了,它返回一個空列表。生成器可以自由地再次調用 'construct',將源目標轉換為它可以處理的類型。它還可以傳遞修改過的屬性給 'construct'。但是,生成器不允許修改任意被傳播屬性,否則在真正消費屬性時,我們會發現被傳播屬性集與構建源目標所用的有所不同。

For all targets that are not of requested types, we try to convert them to requested type, using a second call to construct. This is done in order to support transformation sequences where single source file expands to several later. See this message for details.
對於所有非請求類型的目標,我們嘗試用第二次 construct 調用將它們轉換為請求類型。這樣做是為了支持轉換序列,稍後它將把單個源文件展開為多個。詳情請見 該信息

Selecting dependency graph 選擇依賴關係圖

After all generators are run, it is necessary to decide which of successfull invocation will be taken as final result. At the moment, this is not done. Instead, it is checked whether all successfull generator invocation returned the same target list. Error is issued otherwise.
在所有生成器都運行後,需要確定哪一個成功的調用被作為最終結果。目前,還沒有這樣做。相反,是檢查是否所有成功的生成器調用都返回相同的目標列表。否則就引發一個錯誤。

Property adjustment 屬性的調整

Because target location is determined by the build system, it is sometimes necessary to adjust properties, in order to not break actions. For example, if there's an action that generates a header, say "a_parser.h", and a source file "a.cpp" which includes that file, we must make everything work as if a_parser.h is generated in the same directory where it would be generated without any subvariants.
因為目標的位置是由構建系統決定的,有時候為了不中斷動作,需要調整屬性。例如,如果有一個動作要生成一個頭文件,名為 "a_parser.h",而源文件 "a.cpp" 包含該頭文件,那麼我們必須讓所有東西好像 a_parser.h 已經被生成在它不帶任何變體時應被生成的同一個目錄中那樣工作。

Correct property adjustment can be done only after all targets are created, so the approach taken is:
正確的屬性調整只能在所有目標被創建後才能進行,因此採取的方法是:

  1. When dependency graph is constructed, each action can be assigned a rule for property adjustment.
    當依賴關係圖被構造時,每個動作都可以被賦予一個屬性調整的規則。

  2. When virtual target is actualized, that rule is run and return the final set of properties. At this stage it can use information of all created virtual targets.
    當虛擬目標被實現時,該規則被運行並返回最終的屬性集。在此階段,它可以使用所有已創建的虛擬目標的信息。

In case of quoted includes, no adjustment can give 100% correct results. If target dirs are not changed by build system, quoted includes are searched in "." and then in include path, while angle includes are searched only in include path. When target dirs are changed, we'd want to make quoted includes to be search in "." then in additional dirs and then in the include path and make angle includes be searched in include path, probably with additional paths added at some position. Unless, include path already has "." as the first element, this is not possible. So, either generated headers should not be included with quotes, or first element of include path should be ".", which essentially erases the difference between quoted and angle includes. Note: the only way to get "." as include path into compiler command line is via verbatim compiler option. In all other case, Boost.Build will convert "." into directory where it occurs.
在 使用帶引號的包含時,沒有調整可以給出100%正確的結果。如果目標目錄沒有被構建系統修改,則帶引號的包含會在 "." 中搜索,然後在包含路徑中搜索,而帶尖括號的包含則只在包含路徑中搜索。如果目標目錄被修改,我們希望在 "." 中搜索帶引號的包含,然後在其它目錄,再在包含路徑中搜索,而帶尖括號的包含則在包含路徑中搜索,可能在某些位置會增加其它路徑。除非包含路徑已經以 "." 作為第一個元素,否則這是不可能的。因此,要麼被生成的頭文件不要用引號來包含,要麼包含路徑的第一個元素為 ".",這本質上消除了引號包含和尖括號包含間的差異。註:讓 "." 作為包含路徑傳給編譯器命令行的唯一方法是,通過逐字編譯器選項。其它所有方式,Boost.Build 都會將 "." 轉換為它所在的目錄。

Transformations cache 轉換的緩存

Under certain conditions, an attempt is made to cache results of transformation search. First, the sources are replaced with targets with special name and the found target list is stored. Later, when properties, requested type, and source type are the same, the store target list is retrieved and cloned, with appropriate change in names.
在特定條件下,會嘗試緩存轉換查找的結果。首先,源目標被替換為帶特殊名字的目標,並保存被找到的目標列表。稍後,如果屬性、請求類型,和源類型都相同時,保存的目標列表就會被取回並克隆,並適當修改名字。


PrevUpHomeNext