Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Installation 安裝

This section describes how to install Boost.Build from a released Boost source distribution or CVS image. [4] All paths are given relative to the Boost.Build v2 root directory, which is located in the tools/build/v2 subdirectory of a full Boost distribution. [5]
本節描述如何從一個 Boost 源分發包CVS 映像 安裝  Boost.Build。[4] 所有給出的路徑均相對於 Boost.Build v2 的根目錄,位於完整的 Boost 分發包tools/build/v2 子目錄。[5]

  1. Boost.Build uses Boost.Jam, an extension of the Perforce Jam portable make replacement. The recommended way to get Boost.Jam is to download a prebuilt executable from SourceForge. If a prebuilt executable is not provided for your platform or you are using Boost's sources in an unreleased state, it may be necessary to build bjam from sources included in the Boost source tree.
    Boost.Build 使用了 Boost.Jam,它是 Perforce Jam 的擴展,一個可移植的 make 替代品。獲取 Boost.Jam 的推薦方式是從 SourceForge 下載一個預構建的可執行文件。 如果沒有為你的平台提供一個預構建的可執行文件,或者你使用的是處於未發佈狀態的 Boost 源文件,就可能需要用包含在 Boost 源文件樹中的 源程序來構建 bjam
  2. To install Boost.Jam, copy the executable, called bjam or bjam.exe to a location accessible in your PATH. Go to the Boost.Build root directory and run bjam --version. You should see:
    要安裝 Boost.Jam,請將名為 bjambjam.exe 的可執行文件拷貝到你的 PATH 中的一個可訪問位置。轉到 Boost.Build 的根目錄並運行 bjam --version. 你將看到:

                Boost.Build V2 (Milestone N)
    Boost.Jam xx.xx.xx

    where N is the version of Boost.Build you're using.
    其中 N 為你正在使用的 Boost.Build 的版本。

  3. Configure Boost.Build to recognize the build resources (such as compilers and libraries) you have installed on your system. Open the user-config.jam file in the Boost.Build root directory and follow the instructions there to describe your toolsets and libraries, and, if necessary, where they are located.
    配置 Boost.Build 以認可你的系統中已安裝的構建資源(如編譯器和庫)。打開位於 Boost.Build 根目錄中的 user-config.jam 文件並按照那裡的指令描述你的工具集和庫,並且,如果需要,還要給出它們的位置。
  4. You should now be able to go to the example/hello/ directory and run bjam there. A simple application will be built. You can also play with other projects in the example/ directory.
    你現在應該可以轉到 example/hello/ 目錄並在那裡運行 bjam。一個簡單的應用程序將被構建。你也可以試一下在 example/ 目錄下的其它工程。

If you are using Boost's CVS state, be sure to rebuild bjam even if you have a previous version. The CVS version of Boost.Build requires the CVS version of Boost.Jam.
如果你使用 Boost 的 CVS 狀態,請確認即使你已有一個舊的版本也要重新構建 bjam。Boost.Build 的 CVS 版本需要 Boost.Jam 的 CVS 版本。

When bjam is invoked, it always needs to be able to find the Boost.Build root directory, where the interpreted source code of Boost.Build is located. There are two ways to tell bjam about the root directory:
bjam 被調用時,必須總是要能夠找到 Boost.Build 根目錄,以解釋 Boost.Build 的源代碼位置。有兩種方法告訴 bjam 根目錄在哪:

Information for distributors 發行人的信息

If you're planning to package Boost.Build for a Linux distribution, please follow these guidelines:
如果你計劃為一個 Linux 分發包打包 Boost.Build,請按以下指引:

If those guidelines are met, users will be able to invoke bjam without any explicit configuration.
只要按照以上指引,用戶無需進行任何配置就可以調用 bjam



[4] Note that packages prepared for Unix/Linux systems usually make their own choices about where to put things and even which parts of Boost to include. When we say 「released source distribution」 we mean a distribution of Boost as released on its SourceForge project page.
注意,為 Unix/Linux 系統準備的包,對於將東西放在何處,甚至包含 Boost 的哪部分,通常有它們自己的選擇。我們所說的"發佈版本源文件包"是指在 Boost 的 SourceForge 工程主頁 上發佈的 Boost 發佈包。 

[5] The Boost.Build subset of boost is also distributed separately, for those who are only interested in getting a build tool. The top-level directory of a Boost.Build distribution contains all the subdirectories of the tools/build/v2 subdirectory from a full Boost distribution, so it is itself a valid Boost.Build root directory. It also contains the tools/jam/src subdirectory of a full Boost distribution, so you can rebuild Boost.Jam from source.
對於那些只對構建工具感興趣的用戶,boost 的 Boost.Build 子集也是獨立分發的。Boost.Build 分發包 的頂層目錄包含了一個完整的 Boost 分發包中的 tools/build/v2 子目錄下的所有子目錄,所以它本身就是一個有效的 Boost.Build 根目錄。它還包含了一個完整的 Boost 分發包中的 tools/jam/src 子目錄,所以你也可以從源文件重新構建 Boost.Jam。


PrevUpHomeNext