2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

Added support for Embarcardero C++ compilers based on clang-5.0 (#551)

* Updated borland.jam to support latest Embarcadero C++ using the 32-bit compilers bcc32/bcc32c.

# Conflicts:
#	src/tools/borland.jam

* Don't pass command line options which bcc32c can not handle.

(cherry picked from commit 7c1ae7d6b1)

* Only set shared when creating DLL.

(cherry picked from commit c71077e2ef)

* Use -b- only with bcc32.

(cherry picked from commit 5be4246c43)

* Add embarcadero toolset for C++ Builder using clang technology. This initially includes bcc32c and bcc32x for 32-bit Windows and bcc64 for 64-bit Windows.

(cherry picked from commit 3dc0664ecf)

* Clean up conditional flags when the condition is not needed.

(cherry picked from commit 2bce8908d0)

* Fixed syntax and other errors.

(cherry picked from commit 3d350030c2)

* More fixes for embarcadero jam file syntax problems. Set the default EXE to a console application.

(cherry picked from commit 61844755ce)

* Added support for static library archive with tlib/tlib64.

(cherry picked from commit 365de8eb71)

* Update before further changes.

(cherry picked from commit 3a7e024686)

* Simplify requirements.

(cherry picked from commit 250ec1d7ed)

* Dropped support for bcc32c since it errors out with quite a number of clang command line options. That compiler is supported by the borland.jam file.

(cherry picked from commit 7648561a8c)

* Support for asm, archive, and user-interface options. Addition of precompiled header type.

(cherry picked from commit 25adec6e69)

* Added docs. Removed precompiled headers.

(cherry picked from commit 5af0447386)

* Remove change to version.jam and put code locally into borland.jam.

(cherry picked from commit 2ef8485e7a)

* Fixed a number of syntax issues. Fix the methods for finding the root directory. Updated the documentation.

(cherry picked from commit a52cda799f)

* Adding address model options for compile and link.

(cherry picked from commit 439c9fdaaf)

* Added linker option to generate the import library.

(cherry picked from commit b934a4fd8a)

* Update import library switch to link.dll.

(cherry picked from commit c8891dda7d)

* Added my copyright to borland.jam toolset and fixed the creation of DLLs and static libraries in the embarcadero.jam troolset.

Co-authored-by: Edward Diener <eldlistmailingz@tropicsoft.com>
This commit is contained in:
Edward Diener
2020-03-20 22:33:17 -04:00
committed by GitHub
parent 3982f4808a
commit cf52a6b4af
2 changed files with 696 additions and 55 deletions

View File

@@ -1,25 +1,19 @@
# Copyright 2005 Dave Abrahams
# Copyright 2003 Rene Rivera
# Copyright 2003, 2004, 2005 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Copyright 2005 Dave Abrahams
# Copyright 2003 Rene Rivera
# Copyright 2003, 2004, 2005 Vladimir Prus
# Copyright (c) 2020 Edward Diener
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
#| tag::doc[]
[[bbv2.reference.tools.compiler.borland]]
= Borland C++ Compiler
The `borland` module supports the command line C++ compiler included in
http://www.borland.com/us/products/cbuilder/index.html[C++ Builder 2006]
product and earlier version of it, running on Microsoft Windows.
The supported products are listed below. The version reported by the
command lines tools is also listed for reference.:
* C++ Builder 2006 -- 5.8.2
* CBuilderX -- 5.6.5, 5.6.4 (depending on release)
* CBuilder6 -- 5.6.4
* Free command line tools -- 5.5.1
The `borland` module supports the 32-bit command line C++ compilers
running on Microsoft Windows. This is the bcc32 executable for all
versions of Borland C++ and C++ Builder, as well as the command line
compatible compiler bcc32c on later versions of C++ Builder.
The module is initialized using the following syntax:
@@ -30,7 +24,7 @@ using borland : [version] : [c++-compile-command] : [compiler options] ;
This statement may be repeated several times, if you want to configure
several versions of the compiler.
If the command is not specified, B2 will search for a binary
If the command is not specified, Boost.Build will search for a binary
named `bcc32` in PATH.
The following options can be provided, using
@@ -51,6 +45,10 @@ and C++ sources.
`linkflags`::
Specifies additional command line options that will be passed to the linker.
`user-interface`::
Specifies the user interface for applications. Valid choices are `console`
for a console applicatiuon and `gui` for a Windows application.
|# # end::doc[]
# Support for the Borland's command line compiler
@@ -62,31 +60,100 @@ import toolset : flags ;
import feature : get-values ;
import type ;
import common ;
import version ;
feature.extend toolset : borland ;
rule init ( version ? : command * : options * )
{
local condition = [ common.check-init-parameters borland :
version $(version) ] ;
local command = [ common.get-invocation-command borland : bcc32.exe
local command = [ common.get-invocation-command borland : bcc32.exe
: $(command) ] ;
common.handle-options borland : $(condition) : $(command) : $(options) ;
local just_bcc32 = [ MATCH ".*(bcc32)([^a-z0-9]|$)" : $(command:L) ] ;
if $(command)
{
command = [ common.get-absolute-tool-path $(command[-1]) ] ;
}
root = $(command:D) ;
}
root = $(command:D) ;
flags borland.compile STDHDRS $(condition) : $(root)/include/ ;
flags borland.link STDLIBPATH $(condition) : $(root)/lib ;
flags borland.link RUN_PATH $(condition) : $(root)/bin ;
flags borland .root $(condition) : $(root)/bin/ ;
flags borland .root $(condition) : $(root)/bin/ ;
local jv ;
if $(version)
{
jv = [ MATCH "^([0-9.]+)" : $(version) ] ;
}
if ! $(jv) || [ version.version-less [ version-split $(jv) ] : 6 30 ]
{
init-earlier-releases $(condition) ;
}
else
{
init-later-releases $(condition) ;
}
if $(just_bcc32) && ( $(just_bcc32[1]) = bcc32 )
{
flags borland.compile OPTIONS $(condition) : -g255 -Vx- -Ve- -b- ;
}
}
# Splits a version in its form of n[.n][.n] into n n n etc.
#
local rule version-split ( v )
{
return [ SPLIT_BY_CHARACTERS $(v) : . ] ;
}
local rule init-earlier-releases ( condition )
{
# Deal with various runtime configs...
# This should be not for DLL
flags borland OPTIONS $(condition)/<user-interface>console : -tWC ;
# -tWR sets -tW as well, so we turn it off here and then turn it
# on again later if we need it:
flags borland OPTIONS $(condition)/<runtime-link>shared : -tWR -tWC ;
flags borland OPTIONS $(condition)/<main-target-type>LIB/<link>shared : -tWD ;
# Hmm.. not sure what's going on here.
flags borland OPTIONS $(condition) : -WM- ;
flags borland OPTIONS $(condition)/<threading>multi : -tWM ;
flags borland.link OPTIONS $(condition)/<link>shared : -tWD ;
}
local rule init-later-releases ( condition )
{
# Deal with various runtime configs...
# This should be not for DLL
flags borland OPTIONS $(condition)/<user-interface>console : -tC ;
flags borland OPTIONS $(condition)/<runtime-link>shared : -tR ;
flags borland OPTIONS $(condition)/<main-target-type>LIB/<link>shared : -tD ;
flags borland OPTIONS $(condition)/<main-target-type>EXE : -tC ;
flags borland OPTIONS $(condition)/<threading>multi : -tM ;
flags borland.link.dll OPTIONS $(condition)/<link>shared : -tD ;
}
# A borland-specific target type
type.register BORLAND.TDS : tds ;
@@ -101,7 +168,7 @@ generators.register-c-compiler borland.compile.c++ : CPP : OBJ : <toolset>borlan
generators.register-c-compiler borland.compile.c : C : OBJ : <toolset>borland ;
generators.register-standard borland.asm : ASM : OBJ : <toolset>borland ;
# Declare flags
# Declare flags
flags borland.compile OPTIONS <debug-symbols>on : -v ;
flags borland.link OPTIONS <debug-symbols>on : -v ;
@@ -125,24 +192,8 @@ flags borland.compile OPTIONS <warnings>off : -w- ;
flags borland.compile OPTIONS <warnings>all : -w ;
flags borland.compile OPTIONS <warnings-as-errors>on : -w! ;
# Deal with various runtime configs...
# This should be not for DLL
flags borland OPTIONS <user-interface>console : -tWC ;
# -tWR sets -tW as well, so we turn it off here and then turn it
# on again later if we need it:
flags borland OPTIONS <runtime-link>shared : -tWR -tWC ;
flags borland OPTIONS <user-interface>gui : -tW ;
flags borland OPTIONS <main-target-type>LIB/<link>shared : -tWD ;
# Hmm.. not sure what's going on here.
flags borland OPTIONS : -WM- ;
flags borland OPTIONS <threading>multi : -tWM ;
flags borland.compile OPTIONS <cflags> ;
flags borland.compile.c++ OPTIONS <cxxflags> ;
flags borland.compile DEFINES <define> ;
@@ -158,7 +209,7 @@ flags borland NEED_IMPLIB <main-target-type>LIB/<link>shared : "" ;
# -q no banner
# -c compile to object
# -P C++ code regardless of file extension
# -a8 8 byte alignment, this option is on in the IDE by default
# -a8 8 byte alignment, this option is on in the IDE by default
# and effects binary compatibility.
#
@@ -167,25 +218,24 @@ flags borland NEED_IMPLIB <main-target-type>LIB/<link>shared : "" ;
actions compile.c++
{
"$(CONFIG_COMMAND)" -j5 -g255 -q -c -P -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
"$(CONFIG_COMMAND)" -j5 -q -c -P -a8 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
}
# For C, we don't pass -P flag
actions compile.c
{
"$(CONFIG_COMMAND)" -j5 -g255 -q -c -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
"$(CONFIG_COMMAND)" -j5 -q -c -a8 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
}
# Declare flags and action for linking
toolset.flags borland.link OPTIONS <debug-symbols>on : -v ;
toolset.flags borland.link LIBRARY_PATH <library-path> ;
toolset.flags borland.link FINDLIBS_ST <find-static-library> ;
toolset.flags borland.link FINDLIBS_SA <find-shared-library> ;
toolset.flags borland.link LIBRARIES <library-file> ;
flags borland.link OPTIONS <debug-symbols>on : -v ;
flags borland.link LIBRARY_PATH <library-path> ;
flags borland.link FINDLIBS_ST <find-static-library> ;
flags borland.link FINDLIBS_SA <find-shared-library> ;
flags borland.link LIBRARIES <library-file> ;
flags borland.link OPTIONS <linkflags> ;
flags borland.link OPTIONS <link>shared : -tWD ;
flags borland.link LIBRARY_PATH_OPTION <toolset>borland : -L : unchecked ;
flags borland.link LIBRARY_OPTION <toolset>borland : "" : unchecked ;
@@ -205,7 +255,7 @@ flags borland.archive AROPTIONS <archiveflags> ;
# values tlib fails when building large applications.
# CONSIDER: don't know what 'together' is for...
actions updated together piecemeal archive
{
{
$(.set-path)$(.root:W)$(.old-path)
tlib $(AROPTIONS) /P256 /u /a /C "$(<:W)" +-"$(>:W)"
}
@@ -215,7 +265,7 @@ if [ os.name ] = CYGWIN
{
.set-path = "cmd /S /C set \"PATH=" ;
.old-path = ";%PATH%\" \"&&\"" ;
# Couldn't get TLIB to stop being confused about pathnames
# containing dashes (it seemed to treat them as option separators
@@ -224,11 +274,11 @@ if [ os.name ] = CYGWIN
# about pathname style! Forward slashes, too, are treated as
# options.
actions updated together piecemeal archive
{
{
chdir $(<:D)
echo +-$(>:BS) > $(<:BS).rsp
$(.set-path)$(.root)$(.old-path) "tlib.exe" $(AROPTIONS) /P256 /C $(<:BS) @$(<:BS).rsp && $(RM) $(<:BS).rsp
}
}
}
else if [ os.name ] = NT
{

591
src/tools/embarcadero.jam Normal file
View File

@@ -0,0 +1,591 @@
# Copyright (c) 2020 Edward Diener
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.txt)
#| tag::doc[]
[[bbv2.reference.tools.compiler.borland]]
= Embarcadero C++ Compiler
The `embarcadero` module supports the 32-bit command line C++ compiler
bcc32x and the 64-bit command line C++ compiler bcc64, both clang-based,
running on Microsoft Windows. These are the clang-based Windows compilers
for all versions of Embarcadero C++.
The module is initialized using the following syntax:
----
using embarcadero : [version] : [c++-compile-command] : [compiler options] ;
----
This statement may be repeated several times, if you want to configure
several versions of the compiler.
`version`:
The version should be the compiler version if specified. if the
version is not specified Boost Build will find the latest installed
version of Embarcadero C++ and use that for the version. If the version
is specified Boost Build does not check if this matches any particular
version of Embarcadero C++, so you may use the version as a mnemonic to
configure separate 'versions'.
`c++-compile-command`:
If the c++-compile-command is not specified, Boost.Build will default to the
bcc64 compiler. If you specify a compiler option of <address-model>32 the
default compiler will be bcc32x. In either case when the command is not given
Boost Build will assume the compiler is in the PATH. So it is not necessary
to specify a command if you accept the default compiler and the Embarcadero
C++ binary directory is in the PATH.
If the command is specified it will be used as is to invoke the compiler.
If the command has either 'bcc32x(.exe)' or 'bcc64(.exe)' in it Boost Build
will use the appropriate compiler to configure the toolset. If the command
does not have either 'bcc32x(.exe)' or 'bcc64(.exe)' in it, Boost Build
will use the default compiler to configure the toolset. If you have your
own command, which does not have 'bcc32x(.exe)' in it but invokes the
'bcc32x(.exe)' compiler, specify the <address-model>32 compiler option.
`compiler options`:
The following options can be provided, using
_`<option-name>option-value syntax`_:
`cflags`::
Specifies additional compiler flags that will be used when compiling C
and C++ sources.
`cxxflags`::
Specifies additional compiler flags that will be used when compiling C++
sources.
`linkflags`::
Specifies additional command line options that will be passed to the linker.
`asmflags`::
Specifies additional command line options that will be passed to the assembler.
`archiveflags`::
Specifies additional command line options that will be passed to the archiver,
which creates a static library.
`address-model`::
This option can be used to specify the default compiler as specified in the
dicsussion above of the c++-compile-command. Otherwise the address model
is not used to initialize the toolset.
`user-interface`::
Specifies the user interface for applications. Valid choices are `console`
for a console applicatiuon and `gui` for a Windows application.
`root`::
Normallly Boost Build will automatically be able to determine the root of
the Embarcadero C++ installation. It does this in various ways, but primarily
by checking a registry entry. If you specify the root it will use that
path, and the root you specify should be the full path to the Embarcadero
C++ installation on your machine ( without a trailing \ or / ). You should
not need to specify this option unless Boost Build can not find the
Embarcadero C++ root directory.
Examples::
using embarcadero ;
Configures the toolset to use the latest version, with bcc64 as the compiler.
The bcc64 compiler must be in the PATH.
using embarcadero : 7.40 ;
Configures the toolset to use the 7.40 version, with bcc64 as the compiler.
The bcc64 compiler must be in the PATH.
using embarcadero : 7.40 : bcc32x ;
using embarcadero : 7.40 : : <address-model>32 ;
Configures the toolset to use the 7.40 version, with bcc32x as the compiler.
The bcc32x compiler must be in the PATH.
using embarcadero : : c:/some_path/bcc64 ;
Configures the toolset to use the latest version, with full command specified.
using embarcadero : : full_command : <address-model>32 ;
Configures the toolset to use the latest version, with full command specified
and bcc32x as the compiler.
using embarcadero : : : <root>c:/root_path ;
Configures the toolset to use the latest version, with bcc64 as the compiler
and the root directory of the installation specified. The bcc64 compiler must
be in the PATH.
|# # end::doc[]
import clang-linux ;
import path ;
import os ;
import type ;
import common ;
import toolset ;
import feature ;
import toolset : flags ;
import clang ;
import gcc ;
import generators ;
import errors ;
feature.extend toolset : embarcadero ;
toolset.inherit-generators embarcadero : clang-linux ;
generators.override embarcadero.prebuilt : builtin.lib-generator ;
generators.override embarcadero.prebuilt : builtin.prebuilt ;
generators.override embarcadero.searched-lib-generator : searched-lib-generator ;
toolset.inherit-rules embarcadero : clang-linux ;
toolset.inherit-flags embarcadero
: clang-linux
: <runtime-link>shared
<link>shared
<threading>multi
<threading>multi/<target-os>windows
<stdlib>gnu
<stdlib>gnu11
<stdlib>libc++
<target-os>windows/<runtime-link>static
<target-os>windows/<runtime-link>shared
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] {
.debug-configuration = true ;
}
rule init ( version ? : command * : options * )
{
local compiler = bcc64 ;
local preprocessor = cpp64 ;
local amodel = 64 ;
local optam = [ feature.get-values <address-model> : $(options) ] ;
if $(optam)
{
if $(optam) = 32
{
compiler = bcc32x ;
preprocessor = cpp32x ;
amodel = 32 ;
}
else if ! ( $(optam) = 64 )
{
$(optam) = "" ;
}
}
command = [ common.get-invocation-command embarcadero : $(compiler) : $(command) ] ;
switch $(command[1]:BL)
{
case bcc32x :
compiler = bcc32x ;
preprocessor = cpp32x ;
amodel = 32 ;
case bcc64 :
compiler = bcc64 ;
preprocessor = cpp64 ;
amodel = 64 ;
case "bcc32x.exe" :
compiler = bcc32x ;
preprocessor = cpp32x ;
amodel = 32 ;
case "bcc64.exe" :
compiler = bcc64 ;
preprocessor = cpp64 ;
amodel = 64 ;
}
if $(optam) && $(optam) != $(amodel)
{
errors.user-error "embarcadero initialization: compiler and address model" :
"the compiler '$(compiler)' does not match the address-model of '$(optam)'" ;
}
else
{
# Determine the version
if $(command) {
local command-string = "$(command)" ;
command-string = $(command-string:J=" ") ;
local soutput = [ SHELL "$(command-string) --version" ] ;
version ?= [ MATCH "Embarcadero C[+][+] ([0-9.]+)" : $(soutput) ] ;
cl_version = [ MATCH ".+version[ ]+([0-9.]+)" : $(soutput) ] ;
if ! $(cl_version)
{
cl_version = 5.0 ;
}
}
local condition = [ common.check-init-parameters embarcadero : version $(version) ] ;
handle-options $(condition) : $(command) : $(options) ;
clang.init-cxxstd-flags embarcadero : $(condition) : $(cl_version) ;
# Support for the Embarcadero root directory. If the Embarcadero binary
# directory is not in the PATH we need to tell the underlying clang
# implementation where to find the Embarcadero header/library files
# and set the correct runtime path so that we can execute Embarcadero
# programs and find Embarcadero DLLs.
local root = [ feature.get-values <root> : $(options) ] ;
# 1) Look in registry
if ! $(root)
{
local sdkdir = [ get_sdk_dir ] ;
if $(sdkdir)
{
local bdsv = [ get_bds_version $(sdkdir) ] ;
if $(bdsv)
{
local has_dec = [ MATCH "(.+[.])" : $(bdsv) ] ;
local bdsv_full ;
if ! $(has_dec)
{
bdsv_full = $(bdsv).0 ;
}
local troot = [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv)" : RootDir ] ;
if $(troot)
{
troot = $(troot:T) ;
troot = [ concatenate $(troot) : name ] ;
root = $(troot:D) ;
}
else
{
troot = [ W32_GETREG "HKEY_CURRENT_USER\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv)" : RootDir ] ;
if $(troot)
{
troot = $(troot:T) ;
troot = [ concatenate $(troot) : name ] ;
root = $(troot:D) ;
}
else if $(bdsv_full)
{
troot = [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv_full)" : RootDir ] ;
if $(troot)
{
troot = $(troot:T) ;
troot = [ concatenate $(troot) : name ] ;
root = $(troot:D) ;
}
else
{
troot = [ W32_GETREG "HKEY_CURRENT_USER\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv_full)" : RootDir ] ;
if $(troot)
{
troot = $(troot:T) ;
troot = [ concatenate $(troot) : name ] ;
root = $(troot:D) ;
}
}
}
}
}
}
}
# 2) Look for path in the command
if ! $(root)
{
local cpath = $(command[1]:D) ;
if $(cpath)
{
root = $(cpath:P) ;
}
}
# 3) Search for the directory of the command
if ! $(root)
{
local pdirs = [ path.programs-path ] ;
for local dir in $(pdirs)
{
local match = [ MATCH "/(.:.+)" : $(dir) ] ;
if $(match)
{
dir = "$(match)" ;
}
if [ CHECK_IF_FILE $(dir)/$(command) ]
{
root = $(dir:P) ;
break ;
}
if [ CHECK_IF_FILE $(dir)/$(command).exe ]
{
root = $(dir:P) ;
break ;
}
}
}
if ! $(root)
{
errors.user-error "Embarcadero toolset initialization: the root directory for the Embarcadero installation can not be found" ;
}
else
{
local lib_path = $(root)/bin $(root)/bin64 $(root)/Bpl C:/Users/Public/Documents/Embarcadero ;
if $(.debug-configuration)
{
ECHO "notice:" using Embarcadero libraries with clang compilation"::" $(condition) "::" $(lib_path) ;
}
flags embarcadero.link RUN_PATH $(condition) : $(lib_path) ;
local system_include_option = "-isystem " ;
local system_include_directories = $(root)/include/windows/crtl $(root)/include/windows/sdk $(root)/include/windows/rtl $(root)/include/dinkumware64 ;
local lib_dir_release ;
local lib_dir_debug ;
local archiver ;
local arflags ;
local implib ;
if $(compiler) = bcc32x
{
lib_dir_release = $(root)/lib/win32c/release $(root)/lib/win32/release $(root)/lib/win32/release/psdk ;
lib_dir_debug = $(root)/lib/win32c/debug $(root)/lib/win32/debug $(root)/lib/win32/debug/psdk ;
archiver = tlib ;
arflags = /P512 ;
implib = implib ;
}
else if $(compiler) = bcc64
{
lib_dir_release = $(root)/lib/win64/release $(root)/lib/win64/release/psdk ;
lib_dir_debug = $(root)/lib/win64/debug $(root)/lib/win64/debug/psdk ;
archiver = tlib64 ;
arflags = /P2048 ;
implib = mkexp ;
}
flags embarcadero.compile OPTIONS $(condition) : $(system_include_option)$(system_include_directories) ;
flags embarcadero.link LINKPATH $(condition)/<variant>release : $(lib_dir_release) ;
flags embarcadero.link LINKPATH $(condition)/<variant>debug : $(lib_dir_debug) $(lib_dir_release) ;
flags embarcadero.archive .AR $(condition) : $(root)/bin/$(archiver) ;
flags embarcadero.archive .ARFLAGS $(condition) : $(arflags) ;
flags embarcadero.asm .TASM $(condition) : $(root)/bin/tasm32 ;
flags embarcadero.asm USER_OPTIONS $(condition) : [ feature.get-values <asmflags> : $(options) ] ;
flags embarcadero.archive AROPTIONS $(condition) : [ feature.get-values <archiveflags> : $(options) ] ;
flags embarcadero.link.dll .IMPLIB_COMMAND $(condition) : $(root)/bin/$(implib) ;
local mte = [ feature.get-values <user-interface> : $(options) ] ;
if $(mte)
{
flags embarcadero OPTIONS <main-target-type>EXE/$(condition) : <user-interface>$(mte) ;
}
else
{
flags embarcadero OPTIONS <main-target-type>EXE/$(condition) : <user-interface>console ;
}
}
}
}
local rule concatenate ( path : name )
{
local result ;
local has_ending_slash = [ MATCH ".*[/\\]$" : $(path) ] ;
local has_backward_slash = [ MATCH ".*[\\]" : $(path) ] ;
if $(has_ending_slash)
{
result = $(path)$(name) ;
}
else if $(has_backward_slash)
{
result = $(path)"\\"$(name) ;
}
else
{
result = $(path)"/"$(name) ;
}
return $(result) ;
}
local rule get_sdk_dir ( )
{
local ret ;
local appdata = [ os.environ APPDATA ] ;
if $(appdata)
{
ret = $(appdata:T)/Embarcadero/BDS ;
}
return $(ret) ;
}
local rule get_bds_version ( sdir )
{
local ret ;
local flist = [ GLOB $(sdir) : * ] ;
if $(flist)
{
local dirs ;
for local file in $(flist)
{
if ! [ CHECK_IF_FILE $(file) ]
{
dirs += $(file) ;
}
}
if $(dirs)
{
local ldir = $(dirs[-1]) ;
ret = $(ldir:B) ;
}
}
return $(ret) ;
}
local rule handle-options ( condition * : command * : options * )
{
if $(.debug-configuration)
{
ECHO "notice:" will use '$(command)' for embarcadero, condition
$(condition:E=(empty)) ;
}
toolset.flags embarcadero CONFIG_COMMAND $(condition) : $(command) ;
toolset.flags embarcadero.compile OPTIONS $(condition) :
[ feature.get-values <cflags> : $(options) ] ;
toolset.flags embarcadero.compile.c++ OPTIONS $(condition) :
[ feature.get-values <cxxflags> : $(options) ] ;
toolset.flags embarcadero.link OPTIONS $(condition) :
[ feature.get-values <linkflags> : $(options) ] ;
}
###############################################################################
# Declare generators
type.set-generated-target-suffix OBJ : <toolset>embarcadero <target-os>windows <address-model>64 : o ;
type.set-generated-target-suffix OBJ : <toolset>embarcadero <target-os>windows <address-model>32 : obj ;
type.set-generated-target-suffix STATIC_LIB : <toolset>embarcadero <target-os>windows <address-model>64 : a ;
type.set-generated-target-suffix STATIC_LIB : <toolset>embarcadero <target-os>windows <address-model>32 : lib ;
type.set-generated-target-suffix IMPORT_LIB : <toolset>embarcadero <target-os>windows <address-model>64 : a ;
type.set-generated-target-suffix IMPORT_LIB : <toolset>embarcadero <target-os>windows <address-model>32 : lib ;
generators.register-linker embarcadero.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>embarcadero ;
generators.register-linker embarcadero.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>embarcadero ;
generators.register-archiver embarcadero.archive : OBJ : STATIC_LIB : <toolset>embarcadero ;
generators.register-c-compiler embarcadero.compile.c++ : CPP : OBJ : <toolset>embarcadero ;
generators.register-c-compiler embarcadero.compile.c : C : OBJ : <toolset>embarcadero ;
generators.register-standard embarcadero.asm : ASM : OBJ : <toolset>embarcadero ;
# Flags
local opt_console = -tC ;
local opt_shared = -tD ;
local opt_mt = -tM ;
local opt_drtl = -tR ;
local opt_dapp = -tW ;
local opt_compile_flags = -DNDEBUG ;
local opt_lflags = "-lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192" ;
flags embarcadero OPTIONS <user-interface>console : $(opt_console) ;
flags embarcadero OPTIONS <user-interface>gui : $(opt_dapp) ;
flags embarcadero OPTIONS <runtime-link>shared : $(opt_drtl) ;
flags embarcadero OPTIONS <main-target-type>LIB/<link>shared : $(opt_shared) ;
flags embarcadero OPTIONS <threading>multi : $(opt_mt) ;
flags embarcadero.compile OPTIONS <variant>release : $(opt_compile_flags) ;
flags embarcadero.link OPTIONS : $(opt_lflags) ;
flags embarcadero.archive AROPTIONS <archiveflags> ;
flags embarcadero.asm USER_OPTIONS <asmflags> ;
flags embarcadero.compile OPTIONS <address-model>32 : -m32 ;
flags embarcadero.compile OPTIONS <address-model>64 : -m64 ;
flags embarcadero.link OPTIONS <address-model>32 : -m32 ;
flags embarcadero.link OPTIONS <address-model>64 : -m64 ;
rule compile.c++ ( targets * : sources * : properties * ) {
}
actions compile.c++ {
"$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
}
rule compile.c ( targets * : sources * : properties * )
{
}
actions compile.c
{
"$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
}
rule archive ( targets * : sources * : properties * )
{
}
actions updated together piecemeal archive
{
"$(.AR)" $(AROPTIONS) $(.ARFLAGS) /u /a /C "$(<)" +-"$(>)"
}
rule link ( targets * : sources * : properties * ) {
JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
}
rule link.dll ( targets * : sources * : properties * ) {
JAM_SEMAPHORE on $(targets) = <s>clang-linux-link-semaphore ;
}
actions link bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS)
}
actions link.dll bind LIBRARIES {
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<[1])" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS) && "$(.IMPLIB_COMMAND)" "$(<[2])" "$(<[1])"
}
rule asm ( targets * : sources * : properties * )
{
}
# /ml makes all symbol names case-sensitive
actions asm
{
$(.TASM) /ml $(USER_OPTIONS) "$(>)" "$(<)"
}