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