Changeset View
Changeset View
Standalone View
Standalone View
autotests/folding/Jamroot.fold
- This file was added.
1 | project | ||||
---|---|---|---|---|---|
2 | : requirements <include>/home/ghost/Work/boost <threading>multi | ||||
3 | ; | ||||
4 | project a : : debug ; | ||||
5 | | ||||
6 | exe hello : hello.cpp ; | ||||
7 | | ||||
8 | exe hello | ||||
9 | : hello.cpp | ||||
10 | : <include>boost <threading>multi | ||||
11 | ; | ||||
12 | exe app : app.cpp ../util/foo//bar ; | ||||
13 | exe important : main.cpp helpers/<link>static ; | ||||
14 | | ||||
15 | exe b : [ glob *.cpp ] ; | ||||
16 | | ||||
17 | lib tools : | ||||
18 | [ glob *.cpp ] ; | ||||
19 | | ||||
20 | lib tools : [ glob *.cpp : file_to_exclude.cpp bad*.cpp ] ; | ||||
21 | | ||||
22 | lib network : network.cpp | ||||
23 | : <conditional>@my-rule | ||||
24 | ; | ||||
25 | | ||||
26 | DEPENDS foo.o : foo.c ; | ||||
27 | | ||||
28 | using msvc : : "Z:/Programs/Microsoft Visual Studio/vc98/bin/cl" ; | ||||
29 | using msvc : : echo Compiling && foo/bar/baz/cl ; | ||||
30 | using gcc : 5 : : <cxxflags>"-std=c++14 -O2" ; | ||||
31 | using clang : 3.9 : : <cxxflags>-std=c++14 <cxxflags>-O2 ; | ||||
32 | exe test3 : test3.cpp : -<threading>multi ; | ||||
33 | XYZ += <cxxflags>-Wzero-as-null-pointer-constant&&-Wno-zero-as-null-pointer-constant ; | ||||
34 | exe hello : hello.cpp : <os>NT,<toolset>gcc:<link>static ; | ||||
35 | | ||||
36 | install dist : hello helpers : | ||||
37 | <variant>release:<location>dist/release | ||||
38 | <variant>debug:<location>dist/debug ; | ||||
39 | install dist2 : hello helpers : <location>$(DIST) ; | ||||
40 | | ||||
41 | exe app : app.cpp : [ check-target-builds has_foo "System has foo" : <library>foo : <define>FOO_MISSING=1 ] ; | ||||
42 | | ||||
43 | import path : * ; | ||||
44 | | ||||
45 | using python | ||||
46 | : 2.7 # version | ||||
47 | : # Interpreter/path to dir | ||||
48 | : /usr/include/python2.7 # includes | ||||
49 | : /usr/lib/x86_64-linux-gnu # libs | ||||
50 | : # conditions | ||||
51 | ; | ||||
52 | | ||||
53 | xx ; | ||||
54 | xx ;; ; | ||||
55 | xx ;a ; | ||||
56 | xx a; ; | ||||
57 | xx ;a; ; | ||||
58 | | ||||
59 | ## comment title | ||||
60 | # BUG | ||||
61 | # TODO | ||||
62 | # aTODOa | ||||
63 | | ||||
64 | | ||||
65 | if cond <beginfold id='1'>{</beginfold id='1'> | ||||
66 | statements ; | ||||
67 | <endfold id='1'>}</endfold id='1'> | ||||
68 | else <beginfold id='1'>{</beginfold id='1'> | ||||
69 | statements ; | ||||
70 | <endfold id='1'>}</endfold id='1'> | ||||
71 | | ||||
72 | for var in list <beginfold id='1'>{</beginfold id='1'> | ||||
73 | statements ; | ||||
74 | <endfold id='1'>}</endfold id='1'> | ||||
75 | | ||||
76 | while cond <beginfold id='1'>{</beginfold id='1'> | ||||
77 | statements ; | ||||
78 | <endfold id='1'>}</endfold id='1'> | ||||
79 | | ||||
80 | switch value | ||||
81 | <beginfold id='1'>{</beginfold id='1'> | ||||
82 | case pattern1 : statements ; | ||||
83 | case pattern2 : statements ; | ||||
84 | other ; | ||||
85 | <endfold id='1'>}</endfold id='1'> | ||||
86 | | ||||
87 | if xxinxx <beginfold id='1'>{</beginfold id='1'> | ||||
88 | <endfold id='1'>}</endfold id='1'> | ||||
89 | | ||||
90 | ifxxx s ; | ||||
91 | | ||||
92 | rule a? ( x ) | ||||
93 | <beginfold id='1'>{</beginfold id='1'> | ||||
94 | echo $(x) ; | ||||
95 | <endfold id='1'>}</endfold id='1'> | ||||
96 | a? 23 ; | ||||
97 | | ||||
98 | | ||||
99 | rule example | ||||
100 | ( | ||||
101 | parameter1 : | ||||
102 | parameter2 ? : | ||||
103 | parameter3 + : | ||||
104 | parameter4 * | ||||
105 | ) | ||||
106 | <beginfold id='1'>{</beginfold id='1'> | ||||
107 | if <variant>debug in $(properties) | ||||
108 | <beginfold id='1'>{</beginfold id='1'> | ||||
109 | OPTIONS on $(targets) = --debug ; | ||||
110 | <endfold id='1'>}</endfold id='1'> | ||||
111 | <endfold id='1'>}</endfold id='1'> | ||||
112 | | ||||
113 | rule my-rule ( properties * ) | ||||
114 | <beginfold id='1'>{</beginfold id='1'> | ||||
115 | local result ; | ||||
116 | if <toolset>gcc <optimization>speed in $(properties) | ||||
117 | <beginfold id='1'>{</beginfold id='1'> | ||||
118 | result += <define>USE_INLINE_ASSEMBLER ; | ||||
119 | return $(result) ; | ||||
120 | <endfold id='1'>}</endfold id='1'> | ||||
121 | | ||||
122 | local m = [ CALLER_MODULE ] ; | ||||
123 | local result ; | ||||
124 | for v in $(values) | ||||
125 | <beginfold id='1'>{</beginfold id='1'> | ||||
126 | if [ modules.call-in $(m) : $(f) $(v) ] | ||||
127 | <beginfold id='1'>{</beginfold id='1'> | ||||
128 | result += $(v) ; | ||||
129 | <endfold id='1'>}</endfold id='1'> | ||||
130 | <endfold id='1'>}</endfold id='1'> | ||||
131 | return result ; | ||||
132 | return <name>$(name) ; | ||||
133 | return [ virtual-target.register $(t) ] ; | ||||
134 | return [ sequence.transform virtual-target.register : $(targets) ] ; | ||||
135 | <endfold id='1'>}</endfold id='1'> | ||||
136 | | ||||
137 | rule run ( project name ? : property-set : sources * ) | ||||
138 | <beginfold id='1'>{</beginfold id='1'> | ||||
139 | if [ $(s).type ] = PY | ||||
140 | <beginfold id='1'>{</beginfold id='1'> | ||||
141 | python = $(s) ; | ||||
142 | <endfold id='1'>}</endfold id='1'> | ||||
143 | | ||||
144 | local new-sources ; | ||||
145 | for local s in $(sources) | ||||
146 | <beginfold id='1'>{</beginfold id='1'> | ||||
147 | if [ type.is-derived [ $(s).type ] CPP ] | ||||
148 | <beginfold id='1'>{</beginfold id='1'> | ||||
149 | local name = [ $(s).name ] ; # get the target's basename | ||||
150 | if $(name) = [ $(python).name ] | ||||
151 | <beginfold id='1'>{</beginfold id='1'> | ||||
152 | name = $(name)_ext ; # rename the target | ||||
153 | <endfold id='1'>}</endfold id='1'> | ||||
154 | new-sources += [ generators.construct $(project) $(name) : | ||||
155 | PYTHON_EXTENSION : $(property-set) : $(s) $(libs) ] ; | ||||
156 | <endfold id='1'>}</endfold id='1'> | ||||
157 | <endfold id='1'>}</endfold id='1'> | ||||
158 | | ||||
159 | result = [ construct-result $(python) $(new-sources) : $(project) $(name) | ||||
160 | : $(property-set) ] ; | ||||
161 | <endfold id='1'>}</endfold id='1'> | ||||
162 | | ||||
163 | | ||||
164 | rule link | ||||
165 | <beginfold id='1'>{</beginfold id='1'> | ||||
166 | DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ; | ||||
167 | <endfold id='1'>}</endfold id='1'> | ||||
168 | | ||||
169 | | ||||
170 | actions link bind DEF_FILE | ||||
171 | <beginfold id='1'>{</beginfold id='1'> | ||||
172 | $(.LD) .... /DEF:$(DEF_FILE) .... | ||||
173 | <endfold id='1'>}</endfold id='1'> | ||||
174 | | ||||
175 | actions create-file-from-another | ||||
176 | <beginfold id='1'>{</beginfold id='1'> | ||||
177 | create-file-from-another $(OPTIONS) $(<) $(>) | ||||
178 | <endfold id='1'>}</endfold id='1'> | ||||
179 | | ||||
180 | | ||||
181 | mypackage = | ||||
182 | [ pkg-config.import mypackage : usage-requirements <conditional>@define_ns | ||||
183 | ] ; | ||||
184 | | ||||
185 | me = [ modules.binding $(__name__) ] ; | ||||
186 | | ||||
187 | local ZLIB_INCLUDE = [ modules.peek : ZLIB_INCLUDE ] ; | ||||
188 | | ||||
189 | local t = [ new file-target $(name) : CPP : $(project) : $(a) ] ; | ||||
190 | | ||||
191 | $(var) field1 : field2 : ... : fieldN ; | ||||
192 | $(var)o aaaa ; | ||||
193 | | ||||
194 | on target $(var) field1 : field2 : ... : fieldN ; | ||||
195 | | ||||
196 | [ $(var) field1 : field2 : ... : fieldN ] | ||||
197 | [ on target $(var) field1 : field2 : ... : fieldN ] | ||||
198 | | ||||
199 | | ||||
200 | local key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths" ; | ||||
201 | local values = [ W32_GETREGNAMES "$(key)\\$(subkey)" : values ] ; | ||||
202 | | ||||
203 | variable = $(b) $(c) ; | ||||
204 | variable += elements ; | ||||
205 | variable on targets = elements ; | ||||
206 | variable on targets += "elements" ; | ||||
207 | variable default = elements ; | ||||
208 | variable ?= elements ; | ||||
209 | | ||||
210 | defs += <define>NAME='\"$(VALUE)\"' ; | ||||
211 | | ||||
212 | x = $($(Z)) ; | ||||
213 | x = $(Z)x ; | ||||
214 | x = x$(Z) ; | ||||
215 | x = x$(Z)x ; | ||||
216 | | ||||
217 | x = "C:\\Program Files\\Borland" ; ECHO $(x:T) ; | ||||
218 | | ||||
219 | module my_module # my module | ||||
220 | <beginfold id='1'>{</beginfold id='1'> | ||||
221 | rule salute ( x ) <beginfold id='1'>{</beginfold id='1'> ECHO $(x), world ; <endfold id='1'>}</endfold id='1'> | ||||
222 | rule greet ( ) <beginfold id='1'>{</beginfold id='1'> salute hello ; <endfold id='1'>}</endfold id='1'> | ||||
223 | greet ; # ok | ||||
224 | <endfold id='1'>}</endfold id='1'> | ||||
225 | | ||||
226 | class verbatim-scanner : common-scanner | ||||
227 | <beginfold id='1'>{</beginfold id='1'> | ||||
228 | rule pattern ( ) | ||||
229 | <beginfold id='1'>{</beginfold id='1'> | ||||
230 | return "//###include[ ]*\"([^\"]*)\"" ; | ||||
231 | <endfold id='1'>}</endfold id='1'> | ||||
232 | greet ; # error | ||||
233 | <endfold id='1'>}</endfold id='1'> |