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.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
17 import stage : add-install-dir ;
20 import virtual-target ;
22 path-constant SELF : . ;
28 <toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS=1
29 <toolset>msvc:<define>_CRT_NONSTDC_NO_DEPRECATE=1
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.
39 Define custom yyacc tool.
42 feature.feature yyacc : : dependency free ;
43 toolset.flags yyacc TOOL <yyacc> ;
46 : src/engine/yyacc.cpp
50 rule yyacc-gen ( project name : property-set : sources * )
52 local relevant = [ toolset.relevant $(__name__).yyacc ] ;
53 local a = [ new action $(sources[1]) : $(__name__).yyacc : [ $(property-set).add $(relevant) ] ] ;
55 for local n in $(name:S=).y $(name:S=)tab.h
57 targets += [ virtual-target.register
58 [ new file-target $(n) exact : [ type.type $(n) ]
65 actions yyacc bind TOOL
67 "$(TOOL)" "$(<)" "$(>)"
71 : src/engine/jamgram.yy
72 : <generating-rule>@yyacc-gen
74 <yyacc>yyacc <dependency>yyacc
79 Define grammar translation with Bison.
82 BISON = [ os.environ BISON ] ;
84 local BISON_IN_PATH = [ path.glob [ os.executable-path ] : $(BISON[1]) $(BISON[1]).* ] ;
86 rule grammar ( target : source : properties * )
88 # LOCATE on $(target) = $(source:D) ;
89 BISON on $(target) = $(BISON) ;
94 "$(BISON)" --yacc --defines -o "$(<[1])" "$(>)"
100 : src/engine/jamgram.y
102 : <dependency>jamgram.y
103 <location>src/engine ;
107 errors.warning "Bison generator program '$(BISON:J= )' not found. Skipping grammar build." ;
109 : src/engine/jamgram.cpp ;
111 explicit jamgram.cpp ;
114 Define the b2 executable. Sources are based on platform.
115 TODO: Make platform specific source be no-ops when not needed.
118 local python-exe = [ MATCH --with-python=(.*) : [ modules.peek : ARGV ] ] ;
119 local python-include ;
123 python-include = [ SHELL
124 "$(python-exe) -c \"import sysconfig; print(sysconfig.get_path('include'));\""
126 python-libdir = [ SHELL
127 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBDIR'));\""
129 python-ldlib = [ MATCH ".*(python.*)" : [ SHELL
130 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBRARY'));\""
132 python-ldlib = $(python-ldlib:S=) ;
136 : <name>$(python-ldlib) <search>$(python-libdir)
138 : <include>$(python-include) <define>HAVE_PYTHON ;
147 : <toolset>gcc:<cxxflags>-Wno-free-nonheap-object
149 explicit jamgram.obj ;
152 [ glob src/engine/*.cpp src/engine/modules/*.cpp :
153 src/engine/*nt.cpp src/engine/*unix.cpp src/engine/*vms.cpp
154 src/engine/yyacc.cpp src/engine/mkjambase.cpp
155 src/engine/check_*.cpp
156 src/engine/jamgram.cpp
158 local b2_src_nt = [ glob src/engine/*nt.cpp ] ;
159 local b2_src_unix = [ glob src/engine/*unix.cpp ] ;
160 local b2_src_vms = [ glob src/engine/*vms.cpp ] ;
161 local unix_os = [ set.difference [ feature.values <target-os> ] : windows vms ] ;
167 : <target-os>windows:<source>$(b2_src_nt)
168 <target-os>vms:<source>$(b2_src_vms)
169 <target-os>$(unix_os):<source>$(b2_src_unix)
170 <toolset>msvc:<find-static-library>kernel32
171 <toolset>msvc:<find-static-library>advapi32
172 <toolset>msvc:<find-static-library>user32
177 Installation of the engine, build, and example files.
180 feature.feature b2-install-layout : standard portable : incidental propagated ;
182 add-install-dir b2prefix-standard : : prefix ;
183 add-install-dir b2bindir-standard : : bindir ;
184 add-install-dir b2coredir-standard : boost-build/src : datarootdir ;
185 add-install-dir b2examplesdir-standard : boost-build/examples : datarootdir ;
187 add-install-dir b2prefix-portable : : prefix ;
188 add-install-dir b2bindir-portable : : b2prefix-portable ;
189 add-install-dir b2coredir-portable : .b2 : b2prefix-portable ;
190 add-install-dir b2examplesdir-portable : .b2/examples : b2prefix-portable ;
193 if [ os.on-windows ] || [ os.on-vms ]
199 : $(SELF)/src/engine/b2$(ext)
200 : <b2-install-layout>standard:<location>(b2bindir-standard)
201 <b2-install-layout>portable:<location>(b2bindir-portable)
206 for local e in [ glob-tree-ex $(SELF)/example : * : . .svn ]
208 if [ CHECK_IF_FILE [ path.native $(e) ] ]
216 : # What is the root of the directory
217 <install-source-root>example
218 # Which subdir of $prefix/share
219 <b2-install-layout>standard:<location>(b2examplesdir-standard)
220 <b2-install-layout>portable:<location>(b2examplesdir-portable)
222 explicit b2-examples ;
224 local .core-sources =
225 $(SELF)/src/build-system.jam
226 [ path.glob-tree $(SELF)/src/build : *.jam ]
227 [ path.glob-tree $(SELF)/src/contrib : *.jam ]
228 [ path.glob-tree $(SELF)/src/kernel : *.jam ]
229 [ path.glob-tree $(SELF)/src/options : *.jam ]
230 [ path.glob-tree $(SELF)/src/util : *.jam ]
231 [ path.glob-tree $(SELF)/src/tools : *.jam *.xml *.xsl *.doxyfile *.hpp doxproc.py ]
236 [ path.glob-tree $(SELF)/src/build : *.py ]
237 [ path.glob-tree $(SELF)/src/contrib : *.py ]
238 [ path.glob-tree $(SELF)/src/kernel : *.py ]
239 [ path.glob-tree $(SELF)/src/options : *.py ]
240 [ path.glob-tree $(SELF)/src/util : *.py ]
241 [ path.glob-tree $(SELF)/src/tools : *.py : doxproc.py ]
248 : # What is the root of the directory
249 <install-source-root>src
250 # Which subdir of $prefix/share
251 <b2-install-layout>standard:<location>(b2coredir-standard)
252 <b2-install-layout>portable:<location>(b2coredir-portable)
257 Only install example files when requested to avoid bloating install footprint.
259 if --with-examples in [ modules.peek : ARGV ]
261 alias install : b2-engine b2-core b2-examples ;
265 alias install : b2-engine b2-core ;