]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright Vladimir Prus 2002-2006. |
2 | # Copyright Dave Abrahams 2005-2006. | |
3 | # Copyright Rene Rivera 2005-2007. | |
4 | # Copyright Douglas Gregor 2005. | |
5 | # | |
6 | # Distributed under the Boost Software License, Version 1.0. | |
7 | # (See accompanying file LICENSE_1_0.txt or copy at | |
8 | # http://www.boost.org/LICENSE_1_0.txt) | |
9 | ||
10 | # Usage: | |
11 | # | |
12 | # b2 [options] [properties] [install|stage] | |
13 | # | |
14 | # Builds and installs Boost. | |
15 | # | |
16 | # Targets and Related Options: | |
17 | # | |
18 | # install Install headers and compiled library files to the | |
19 | # ======= configured locations (below). | |
20 | # | |
21 | # --prefix=<PREFIX> Install architecture independent files here. | |
22 | # Default; C:\Boost on Win32 | |
23 | # Default; /usr/local on Unix. Linux, etc. | |
24 | # | |
25 | # --exec-prefix=<EPREFIX> Install architecture dependent files here. | |
26 | # Default; <PREFIX> | |
27 | # | |
28 | # --libdir=<DIR> Install library files here. | |
29 | # Default; <EPREFIX>/lib | |
30 | # | |
31 | # --includedir=<HDRDIR> Install header files here. | |
32 | # Default; <PREFIX>/include | |
33 | # | |
34 | # stage Build and install only compiled library files to the | |
35 | # ===== stage directory. | |
36 | # | |
37 | # --stagedir=<STAGEDIR> Install library files here | |
38 | # Default; ./stage | |
39 | # | |
40 | # Other Options: | |
41 | # | |
42 | # --build-type=<type> Build the specified pre-defined set of variations of | |
43 | # the libraries. Note, that which variants get built | |
44 | # depends on what each library supports. | |
45 | # | |
46 | # -- minimal -- (default) Builds a minimal set of | |
47 | # variants. On Windows, these are static | |
48 | # multithreaded libraries in debug and release | |
49 | # modes, using shared runtime. On Linux, these are | |
50 | # static and shared multithreaded libraries in | |
51 | # release mode. | |
52 | # | |
53 | # -- complete -- Build all possible variations. | |
54 | # | |
55 | # --build-dir=DIR Build in this location instead of building within | |
56 | # the distribution tree. Recommended! | |
57 | # | |
58 | # --show-libraries Display the list of Boost libraries that require | |
59 | # build and installation steps, and then exit. | |
60 | # | |
61 | # --layout=<layout> Determine whether to choose library names and header | |
62 | # locations such that multiple versions of Boost or | |
63 | # multiple compilers can be used on the same system. | |
64 | # | |
65 | # -- versioned -- Names of boost binaries include | |
66 | # the Boost version number, name and version of | |
67 | # the compiler and encoded build properties. Boost | |
68 | # headers are installed in a subdirectory of | |
69 | # <HDRDIR> whose name contains the Boost version | |
70 | # number. | |
71 | # | |
72 | # -- tagged -- Names of boost binaries include the | |
73 | # encoded build properties such as variant and | |
74 | # threading, but do not including compiler name | |
75 | # and version, or Boost version. This option is | |
76 | # useful if you build several variants of Boost, | |
77 | # using the same compiler. | |
78 | # | |
79 | # -- system -- Binaries names do not include the | |
80 | # Boost version number or the name and version | |
81 | # number of the compiler. Boost headers are | |
82 | # installed directly into <HDRDIR>. This option is | |
83 | # intended for system integrators building | |
84 | # distribution packages. | |
85 | # | |
86 | # The default value is 'versioned' on Windows, and | |
87 | # 'system' on Unix. | |
88 | # | |
89 | # --buildid=ID Add the specified ID to the name of built libraries. | |
90 | # The default is to not add anything. | |
91 | # | |
92 | # --python-buildid=ID Add the specified ID to the name of built libraries | |
93 | # that depend on Python. The default is to not add | |
94 | # anything. This ID is added in addition to --buildid. | |
95 | # | |
96 | # --help This message. | |
97 | # | |
98 | # --with-<library> Build and install the specified <library>. If this | |
99 | # option is used, only libraries specified using this | |
100 | # option will be built. | |
101 | # | |
102 | # --without-<library> Do not build, stage, or install the specified | |
103 | # <library>. By default, all libraries are built. | |
104 | # | |
105 | # Properties: | |
106 | # | |
107 | # toolset=toolset Indicate the toolset to build with. | |
108 | # | |
109 | # variant=debug|release Select the build variant | |
110 | # | |
111 | # link=static|shared Whether to build static or shared libraries | |
112 | # | |
113 | # threading=single|multi Whether to build single or multithreaded binaries | |
114 | # | |
115 | # runtime-link=static|shared | |
116 | # Whether to link to static or shared C and C++ | |
117 | # runtime. | |
118 | # | |
119 | ||
120 | # TODO: | |
121 | # - handle boost version | |
122 | # - handle python options such as pydebug | |
123 | ||
124 | import boostcpp ; | |
125 | import package ; | |
126 | ||
127 | import sequence ; | |
128 | import xsltproc ; | |
129 | import set ; | |
130 | import path ; | |
131 | import link ; | |
b32b8144 | 132 | import threadapi-feature ; |
7c673cae FG |
133 | |
134 | path-constant BOOST_ROOT : . ; | |
b32b8144 | 135 | constant BOOST_VERSION : 1.66.0 ; |
7c673cae FG |
136 | constant BOOST_JAMROOT_MODULE : $(__name__) ; |
137 | ||
138 | boostcpp.set-version $(BOOST_VERSION) ; | |
139 | ||
140 | use-project /boost/architecture : libs/config/checks/architecture ; | |
141 | ||
142 | local all-headers = | |
143 | [ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ; | |
144 | ||
145 | for dir in $(all-headers) | |
146 | { | |
147 | link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ; | |
148 | explicit $(dir)-headers ; | |
149 | } | |
150 | ||
151 | if $(all-headers) | |
152 | { | |
153 | constant BOOST_MODULARLAYOUT : $(all-headers) ; | |
154 | } | |
155 | ||
156 | project boost | |
157 | : requirements <include>. | |
158 | ||
159 | [ boostcpp.architecture ] | |
160 | [ boostcpp.address-model ] | |
161 | ||
162 | # Disable auto-linking for all targets here, primarily because it caused | |
163 | # troubles with V2. | |
164 | <define>BOOST_ALL_NO_LIB=1 | |
165 | # Used to encode variant in target name. See the 'tag' rule below. | |
166 | <tag>@$(__name__).tag | |
167 | <conditional>@handle-static-runtime | |
168 | # Comeau does not support shared lib | |
169 | <toolset>como:<link>static | |
170 | <toolset>como-linux:<define>_GNU_SOURCE=1 | |
171 | # When building docs within Boost, we want the standard Boost style | |
172 | <xsl:param>boost.defaults=Boost | |
b32b8144 | 173 | <conditional>@threadapi-feature.detect |
7c673cae FG |
174 | : usage-requirements <include>. |
175 | : build-dir bin.v2 | |
176 | ; | |
177 | ||
178 | # This rule is called by Boost.Build to determine the name of target. We use it | |
179 | # to encode the build variant, compiler name and boost version in the target | |
180 | # name. | |
181 | # | |
182 | rule tag ( name : type ? : property-set ) | |
183 | { | |
184 | return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ; | |
185 | } | |
186 | ||
187 | rule python-tag ( name : type ? : property-set ) | |
188 | { | |
189 | return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ; | |
190 | } | |
191 | ||
192 | rule handle-static-runtime ( properties * ) | |
193 | { | |
194 | # Using static runtime with shared libraries is impossible on Linux, and | |
195 | # dangerous on Windows. Therefore, we disallow it. This might be drastic, | |
196 | # but it was disabled for a while without anybody complaining. | |
197 | ||
198 | # For CW, static runtime is needed so that std::locale works. | |
199 | if <link>shared in $(properties) && <runtime-link>static in $(properties) && | |
200 | ! ( <toolset>cw in $(properties) ) | |
201 | { | |
b32b8144 FG |
202 | if ! $(.shared-static-warning-emitted) |
203 | { | |
204 | ECHO "warning: skipping configuration link=shared, runtime-link=static" ; | |
205 | ECHO "warning: this combination is either impossible or too dangerous" ; | |
206 | ECHO "warning: to be of any use" ; | |
207 | .shared-static-warning-emitted = 1 ; | |
208 | } | |
209 | ||
210 | return <build>no ; | |
7c673cae FG |
211 | } |
212 | } | |
213 | ||
214 | all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] | |
215 | [ glob libs/*/build/Jamfile ] ] ; | |
216 | ||
217 | all-libraries = [ sequence.unique $(all-libraries) ] ; | |
218 | # The function_types library has a Jamfile, but it's used for maintenance | |
219 | # purposes, there's no library to build and install. | |
220 | all-libraries = [ set.difference $(all-libraries) : function_types ] ; | |
221 | ||
222 | # Setup convenient aliases for all libraries. | |
223 | ||
224 | local rule explicit-alias ( id : targets + ) | |
225 | { | |
226 | alias $(id) : $(targets) ; | |
227 | explicit $(id) ; | |
228 | } | |
229 | ||
230 | # First, the complicated libraries: where the target name in Jamfile is | |
231 | # different from its directory name. | |
232 | explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ; | |
233 | explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ; | |
234 | explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ; | |
235 | explicit-alias bgl-vis : libs/graps/build//bgl-vis ; | |
236 | explicit-alias serialization : libs/serialization/build//boost_serialization ; | |
237 | explicit-alias wserialization : libs/serialization/build//boost_wserialization ; | |
238 | for local l in $(all-libraries) | |
239 | { | |
240 | if ! $(l) in test graph serialization | |
241 | { | |
242 | explicit-alias $(l) : libs/$(l)/build//boost_$(l) ; | |
243 | } | |
244 | } | |
245 | ||
246 | # Log has an additional target | |
247 | explicit-alias log_setup : libs/log/build//boost_log_setup ; | |
248 | ||
249 | alias headers : $(all-headers)-headers : : : <include>. ; | |
250 | explicit headers ; | |
251 | ||
252 | # Make project ids of all libraries known. | |
253 | for local l in $(all-libraries) | |
254 | { | |
255 | use-project /boost/$(l) : libs/$(l)/build ; | |
256 | } | |
257 | ||
b32b8144 | 258 | if [ path.exists $(BOOST_ROOT)/tools/inspect/build ] |
7c673cae FG |
259 | { |
260 | use-project /boost/tools/inspect : tools/inspect/build ; | |
261 | } | |
262 | ||
b32b8144 | 263 | if [ path.exists $(BOOST_ROOT)/libs/wave/tool/build ] |
7c673cae FG |
264 | { |
265 | use-project /boost/libs/wave/tool : libs/wave/tool/build ; | |
266 | } | |
267 | ||
268 | # This rule should be called from libraries' Jamfiles and will create two | |
269 | # targets, "install" and "stage", that will install or stage that library. The | |
270 | # --prefix option is respected, but --with and --without options, naturally, are | |
271 | # ignored. | |
272 | # | |
273 | # - libraries -- list of library targets to install. | |
274 | # | |
275 | rule boost-install ( libraries * ) | |
276 | { | |
277 | package.install install | |
278 | : <dependency>/boost//install-proper-headers $(install-requirements) | |
279 | : # No binaries | |
280 | : $(libraries) | |
281 | : # No headers, it is handled by the dependency. | |
282 | ; | |
283 | ||
284 | install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ; | |
285 | ||
286 | module [ CALLER_MODULE ] | |
287 | { | |
288 | explicit stage ; | |
289 | explicit install ; | |
290 | } | |
291 | } | |
292 | ||
293 | # Creates a library target, adding autolink support and also creates | |
294 | # stage and install targets via boost-install, above. | |
295 | rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * ) | |
296 | { | |
297 | name = boost_$(name) ; | |
b32b8144 | 298 | autolink = <link>shared:<define>$(name:U)_DYN_LINK=1 ; |
7c673cae FG |
299 | lib $(name) |
300 | : $(sources) | |
301 | : $(requirements) $(autolink) | |
302 | : $(default-build) | |
303 | : $(usage-requirements) $(autolink) | |
304 | ; | |
305 | boost-install $(name) ; | |
306 | } | |
307 | ||
308 | ||
309 | headers = | |
310 | # The .SUNWCCh files are present in tr1 include directory and have to be | |
311 | # installed (see http://lists.boost.org/Archives/boost/2007/05/121430.php). | |
312 | [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ] | |
313 | [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ] | |
314 | [ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ] | |
315 | ; | |
316 | ||
317 | # Declare special top-level targets that build and install the desired variants | |
318 | # of the libraries. | |
319 | boostcpp.declare-targets $(all-libraries) : $(headers) ; |