forked from olsonse/physical
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJamroot
More file actions
277 lines (243 loc) · 8.59 KB
/
Jamroot
File metadata and controls
277 lines (243 loc) · 8.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# Copyright 2004-2008 Spencer Olson
echo " Physical constants library: " ;
echo "---------------" ;
echo " In bjam, there are two ways to import/use this library." ;
echo " 1. /physical//physical" ;
echo " This provides includes for only the headers of this library." ;
echo " 2. /physical//calc" ;
echo " This provides includes for the headers, linkage to the bison/flex" ;
echo " based calculator library, dependency on boost_regex, and" ;
echo " a header-library dependency on boost_math (used to " ;
echo " define some trig functions on std::complex<> that are" ;
echo " going to be included in the new standard, but are not" ;
echo " yet available)" ;
echo "---------------" ;
echo " Possible compile/feature options" ;
echo " <phys-type>" ;
echo " Purpose: Specify the basic type used by the physical library." ;
echo " values:" ;
echo " complex [default] (std::complex<double>)" ;
echo " cfloat (std::complex<float>)" ;
echo " double (double)" ;
echo " float (float)" ;
echo " To select these features for building add them to the bjam command such as:" ;
echo " 'bjam phys-type=cfloat'" ;
echo "---------------" ;
echo "" ;
# Usage:
#
# bjam [options] [properties] [install|stage]
#
# Builds and installs physical.
#
# Targets and Related Options:
#
# install Install headers and compiled library files to the
# ======= configured locations (below).
#
# --prefix=<PREFIX> Install architecture independent files here.
# Default; C:\physical on Win32
# Default; /usr/local on Unix. Linux, etc.
#
# --exec-prefix=<EPREFIX> Install architecture dependent files here.
# Default; <PREFIX>
#
# --libdir=<DIR> Install library files here.
# Default; <EPREFIX>/lib
#
# --includedir=<HDRDIR> Install header files here.
# Default; <PREFIX>/include
#
# stage Build and install only compiled library files
# ===== to the ./stage directory.
#
# Other Options:
#
# --build-dir=DIR Build in this location instead of building
# within the distribution tree. Recommended!
#
# --help This message.
#
# Properties:
#
# toolset=toolset Indicates the toolset to build with.
#
# variant=debug|release Select the build variant
#
# link=static|shared Whether to build static or shared libraries
#
# threading=single|multi Whether to build single or multithreaded binaries
#
# runtime-link=static|shared
# Whether to link to static or shared C and C++ runtime.
#
import feature : feature ;
import path ; # for getting a better glob
import package ; # used for installing whole package (provides --prefix related
# options )
import common : find-tool ;
import numbers : less ;
path-constant TOP : . ;
constant VERSION : [ SHELL "printf `cd $(TOP); git describe 2> /dev/null` || printf physical-0.1.3 " ] ;
# root-project loads boost and others...
use-project /root-project : ../ ;
project /physical
: requirements
<include>cxx
<library>/boost//headers
<define>PHYSICAL_VERSION=\\\"$(VERSION)\\\"
: usage-requirements
<include>cxx
<library>/boost//headers
<define>PHYSICAL_VERSION=\\\"$(VERSION)\\\"
;
# a rule for checking the version of a particular tool
# minimum-version : e.g. "2.4.2" (double quotese appear to be required
# additional-paths : other places to search for the tool (besides $PATH)
# path-last : search $PATH after $(additional-paths) [Default false]
rule check-version ( name : minimum-version : version-opt ? :
additional-paths * : path-last ? ) {
local tool = [ find-tool $(name) $(additional-paths) $(path-last) ] ;
local vopt ;
if $(version-opt) {
vopt = $(version-opt) ;
} else {
vopt = "--version" ;
}
if $(tool) {
local tversion = [ MATCH "([0-9.]+)" : [ SHELL "$(tool) $(vopt)" ] ] ;
local tmajor = [ MATCH "([0-9]+)" : "$(tversion)" ] ;
local tminor = [ MATCH "[0-9]+\.([0-9]+)" : "$(tversion)" ] ;
local tpatch = [ MATCH "[0-9]+\.[0-9]+\.([0-9]+)" : "$(tversion)" ] ;
tmajor ?= "" ;
tminor ?= "" ;
tpatch ?= "" ;
local mmajor = [ MATCH "([0-9]+)" : "$(minimum-version)" ] ;
local mminor = [ MATCH "[0-9]+\.([0-9]+)" : "$(minimum-version)" ] ;
local mpatch = [ MATCH "[0-9]+\.[0-9]+\.([0-9]+)" : "$(minimum-version)" ] ;
mmajor ?= "" ;
mminor ?= "" ;
mpatch ?= "" ;
if ( $(tversion) = $(minimum-version) ||
[ less $(mmajor) $(tmajor) ] ||
( $(mmajor) = $(tmajor) && [ less $(mminor) $(tminor) ] ) ||
( $(mmajor) = $(tmajor) && $(mminor) = $(tminor) &&
[ less $(mpatch) $(tpatch) ] ) ) {
return $(tversion) ;
}
}
}
local ParserYY ;
local YY_include ;
if [ check-version "bison" : "2.4" ] {
import bison ;
ParserYY = cxx/physical/calc/detail/Parser.yy ;
} else {
echo "Compatible version of GNU bison not found. Using pre-generated parser" ;
ParserYY = cxx/physical/calc/detail/pregen-parser/Parser.cpp ;
YY_include = <include>cxx/physical/calc/detail/pregen-parser ;
}
local ScannerLL ;
local LL_include ;
if [ check-version "flex" : "2.5.35" ] {
import lex ;
ScannerLL = cxx/physical/calc/detail/Scanner.ll ;
} else {
echo "Compatible version of GNU flex not found. Using pre-generated lexer" ;
ScannerLL = cxx/physical/calc/detail/pregen-scanner/Scanner.cpp ;
LL_include = <include>cxx/physical/calc/detail/pregen-scanner ;
}
lib physical
: # sources
cxx/physical/system.cpp
physical_runtime_constants
[ glob cxx/physical/*.h ]
[ glob cxx/physical/calc/*.h ]
: <link>static
: # no default build
: # no includes
;
obj physical_runtime_constants
: cxx/physical/runtime.cpp
: <target-os>cygwin:<optimization>off
;
lib calc
: Driver
Parser
Scanner
: <link>static
<use>physical
<use>/boost//regex/<link>static
: # no default build
: <library>physical
<library>/boost//regex/<link>static
<include>$(project).build-dir
;
# the driver, scanner, and parser have a particular dependency graph
obj Driver
: cxx/physical/calc/Driver.cpp
: <implicit-dependency>Scanner
<implicit-dependency>Parser
;
obj Scanner
: $(ScannerLL)
: $(LL_include)
<implicit-dependency>Parser
: # no default build
: # usage requirements
$(LL_include)
;
obj Parser
: $(ParserYY)
: $(YY_include)
$(LL_include)
: # no default build
: # usage requirements
$(YY_include)
;
feature phys-type : complex cfloat double float : composite ;
feature.compose <phys-type>complex : <define>RUNTIME_PHYSICAL_QUANTITY=\"std::complex<double>\" ;
feature.compose <phys-type>cfloat : <define>RUNTIME_PHYSICAL_QUANTITY=\"std::complex<float>\" ;
feature.compose <phys-type>double : <define>RUNTIME_PHYSICAL_QUANTITY=double ;
feature.compose <phys-type>float : <define>RUNTIME_PHYSICAL_QUANTITY=float ;
# installation configuration
# options:
install-properties =
<install-no-version-symlinks>on
;
if [ modules.peek : NT ] {
install-properties += <install-default-prefix>C:/physical ;
} else if [ modules.peek : UNIX ] {
install-properties += <install-default-prefix>/usr/local ;
}
# the list of libraries to build and install
local libraries = physical ;
# all headers to install
local all_headers = [ path.glob-tree cxx : *.h *.cpp : .svn ] ;
# docs to install
local docs = [ path.glob-tree docs/api/html docs/api/latex : * : .svn ] ;
# Complete install allowing --prefix and related command line options
alias install : install-code install-docs ;
explicit install ;
# Complete install allowing --prefix and related command line options
package.install install-code
: $(install-properties)
<install-source-root>$(TOP)/cxx
:
: $(libraries)
: $(all_headers)
;
explicit install-code ;
# install data allowing --prefix and related command line options
package.install install-docs
: $(install-properties)
<install-source-root>$(TOP)
<install-header-subdir>../share/physical
:
:
: $(docs)
;
explicit install-docs ;
# install the libs into a staging dir
install stage : $(libraries) ;
explicit stage ;