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)
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 ;
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
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 ] ;
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
170 Installation of the engine, build, and example files.
173 feature.feature b2-install-layout : standard portable : incidental propagated ;
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 ;
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 ;
186 if [ os.on-windows ] || [ os.on-vms ]
192 : $(SELF)/src/engine/b2$(ext)
193 : <b2-install-layout>standard:<location>(b2bindir-standard)
194 <b2-install-layout>portable:<location>(b2bindir-portable)
199 for local e in [ glob-tree-ex $(SELF)/example : * : . .svn ]
201 if [ CHECK_IF_FILE [ path.native $(e) ] ]
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)
215 explicit b2-examples ;
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 ]
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 ]
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)
250 Only install example files when requested to avoid bloating install footprint.
252 if --with-examples in [ modules.peek : ARGV ]
254 alias install : b2-engine b2-core b2-examples ;
258 alias install : b2-engine b2-core ;