1 # Copyright (c) 2020 Edward Diener
3 # Use, modification and distribution is subject to the Boost Software
4 # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
5 # http://www.boost.org/LICENSE_1_0.txt)
9 [[bbv2.reference.tools.compiler.borland]]
10 = Embarcadero C++ Compiler
12 The `embarcadero` module supports the 32-bit command line C++ compiler
13 bcc32x and the 64-bit command line C++ compiler bcc64, both clang-based,
14 running on Microsoft Windows. These are the clang-based Windows compilers
15 for all versions of Embarcadero C++.
17 The module is initialized using the following syntax:
20 using embarcadero : [version] : [c++-compile-command] : [compiler options] ;
23 This statement may be repeated several times, if you want to configure
24 several versions of the compiler.
28 The version should be the compiler version if specified. if the
29 version is not specified Boost Build will find the latest installed
30 version of Embarcadero C++ and use that for the version. If the version
31 is specified Boost Build does not check if this matches any particular
32 version of Embarcadero C++, so you may use the version as a mnemonic to
33 configure separate 'versions'.
35 `c++-compile-command`:
37 If the c++-compile-command is not specified, Boost.Build will default to the
38 bcc64 compiler. If you specify a compiler option of <address-model>32 the
39 default compiler will be bcc32x. In either case when the command is not given
40 Boost Build will assume the compiler is in the PATH. So it is not necessary
41 to specify a command if you accept the default compiler and the Embarcadero
42 C++ binary directory is in the PATH.
44 If the command is specified it will be used as is to invoke the compiler.
45 If the command has either 'bcc32x(.exe)' or 'bcc64(.exe)' in it Boost Build
46 will use the appropriate compiler to configure the toolset. If the command
47 does not have either 'bcc32x(.exe)' or 'bcc64(.exe)' in it, Boost Build
48 will use the default compiler to configure the toolset. If you have your
49 own command, which does not have 'bcc32x(.exe)' in it but invokes the
50 'bcc32x(.exe)' compiler, specify the <address-model>32 compiler option.
54 The following options can be provided, using
55 _`<option-name>option-value syntax`_:
58 Specifies additional compiler flags that will be used when compiling C
62 Specifies additional compiler flags that will be used when compiling C++
66 Specifies additional command line options that will be passed to the linker.
69 Specifies additional command line options that will be passed to the assembler.
72 Specifies additional command line options that will be passed to the archiver,
73 which creates a static library.
76 This option can be used to specify the default compiler as specified in the
77 dicsussion above of the c++-compile-command. Otherwise the address model
78 is not used to initialize the toolset.
81 Specifies the user interface for applications. Valid choices are `console`
82 for a console applicatiuon and `gui` for a Windows application.
85 Normallly Boost Build will automatically be able to determine the root of
86 the Embarcadero C++ installation. It does this in various ways, but primarily
87 by checking a registry entry. If you specify the root it will use that
88 path, and the root you specify should be the full path to the Embarcadero
89 C++ installation on your machine ( without a trailing \ or / ). You should
90 not need to specify this option unless Boost Build can not find the
91 Embarcadero C++ root directory.
97 Configures the toolset to use the latest version, with bcc64 as the compiler.
98 The bcc64 compiler must be in the PATH.
100 using embarcadero : 7.40 ;
102 Configures the toolset to use the 7.40 version, with bcc64 as the compiler.
103 The bcc64 compiler must be in the PATH.
105 using embarcadero : 7.40 : bcc32x ;
106 using embarcadero : 7.40 : : <address-model>32 ;
108 Configures the toolset to use the 7.40 version, with bcc32x as the compiler.
109 The bcc32x compiler must be in the PATH.
111 using embarcadero : : c:/some_path/bcc64 ;
113 Configures the toolset to use the latest version, with full command specified.
115 using embarcadero : : full_command : <address-model>32 ;
117 Configures the toolset to use the latest version, with full command specified
118 and bcc32x as the compiler.
120 using embarcadero : : : <root>c:/root_path ;
122 Configures the toolset to use the latest version, with bcc64 as the compiler
123 and the root directory of the installation specified. The bcc64 compiler must
135 import toolset : flags ;
141 feature.extend toolset : embarcadero ;
143 toolset.inherit-generators embarcadero : clang-linux ;
144 generators.override embarcadero.prebuilt : builtin.lib-generator ;
145 generators.override embarcadero.prebuilt : builtin.prebuilt ;
146 generators.override embarcadero.searched-lib-generator : searched-lib-generator ;
148 toolset.inherit-rules embarcadero : clang-linux ;
149 toolset.inherit-flags embarcadero
151 : <runtime-link>shared
154 <threading>multi/<target-os>windows
158 <target-os>windows/<runtime-link>static
159 <target-os>windows/<runtime-link>shared
172 <cxxstd>98/<cxxstd-dialect>iso
173 <cxxstd>03/<cxxstd-dialect>iso
174 <cxxstd>0x/<cxxstd-dialect>iso
175 <cxxstd>11/<cxxstd-dialect>iso
176 <cxxstd>1y/<cxxstd-dialect>iso
177 <cxxstd>14/<cxxstd-dialect>iso
178 <cxxstd>1z/<cxxstd-dialect>iso
179 <cxxstd>17/<cxxstd-dialect>iso
180 <cxxstd>2a/<cxxstd-dialect>iso
181 <cxxstd>20/<cxxstd-dialect>iso
182 <cxxstd>latest/<cxxstd-dialect>iso
185 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] {
186 .debug-configuration = true ;
189 rule init ( version ? : command * : options * )
192 local compiler = bcc64 ;
193 local preprocessor = cpp64 ;
196 local optam = [ feature.get-values <address-model> : $(options) ] ;
203 preprocessor = cpp32x ;
206 else if ! ( $(optam) = 64 )
212 command = [ common.get-invocation-command embarcadero : $(compiler) : $(command) ] ;
214 switch $(command[1]:BL)
218 preprocessor = cpp32x ;
222 preprocessor = cpp64 ;
226 preprocessor = cpp32x ;
230 preprocessor = cpp64 ;
234 if $(optam) && $(optam) != $(amodel)
236 errors.user-error "embarcadero initialization: compiler and address model" :
237 "the compiler '$(compiler)' does not match the address-model of '$(optam)'" ;
241 # Determine the version
243 local command-string = "$(command)" ;
244 command-string = $(command-string:J=" ") ;
245 local soutput = [ SHELL "$(command-string) --version" ] ;
246 version ?= [ MATCH "Embarcadero C[+][+] ([0-9.]+)" : $(soutput) ] ;
247 cl_version = [ MATCH ".+version[ ]+([0-9.]+)" : $(soutput) ] ;
254 local condition = [ common.check-init-parameters embarcadero : version $(version) ] ;
255 handle-options $(condition) : $(command) : $(options) ;
257 # Support for the Embarcadero root directory. If the Embarcadero binary
258 # directory is not in the PATH we need to tell the underlying clang
259 # implementation where to find the Embarcadero header/library files
260 # and set the correct runtime path so that we can execute Embarcadero
261 # programs and find Embarcadero DLLs.
263 local root = [ feature.get-values <root> : $(options) ] ;
265 # 1) Look in registry
270 local sdkdir = [ get_sdk_dir ] ;
275 local bdsv = [ get_bds_version $(sdkdir) ] ;
280 local has_dec = [ MATCH "(.+[.])" : $(bdsv) ] ;
285 bdsv_full = $(bdsv).0 ;
288 local troot = [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv)" : RootDir ] ;
293 troot = [ concatenate $(troot) : name ] ;
298 troot = [ W32_GETREG "HKEY_CURRENT_USER\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv)" : RootDir ] ;
302 troot = [ concatenate $(troot) : name ] ;
307 troot = [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv_full)" : RootDir ] ;
311 troot = [ concatenate $(troot) : name ] ;
316 troot = [ W32_GETREG "HKEY_CURRENT_USER\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv_full)" : RootDir ] ;
320 troot = [ concatenate $(troot) : name ] ;
331 # 2) Look for path in the command
336 local cpath = $(command[1]:D) ;
344 # 3) Search for the directory of the command
349 local pdirs = [ path.programs-path ] ;
351 for local dir in $(pdirs)
354 local match = [ MATCH "/(.:.+)" : $(dir) ] ;
361 if [ CHECK_IF_FILE $(dir)/$(command) ]
366 if [ CHECK_IF_FILE $(dir)/$(command).exe ]
376 errors.user-error "Embarcadero toolset initialization: the root directory for the Embarcadero installation can not be found" ;
381 local lib_path = $(root)/bin $(root)/bin64 $(root)/Bpl C:/Users/Public/Documents/Embarcadero ;
382 if $(.debug-configuration)
384 ECHO "notice:" using Embarcadero libraries with clang compilation"::" $(condition) "::" $(lib_path) ;
386 flags embarcadero.link RUN_PATH $(condition) : $(lib_path) ;
388 local system_include_option = "-isystem " ;
389 local system_include_directories = $(root)/include/windows/crtl $(root)/include/windows/sdk $(root)/include/windows/rtl $(root)/include/dinkumware64 ;
391 local lib_dir_release ;
392 local lib_dir_debug ;
400 if $(compiler) = bcc32x
402 lib_dir_release = $(root)/lib/win32c/release $(root)/lib/win32c/release/psdk ;
403 lib_dir_debug = $(root)/lib/win32c/debug ;
407 assembler = $(root)/bin/tasm32 ;
409 # /ml makes all symbol names case-sensitive
414 else if $(compiler) = bcc64
417 lib_dir_release = $(root)/lib/win64/release $(root)/lib/win64/release/psdk ;
418 lib_dir_debug = $(root)/lib/win64/debug ;
424 flags embarcadero.compile .EMB_SYSINC $(condition) : $(system_include_option)$(system_include_directories) ;
425 flags embarcadero.link LINKPATH $(condition)/<variant>release : $(lib_dir_release) ;
426 flags embarcadero.link LINKPATH $(condition)/<variant>debug : $(lib_dir_debug) $(lib_dir_release) ;
427 flags embarcadero.archive .AR $(condition) : $(root)/bin/$(archiver) ;
428 flags embarcadero.archive .ARFLAGS $(condition) : $(arflags) ;
429 flags embarcadero.asm .ASM $(condition) : $(assembler) ;
430 flags embarcadero.asm .ASMFLAGS $(condition) : $(asmflags) ;
431 flags embarcadero.asm .ASMOUTPUT $(condition) : $(asmoutput) ;
432 flags embarcadero.asm USER_OPTIONS $(condition) : [ feature.get-values <asmflags> : $(options) ] ;
433 flags embarcadero.archive AROPTIONS $(condition) : [ feature.get-values <archiveflags> : $(options) ] ;
434 flags embarcadero.link.dll .IMPLIB_COMMAND $(condition) : $(root)/bin/$(implib) ;
436 local mte = [ feature.get-values <user-interface> : $(options) ] ;
440 flags embarcadero OPTIONS <main-target-type>EXE/$(condition) : <user-interface>$(mte) ;
444 flags embarcadero OPTIONS <main-target-type>EXE/$(condition) : <user-interface>console ;
450 local rule concatenate ( path : name )
454 local has_ending_slash = [ MATCH ".*([/\\])$" : $(path) ] ;
455 local has_backward_slash = [ MATCH ".*([\\])" : $(path) ] ;
457 if $(has_ending_slash)
459 result = $(path)$(name) ;
461 else if $(has_backward_slash)
463 result = $(path)"\\"$(name) ;
467 result = $(path)"/"$(name) ;
472 local rule get_sdk_dir ( )
476 local appdata = [ os.environ APPDATA ] ;
480 ret = $(appdata:T)/Embarcadero/BDS ;
485 local rule get_bds_version ( sdir )
489 local flist = [ GLOB $(sdir) : * ] ;
496 for local file in $(flist)
498 if ! [ CHECK_IF_FILE $(file) ]
506 local ldir = $(dirs[-1]) ;
514 local rule handle-options ( condition * : command * : options * )
516 if $(.debug-configuration)
518 ECHO "notice:" will use '$(command)' for embarcadero, condition
519 $(condition:E=(empty)) ;
522 flags embarcadero CONFIG_COMMAND $(condition) : $(command) ;
524 flags embarcadero.compile OPTIONS $(condition) :
525 [ feature.get-values <cflags> : $(options) ] ;
527 flags embarcadero.compile.c++ OPTIONS $(condition) :
528 [ feature.get-values <cxxflags> : $(options) ] ;
530 flags embarcadero.link OPTIONS $(condition) :
531 [ feature.get-values <linkflags> : $(options) ] ;
534 ###############################################################################
537 type.set-generated-target-suffix OBJ : <toolset>embarcadero <target-os>windows <address-model>64 : o ;
538 type.set-generated-target-suffix OBJ : <toolset>embarcadero <target-os>windows <address-model>32 : obj ;
539 type.set-generated-target-suffix STATIC_LIB : <toolset>embarcadero <target-os>windows <address-model>64 : a ;
540 type.set-generated-target-suffix STATIC_LIB : <toolset>embarcadero <target-os>windows <address-model>32 : lib ;
541 type.set-generated-target-suffix IMPORT_LIB : <toolset>embarcadero <target-os>windows <address-model>64 : a ;
542 type.set-generated-target-suffix IMPORT_LIB : <toolset>embarcadero <target-os>windows <address-model>32 : lib ;
544 generators.register-linker embarcadero.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>embarcadero ;
545 generators.register-linker embarcadero.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>embarcadero ;
547 generators.register-archiver embarcadero.archive : OBJ : STATIC_LIB : <toolset>embarcadero ;
548 generators.register-c-compiler embarcadero.compile.c++ : CPP : OBJ : <toolset>embarcadero ;
549 generators.register-c-compiler embarcadero.compile.c : C : OBJ : <toolset>embarcadero ;
550 generators.register-c-compiler embarcadero.compile.asm : ASM : OBJ : <toolset>embarcadero <address-model>64 ;
551 generators.register-standard embarcadero.asm : ASM : OBJ : <toolset>embarcadero <address-model>32 ;
555 local opt_console = -tC ;
556 local opt_shared = -tD ;
558 local opt_drtl = -tR ;
559 local opt_dapp = -tW ;
560 local opt_compile_flags = -DNDEBUG ;
561 local opt_lflags = "-lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192" ;
563 flags embarcadero OPTIONS <user-interface>console : $(opt_console) ;
564 flags embarcadero OPTIONS <user-interface>gui : $(opt_dapp) ;
565 flags embarcadero OPTIONS <runtime-link>shared : $(opt_drtl) ;
566 flags embarcadero OPTIONS <main-target-type>LIB/<link>shared : $(opt_shared) ;
567 flags embarcadero OPTIONS <threading>multi : $(opt_mt) ;
568 flags embarcadero.compile OPTIONS <variant>release : $(opt_compile_flags) ;
569 flags embarcadero.link OPTIONS : $(opt_lflags) ;
570 flags embarcadero.archive AROPTIONS <archiveflags> ;
571 flags embarcadero.asm USER_OPTIONS <asmflags> ;
572 flags embarcadero.compile OPTIONS <address-model>32 : -m32 ;
573 flags embarcadero.compile OPTIONS <address-model>64 : -m64 ;
574 flags embarcadero.link OPTIONS <address-model>32 : -m32 ;
575 flags embarcadero.link OPTIONS <address-model>64 : -m64 ;
576 flags embarcadero.link .EMBLRSP <variant>release : _emb_lpr ;
577 flags embarcadero.link .EMBLRSP <variant>debug : _emb_lpd ;
578 flags embarcadero.compile .EMBCRSP <variant>release : _emb_sir ;
579 flags embarcadero.compile .EMBCRSP <variant>debug : _emb_sid ;
584 rule compile.c++ ( targets * : sources * : properties * ) {
587 actions compile.c++ {
588 "$(CONFIG_COMMAND)" -c -x c++ @"@($(<[1]:DBW)$(.EMBCRSP)$(<[1]:S).rsp:E=$(nl)"$(.EMB_SYSINC)")" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
591 rule compile.c ( targets * : sources * : properties * )
597 "$(CONFIG_COMMAND)" -c -x c @"@($(<[1]:DBW)$(.EMBCRSP)$(<[1]:S).rsp:E=$(nl)"$(.EMB_SYSINC)")" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
600 rule archive ( targets * : sources * : properties * )
604 actions updated together piecemeal archive
606 "$(.AR)" $(AROPTIONS) $(.ARFLAGS) /u /a /C "$(<)" +-"$(>)"
609 rule link ( targets * : sources * : properties * ) {
610 JAM_SEMAPHORE on $(targets) = <s>embarcadero-link-semaphore ;
613 rule link.dll ( targets * : sources * : properties * ) {
614 JAM_SEMAPHORE on $(targets) = <s>embarcadero-link-semaphore ;
617 actions link bind LIBRARIES {
618 "$(CONFIG_COMMAND)" @"@($(<[1]:DBW)$(.EMBLRSP)$(<[1]:S).rsp:E=$(nl)-L"$(LINKPATH)")" -o "$(<)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)")" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS)
621 actions link.dll bind LIBRARIES {
622 "$(CONFIG_COMMAND)" @"@($(<[1]:DBW)$(.EMBLRSP)$(<[1]:S).rsp:E=$(nl)-L"$(LINKPATH)")" -o "$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)")" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS) && "$(.IMPLIB_COMMAND)" "$(<[2])" "$(<[1])"
625 rule asm ( targets * : sources * : properties * )
631 $(.ASM) $(.ASMFLAGS) $(USER_OPTIONS) "$(>)" $(.ASMOUTPUT) "$(<)"
634 rule compile.asm ( targets * : sources * : properties * )
636 LANG on $(<) = "-x assembler-with-cpp" ;
641 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"