]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/Jamroot.jam
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / tools / build / Jamroot.jam
1 # Copyright 2019 Rene Rivera
2 # Copyright 2017 Steven Watanabe
3 # Copyright 2016 Vladimir Prus
4 # Copyright 2017 Edward Diener
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7
8 import "class" : new ;
9 import bison ;
10 import errors ;
11 import feature ;
12 import indirect ;
13 import os ;
14 # import package ;
15 import path ;
16 import set ;
17 import stage : add-install-dir ;
18 import toolset ;
19 import type ;
20 import virtual-target ;
21
22 path-constant SELF : . ;
23
24 project b2
25 : build-dir .build
26 : requirements
27 <cxxstd>11
28 <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS=1
29 <toolset>msvc:<define>_CRT_NONSTDC_NO_DEPRECATE=1
30 ;
31
32 #|
33 Build the engine and its dependencies outside of the simple core build scripts.
34 This allows us to keep the core build scripts as simple as possible. And lets
35 us support more functionality for development of the engine core.
36 |#
37
38 #|
39 Define custom yyacc tool.
40 |#
41
42 feature.feature yyacc : : dependency free ;
43 toolset.flags yyacc TOOL <yyacc> ;
44
45 exe yyacc
46 : src/engine/yyacc.cpp
47 : ;
48 explicit yyacc ;
49
50 rule yyacc-gen ( project name : property-set : sources * )
51 {
52 local relevant = [ toolset.relevant $(__name__).yyacc ] ;
53 local a = [ new action $(sources[1]) : $(__name__).yyacc : [ $(property-set).add $(relevant) ] ] ;
54 local targets ;
55 for local n in $(name:S=).y $(name:S=)tab.h
56 {
57 targets += [ virtual-target.register
58 [ new file-target $(n) exact : [ type.type $(n) ]
59 : $(project) : $(a)
60 ] ] ;
61 }
62 return $(targets) ;
63 }
64
65 actions yyacc bind TOOL
66 {
67 "$(TOOL)" "$(<)" "$(>)"
68 }
69
70 generate jamgram.y
71 : src/engine/jamgram.yy
72 : <generating-rule>@yyacc-gen
73 <location>src/engine
74 <yyacc>yyacc <dependency>yyacc
75 ;
76 explicit jamgram.y ;
77
78 #|
79 Define grammar translation with Bison.
80 |#
81
82 BISON = [ os.environ BISON ] ;
83 BISON ?= bison ;
84 local BISON_IN_PATH = [ path.glob [ os.executable-path ] : $(BISON[1]) $(BISON[1]).* ] ;
85
86 rule grammar ( target : source : properties * )
87 {
88 # LOCATE on $(target) = $(source:D) ;
89 BISON on $(target) = $(BISON) ;
90 }
91
92 actions grammar
93 {
94 "$(BISON)" --yacc --defines -o "$(<[1])" "$(>)"
95 }
96
97 if $(BISON_IN_PATH)
98 {
99 make jamgram.cpp
100 : src/engine/jamgram.y
101 : @grammar
102 : <dependency>jamgram.y
103 <location>src/engine ;
104 }
105 else
106 {
107 errors.warning "Bison generator program '$(BISON:J= )' not found. Skipping grammar build." ;
108 alias jamgram.cpp
109 : src/engine/jamgram.cpp ;
110 }
111 explicit jamgram.cpp ;
112
113 #|
114 Define the b2 executable. Sources are based on platform.
115 TODO: Make platform specific source be no-ops when not needed.
116 |#
117
118 local python-exe = [ MATCH --with-python=(.*) : [ modules.peek : ARGV ] ] ;
119 local python-include ;
120 local python-ldlib ;
121 if $(python-exe)
122 {
123 python-include = [ SHELL
124 "$(python-exe) -c \"import sysconfig; print(sysconfig.get_path('include'));\""
125 : strip-eol ] ;
126 python-libdir = [ SHELL
127 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBDIR'));\""
128 : strip-eol ] ;
129 python-ldlib = [ MATCH ".*(python.*)" : [ SHELL
130 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBRARY'));\""
131 : strip-eol ] ] ;
132 python-ldlib = $(python-ldlib:S=) ;
133
134 lib python
135 :
136 : <name>$(python-ldlib) <search>$(python-libdir)
137 :
138 : <include>$(python-include) <define>HAVE_PYTHON ;
139 }
140 else
141 {
142 alias python ;
143 }
144
145 local b2_src =
146 [ glob src/engine/*.cpp src/engine/modules/*.cpp :
147 src/engine/*nt.cpp src/engine/*unix.cpp src/engine/*vms.cpp
148 src/engine/yyacc.cpp src/engine/mkjambase.cpp
149 src/engine/check_cxx11.cpp
150 ] ;
151 local b2_src_nt = [ glob src/engine/*nt.cpp ] ;
152 local b2_src_unix = [ glob src/engine/*unix.cpp ] ;
153 local b2_src_vms = [ glob src/engine/*vms.cpp ] ;
154 local unix_os = [ set.difference [ feature.values <target-os> ] : windows vms ] ;
155
156 exe b2
157 : $(b2_src)
158 python
159 : <target-os>windows:<source>$(b2_src_nt)
160 <target-os>vms:<source>$(b2_src_vms)
161 <target-os>$(unix_os):<source>$(b2_src_unix)
162 <dependency>jamgram.cpp
163 <toolset>msvc:<find-static-library>kernel32
164 <toolset>msvc:<find-static-library>advapi32
165 <toolset>msvc:<find-static-library>user32
166 ;
167 explicit b2 ;
168
169 #|
170 Installation of the engine, build, and example files.
171 |#
172
173 feature.feature b2-install-layout : standard portable : incidental propagated ;
174
175 add-install-dir b2prefix-standard : : prefix ;
176 add-install-dir b2bindir-standard : : bindir ;
177 add-install-dir b2coredir-standard : boost-build/src : datarootdir ;
178 add-install-dir b2examplesdir-standard : boost-build/examples : datarootdir ;
179
180 add-install-dir b2prefix-portable : : prefix ;
181 add-install-dir b2bindir-portable : : b2prefix-portable ;
182 add-install-dir b2coredir-portable : .b2 : b2prefix-portable ;
183 add-install-dir b2examplesdir-portable : .b2/examples : b2prefix-portable ;
184
185 local ext = "" ;
186 if [ os.on-windows ] || [ os.on-vms ]
187 {
188 ext = ".exe" ;
189 }
190
191 install b2-engine
192 : $(SELF)/src/engine/b2$(ext)
193 : <b2-install-layout>standard:<location>(b2bindir-standard)
194 <b2-install-layout>portable:<location>(b2bindir-portable)
195 ;
196 explicit b2-engine ;
197
198 local examples ;
199 for local e in [ glob-tree-ex $(SELF)/example : * : . .svn ]
200 {
201 if [ CHECK_IF_FILE [ path.native $(e) ] ]
202 {
203 examples += $(e) ;
204 }
205 }
206 install b2-examples
207 : # What to install
208 $(examples)
209 : # What is the root of the directory
210 <install-source-root>example
211 # Which subdir of $prefix/share
212 <b2-install-layout>standard:<location>(b2examplesdir-standard)
213 <b2-install-layout>portable:<location>(b2examplesdir-portable)
214 ;
215 explicit b2-examples ;
216
217 local .core-sources =
218 $(SELF)/src/build-system.jam
219 [ path.glob-tree $(SELF)/src/build : *.jam ]
220 [ path.glob-tree $(SELF)/src/contrib : *.jam ]
221 [ path.glob-tree $(SELF)/src/kernel : *.jam ]
222 [ path.glob-tree $(SELF)/src/options : *.jam ]
223 [ path.glob-tree $(SELF)/src/util : *.jam ]
224 [ path.glob-tree $(SELF)/src/tools : *.jam *.xml *.xsl *.doxyfile *.hpp doxproc.py ]
225 ;
226 if $(python-exe)
227 {
228 .core-sources +=
229 [ path.glob-tree $(SELF)/src/build : *.py ]
230 [ path.glob-tree $(SELF)/src/contrib : *.py ]
231 [ path.glob-tree $(SELF)/src/kernel : *.py ]
232 [ path.glob-tree $(SELF)/src/options : *.py ]
233 [ path.glob-tree $(SELF)/src/util : *.py ]
234 [ path.glob-tree $(SELF)/src/tools : *.py : doxproc.py ]
235 ;
236 }
237
238 install b2-core
239 : # What to install
240 $(.core-sources)
241 : # What is the root of the directory
242 <install-source-root>src
243 # Which subdir of $prefix/share
244 <b2-install-layout>standard:<location>(b2coredir-standard)
245 <b2-install-layout>portable:<location>(b2coredir-portable)
246 ;
247 explicit b2-core ;
248
249 #|
250 Only install example files when requested to avoid bloating install footprint.
251 |#
252 if --with-examples in [ modules.peek : ARGV ]
253 {
254 alias install : b2-engine b2-core b2-examples ;
255 }
256 else
257 {
258 alias install : b2-engine b2-core ;
259 }
260 explicit install ;