1 | <html> |
---|
2 | <head> |
---|
3 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
---|
4 | <title>Project Hierarchies</title> |
---|
5 | <link rel="stylesheet" href="../../boostbook.css" type="text/css"> |
---|
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.69.1"> |
---|
7 | <style type="text/css"> |
---|
8 | body { background-image: url('http://docbook.sourceforge.net/release/images/draft.png'); |
---|
9 | background-repeat: no-repeat; |
---|
10 | background-position: top left; |
---|
11 | /* The following properties make the watermark "fixed" on the page. */ |
---|
12 | /* I think that's just a bit too distracting for the reader... */ |
---|
13 | /* background-attachment: fixed; */ |
---|
14 | /* background-position: center center; */ |
---|
15 | }</style> |
---|
16 | <link rel="start" href="../../index.html" title="The Boost C++ Libraries"> |
---|
17 | <link rel="up" href="../tutorial.html" title="Chapter 23. Tutorial"> |
---|
18 | <link rel="prev" href="properties.html" title="Properties"> |
---|
19 | <link rel="next" href="libs.html" title="Dependent Targets"> |
---|
20 | </head> |
---|
21 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
---|
22 | <table cellpadding="2" width="100%"> |
---|
23 | <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../../boost.png"></td> |
---|
24 | <td align="center"><a href="../../../../index.htm">Home</a></td> |
---|
25 | <td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td> |
---|
26 | <td align="center"><a href="../../../../people/people.htm">People</a></td> |
---|
27 | <td align="center"><a href="../../../../more/faq.htm">FAQ</a></td> |
---|
28 | <td align="center"><a href="../../../../more/index.htm">More</a></td> |
---|
29 | </table> |
---|
30 | <hr> |
---|
31 | <div class="spirit-nav"> |
---|
32 | <a accesskey="p" href="properties.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="libs.html"><img src="../../images/next.png" alt="Next"></a> |
---|
33 | </div> |
---|
34 | <div class="section" lang="en"> |
---|
35 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> |
---|
36 | <a name="bbv2.tutorial.hierarchy"></a>Project Hierarchies</h2></div></div></div> |
---|
37 | <p>So far we've only considered examples with one project |
---|
38 | (i.e. with one user-written Boost.Jam file, |
---|
39 | <code class="filename">Jamroot</code>). A typical large codebase would be |
---|
40 | composed of many projects organized into a tree. The top of the |
---|
41 | tree is called the <em class="firstterm">project root</em>. Every |
---|
42 | subproject is defined by a file called |
---|
43 | <code class="filename">Jamfile</code> in a descendant directory of the |
---|
44 | project root. The parent project of a subproject is defined by |
---|
45 | the nearest <code class="filename">Jamfile</code> or |
---|
46 | <code class="filename">Jamroot</code> file in an ancestor directory. For |
---|
47 | example, in the following directory layout: |
---|
48 | |
---|
49 | </p> |
---|
50 | <pre class="screen"> |
---|
51 | top/ |
---|
52 | | |
---|
53 | +-- Jamroot |
---|
54 | | |
---|
55 | +-- app/ |
---|
56 | | | |
---|
57 | | +-- Jamfile |
---|
58 | | `-- app.cpp |
---|
59 | | |
---|
60 | `-- util/ |
---|
61 | | |
---|
62 | +-- foo/ |
---|
63 | . | |
---|
64 | . +-- Jamfile |
---|
65 | . `-- bar.cpp |
---|
66 | </pre> |
---|
67 | <p> |
---|
68 | |
---|
69 | the project root is <code class="filename">top/</code>. Because there is |
---|
70 | no <code class="filename">Jamfile</code> in |
---|
71 | <code class="filename">top/util/</code>, the projects in |
---|
72 | <code class="filename">top/app/</code> and |
---|
73 | <code class="filename">top/util/foo/</code> are immediate children of the |
---|
74 | root project. |
---|
75 | |
---|
76 | </p> |
---|
77 | <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
---|
78 | <h3 class="title">Note</h3> |
---|
79 | <p> |
---|
80 | When we refer to a “Jamfile,” set in normal |
---|
81 | type, we mean a file called either |
---|
82 | <code class="filename">Jamfile</code> or |
---|
83 | <code class="filename">Jamroot</code>. When we need to be more |
---|
84 | specific, the filename will be set as |
---|
85 | “<code class="filename">Jamfile</code>” or |
---|
86 | “<code class="filename">Jamroot</code>.” |
---|
87 | </p> |
---|
88 | </div> |
---|
89 | <p> |
---|
90 | Projects inherit all attributes (such as requirements) |
---|
91 | from their parents. Inherited requirements are combined with |
---|
92 | any requirements specified by the sub-project. |
---|
93 | For example, if <code class="filename">top/Jamroot</code> has |
---|
94 | |
---|
95 | </p> |
---|
96 | <pre class="programlisting"> |
---|
97 | <include>/home/ghost/local |
---|
98 | </pre> |
---|
99 | <p> |
---|
100 | |
---|
101 | in its requirements, then all of its sub-projects will have it |
---|
102 | in their requirements, too. Of course, any project can add |
---|
103 | include paths to those specified by its parents. <sup>[<a name="id2854392" href="#ftn.id2854392">5</a>]</sup> |
---|
104 | More details can be found in |
---|
105 | <a href="../advanced/jamfiles.html#bbv2.advanced.projects" title="Projects">the section called “Projects”</a>. |
---|
106 | </p> |
---|
107 | <p> |
---|
108 | Invoking <span><strong class="command">bjam</strong></span> without explicitly specifying |
---|
109 | any targets on the command-line builds the project rooted in the |
---|
110 | current directory. Building a project does not automatically |
---|
111 | cause its sub-projects to be built unless the parent project's |
---|
112 | Jamfile explicitly requests it. In our example, |
---|
113 | <code class="filename">top/Jamroot</code> might contain: |
---|
114 | |
---|
115 | </p> |
---|
116 | <pre class="programlisting"> |
---|
117 | build-project app ; |
---|
118 | </pre> |
---|
119 | <p> |
---|
120 | |
---|
121 | which would cause the project in <code class="filename">top/app/</code> |
---|
122 | to be built whenever the project in <code class="filename">top/</code> is |
---|
123 | built. However, targets in <code class="filename">top/util/foo/</code> |
---|
124 | will be built only if they are needed by targets in |
---|
125 | <code class="filename">top/</code> or <code class="filename">top/app/</code>. |
---|
126 | </p> |
---|
127 | <div class="footnotes"> |
---|
128 | <br><hr width="100" align="left"> |
---|
129 | <div class="footnote"><p><sup>[<a name="ftn.id2854392" href="#id2854392">5</a>] </sup>Many |
---|
130 | features will be overridden, |
---|
131 | rather than added-to, in sub-projects. See <a href="../reference/definitions.html#bbv2.reference.features.attributes" title="Feature Attributes">the section called “Feature Attributes”</a> for more |
---|
132 | information</p></div> |
---|
133 | </div> |
---|
134 | </div> |
---|
135 | <table width="100%"><tr> |
---|
136 | <td align="left"></td> |
---|
137 | <td align="right"><small></small></td> |
---|
138 | </tr></table> |
---|
139 | <hr> |
---|
140 | <div class="spirit-nav"> |
---|
141 | <a accesskey="p" href="properties.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../tutorial.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="libs.html"><img src="../../images/next.png" alt="Next"></a> |
---|
142 | </div> |
---|
143 | </body> |
---|
144 | </html> |
---|