]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright 2005 Dave Abrahams |
2 | # Copyright 2003 Rene Rivera | |
3 | # Copyright 2003, 2004, 2005 Vladimir Prus | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
92f5a8d4 TL |
7 | #| tag::doc[] |
8 | ||
9 | [[bbv2.reference.tools.compiler.borland]] | |
10 | = Borland C++ Compiler | |
11 | ||
12 | The `borland` module supports the command line C++ compiler included in | |
13 | http://www.borland.com/us/products/cbuilder/index.html[C++ Builder 2006] | |
14 | product and earlier version of it, running on Microsoft Windows. | |
15 | ||
16 | The supported products are listed below. The version reported by the | |
17 | command lines tools is also listed for reference.: | |
18 | ||
19 | * C++ Builder 2006 -- 5.8.2 | |
20 | * CBuilderX -- 5.6.5, 5.6.4 (depending on release) | |
21 | * CBuilder6 -- 5.6.4 | |
22 | * Free command line tools -- 5.5.1 | |
23 | ||
24 | The module is initialized using the following syntax: | |
25 | ||
26 | ---- | |
27 | using borland : [version] : [c++-compile-command] : [compiler options] ; | |
28 | ---- | |
29 | ||
30 | This statement may be repeated several times, if you want to configure | |
31 | several versions of the compiler. | |
32 | ||
33 | If the command is not specified, Boost.Build will search for a binary | |
34 | named `bcc32` in PATH. | |
35 | ||
36 | The following options can be provided, using | |
37 | _`<option-name>option-value syntax`_: | |
38 | ||
39 | `cflags`:: | |
40 | Specifies additional compiler flags that will be used when compiling C | |
41 | sources. | |
42 | ||
43 | `cxxflags`:: | |
44 | Specifies additional compiler flags that will be used when compiling C++ | |
45 | sources. | |
46 | ||
47 | `compileflags`:: | |
48 | Specifies additional compiler flags that will be used when compiling both C | |
49 | and C++ sources. | |
50 | ||
51 | `linkflags`:: | |
52 | Specifies additional command line options that will be passed to the linker. | |
53 | ||
54 | |# # end::doc[] | |
55 | ||
7c673cae FG |
56 | # Support for the Borland's command line compiler |
57 | ||
58 | import property ; | |
59 | import generators ; | |
60 | import os ; | |
61 | import toolset : flags ; | |
62 | import feature : get-values ; | |
63 | import type ; | |
64 | import common ; | |
65 | ||
66 | feature.extend toolset : borland ; | |
67 | ||
68 | rule init ( version ? : command * : options * ) | |
69 | { | |
70 | local condition = [ common.check-init-parameters borland : | |
71 | version $(version) ] ; | |
72 | ||
73 | local command = [ common.get-invocation-command borland : bcc32.exe | |
74 | : $(command) ] ; | |
75 | ||
76 | common.handle-options borland : $(condition) : $(command) : $(options) ; | |
77 | ||
78 | if $(command) | |
79 | { | |
80 | command = [ common.get-absolute-tool-path $(command[-1]) ] ; | |
81 | } | |
82 | root = $(command:D) ; | |
83 | ||
84 | flags borland.compile STDHDRS $(condition) : $(root)/include/ ; | |
85 | flags borland.link STDLIBPATH $(condition) : $(root)/lib ; | |
86 | flags borland.link RUN_PATH $(condition) : $(root)/bin ; | |
87 | flags borland .root $(condition) : $(root)/bin/ ; | |
88 | } | |
89 | ||
90 | ||
91 | # A borland-specific target type | |
92 | type.register BORLAND.TDS : tds ; | |
93 | ||
94 | # Declare generators | |
95 | ||
96 | generators.register-linker borland.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>borland ; | |
97 | generators.register-linker borland.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>borland ; | |
98 | ||
99 | generators.register-archiver borland.archive : OBJ : STATIC_LIB : <toolset>borland ; | |
100 | generators.register-c-compiler borland.compile.c++ : CPP : OBJ : <toolset>borland ; | |
101 | generators.register-c-compiler borland.compile.c : C : OBJ : <toolset>borland ; | |
102 | generators.register-standard borland.asm : ASM : OBJ : <toolset>borland ; | |
103 | ||
104 | # Declare flags | |
105 | ||
106 | flags borland.compile OPTIONS <debug-symbols>on : -v ; | |
107 | flags borland.link OPTIONS <debug-symbols>on : -v ; | |
108 | ||
109 | flags borland.compile OPTIONS <optimization>off : -Od ; | |
110 | flags borland.compile OPTIONS <optimization>speed : -O2 ; | |
111 | flags borland.compile OPTIONS <optimization>space : -O1 ; | |
112 | ||
113 | if $(.BORLAND_HAS_FIXED_INLINING_BUGS) | |
114 | { | |
115 | flags borland CFLAGS <inlining>off : -vi- ; | |
116 | flags borland CFLAGS <inlining>on : -vi -w-inl ; | |
117 | flags borland CFLAGS <inlining>full : -vi -w-inl ; | |
118 | } | |
119 | else | |
120 | { | |
121 | flags borland CFLAGS : -vi- ; | |
122 | } | |
123 | ||
124 | flags borland.compile OPTIONS <warnings>off : -w- ; | |
125 | flags borland.compile OPTIONS <warnings>all : -w ; | |
126 | flags borland.compile OPTIONS <warnings-as-errors>on : -w! ; | |
127 | ||
128 | ||
129 | # Deal with various runtime configs... | |
130 | ||
131 | # This should be not for DLL | |
132 | flags borland OPTIONS <user-interface>console : -tWC ; | |
133 | ||
134 | # -tWR sets -tW as well, so we turn it off here and then turn it | |
135 | # on again later if we need it: | |
136 | flags borland OPTIONS <runtime-link>shared : -tWR -tWC ; | |
137 | flags borland OPTIONS <user-interface>gui : -tW ; | |
138 | ||
139 | flags borland OPTIONS <main-target-type>LIB/<link>shared : -tWD ; | |
140 | # Hmm.. not sure what's going on here. | |
141 | flags borland OPTIONS : -WM- ; | |
142 | flags borland OPTIONS <threading>multi : -tWM ; | |
143 | ||
144 | ||
145 | ||
146 | flags borland.compile OPTIONS <cflags> ; | |
147 | flags borland.compile.c++ OPTIONS <cxxflags> ; | |
148 | flags borland.compile DEFINES <define> ; | |
149 | flags borland.compile INCLUDES <include> ; | |
150 | ||
151 | flags borland NEED_IMPLIB <main-target-type>LIB/<link>shared : "" ; | |
152 | ||
153 | # | |
154 | # for C++ compiles the following options are turned on by default: | |
155 | # | |
156 | # -j5 stops after 5 errors | |
157 | # -g255 allow an unlimited number of warnings | |
158 | # -q no banner | |
159 | # -c compile to object | |
92f5a8d4 | 160 | # -P C++ code regardless of file extension |
7c673cae FG |
161 | # -a8 8 byte alignment, this option is on in the IDE by default |
162 | # and effects binary compatibility. | |
163 | # | |
164 | ||
165 | # -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o"$(<)" "$(>)" | |
166 | ||
167 | ||
168 | actions compile.c++ | |
169 | { | |
170 | "$(CONFIG_COMMAND)" -j5 -g255 -q -c -P -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" | |
171 | } | |
172 | ||
173 | # For C, we don't pass -P flag | |
174 | actions compile.c | |
175 | { | |
176 | "$(CONFIG_COMMAND)" -j5 -g255 -q -c -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" | |
177 | } | |
178 | ||
179 | ||
180 | # Declare flags and action for linking | |
181 | toolset.flags borland.link OPTIONS <debug-symbols>on : -v ; | |
182 | toolset.flags borland.link LIBRARY_PATH <library-path> ; | |
183 | toolset.flags borland.link FINDLIBS_ST <find-static-library> ; | |
184 | toolset.flags borland.link FINDLIBS_SA <find-shared-library> ; | |
185 | toolset.flags borland.link LIBRARIES <library-file> ; | |
186 | ||
187 | flags borland.link OPTIONS <linkflags> ; | |
188 | flags borland.link OPTIONS <link>shared : -tWD ; | |
189 | ||
190 | flags borland.link LIBRARY_PATH_OPTION <toolset>borland : -L : unchecked ; | |
191 | flags borland.link LIBRARY_OPTION <toolset>borland : "" : unchecked ; | |
192 | ||
193 | ||
194 | ||
195 | # bcc32 needs to have ilink32 in the path in order to invoke it, so explicitly | |
196 | # specifying $(BCC_TOOL_PATH)bcc32 doesn't help. You need to add | |
197 | # $(BCC_TOOL_PATH) to the path | |
198 | # The NEED_IMPLIB variable controls whether we need to invoke implib. | |
199 | ||
200 | flags borland.archive AROPTIONS <archiveflags> ; | |
201 | ||
202 | # Declare action for archives. We don't use response file | |
203 | # since it's hard to get "+-" there. | |
204 | # The /P256 increases 'page' size -- with too low | |
205 | # values tlib fails when building large applications. | |
206 | # CONSIDER: don't know what 'together' is for... | |
207 | actions updated together piecemeal archive | |
208 | { | |
209 | $(.set-path)$(.root:W)$(.old-path) | |
210 | tlib $(AROPTIONS) /P256 /u /a /C "$(<:W)" +-"$(>:W)" | |
211 | } | |
212 | ||
213 | ||
214 | if [ os.name ] = CYGWIN | |
215 | { | |
216 | .set-path = "cmd /S /C set \"PATH=" ; | |
217 | .old-path = ";%PATH%\" \"&&\"" ; | |
218 | ||
219 | ||
220 | # Couldn't get TLIB to stop being confused about pathnames | |
221 | # containing dashes (it seemed to treat them as option separators | |
222 | # when passed through from bash), so we explicitly write the | |
223 | # command into a .bat file and execute that. TLIB is also finicky | |
224 | # about pathname style! Forward slashes, too, are treated as | |
225 | # options. | |
226 | actions updated together piecemeal archive | |
227 | { | |
228 | chdir $(<:D) | |
229 | echo +-$(>:BS) > $(<:BS).rsp | |
230 | $(.set-path)$(.root)$(.old-path) "tlib.exe" $(AROPTIONS) /P256 /C $(<:BS) @$(<:BS).rsp && $(RM) $(<:BS).rsp | |
231 | } | |
232 | } | |
233 | else if [ os.name ] = NT | |
234 | { | |
235 | .set-path = "set \"PATH=" ; | |
236 | .old-path = ";%PATH%\" | |
237 | " ; | |
238 | } | |
239 | else | |
240 | { | |
241 | .set-path = "PATH=\"" ; | |
242 | .old-path = "\":$PATH | |
243 | export PATH | |
244 | " ; | |
245 | } | |
246 | ||
247 | RM = [ common.rm-command ] ; | |
248 | ||
249 | nl = " | |
250 | " ; | |
251 | ||
252 | actions link | |
253 | { | |
254 | $(.set-path)$(.root:W)$(.old-path) "$(CONFIG_COMMAND)" -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")" | |
255 | } | |
256 | ||
257 | ||
258 | actions link.dll bind LIBRARIES RSP | |
259 | { | |
260 | $(.set-path)$(.root:W)$(.old-path) "$(CONFIG_COMMAND)" -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")" && "$(.root)implib" "$(<[2]:W)" "$(<[1]:W)" | |
261 | } | |
262 | ||
263 | # It seems impossible to specify output file with directory when compiling | |
264 | # asm files using bcc32, so use tasm32 directly. | |
265 | # /ml makes all symbol names case-sensitive | |
266 | actions asm | |
267 | { | |
268 | $(.set-path)$(.root:W)$(.old-path) tasm32.exe /ml "$(>)" "$(<)" | |
269 | } | |
270 |