2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-18 01:52:17 +00:00

Merge pull request #228 from kuhlenough/develop

VxWorks support for b2
This commit is contained in:
Rene Rivera
2017-09-02 10:30:20 -05:00
committed by GitHub
7 changed files with 515 additions and 6 deletions

151
src/tools/clang-vxworks.jam Normal file
View File

@@ -0,0 +1,151 @@
# Copyright Brian Kuhl 2017.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
import clang ;
import feature : feature get-values ;
import os ;
import toolset ;
import toolset : flags ;
import gcc ;
import common ;
import errors ;
import generators ;
feature.extend-subfeature toolset clang : platform : vxworks ;
toolset.inherit-generators clang-vxworks
<toolset>clang <toolset-clang:platform>vxworks
: gcc
# Don't inherit PCH generators. They were not tested, and probably
# don't work for this compiler.
: gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch
;
generators.override clang-vxworks.prebuilt : builtin.lib-generator ;
generators.override clang-vxworks.prebuilt : builtin.prebuilt ;
generators.override clang-vxworks.searched-lib-generator : searched-lib-generator ;
toolset.inherit-rules clang-vxworks : gcc ;
toolset.inherit-flags clang-vxworks : gcc
: <inlining>off <inlining>on <inlining>full <optimization>space
<warnings>off <warnings>all <warnings>on
<architecture>x86/<address-model>32
<architecture>x86/<address-model>64
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
# vectorization diagnostics
feature vectorize : off on full ;
# Initializes the clang-vxworks toolset
# version in optional
# compile and link options allow you to specify addition command line options for each version
rule init ( version ? : command * : options * )
{
command = [ common.get-invocation-command clang-vxworks : ccllvm
: $(command) ] ;
linker = [ get-values <linker> : $(options) ] ;
linker ?= ld ;
# Determine the version
local command-string = $(command:J=" ") ;
if $(command)
{
version ?= [ MATCH "^([0-9.]+)"
: [ SHELL "$(command-string) -dumpversion" ] ] ;
}
local condition = [ common.check-init-parameters clang-vxworks
: version $(version) ] ;
common.handle-options clang-vxworks : $(condition) : $(command) : $(options) ;
gcc.init-link-flags clang-vxworks vxworks $(condition) ;
toolset.flags clang-vxworks.link .LD : $(linker) ;
}
SPACE = " " ;
toolset.flags clang-vxworks.compile OPTIONS <cflags> ;
toolset.flags clang-vxworks.compile.c++ OPTIONS <cxxflags> ;
toolset.flags clang-vxworks.compile INCLUDES <include> ;
# Declare flags and action for compilation.
toolset.flags clang-vxworks.compile OPTIONS <optimization>off : -O0 ;
toolset.flags clang-vxworks.compile OPTIONS <optimization>speed : -O3 ;
toolset.flags clang-vxworks.compile OPTIONS <optimization>space : -Os ;
# For clang, 'on' and 'full' are identical
toolset.flags clang-vxworks.compile OPTIONS <inlining>off : -fno-inline ;
toolset.flags clang-vxworks.compile OPTIONS <inlining>on : -Wno-inline ;
toolset.flags clang-vxworks.compile OPTIONS <inlining>full : -Wno-inline ;
toolset.flags clang-vxworks.compile OPTIONS <warnings>off : -w ;
toolset.flags clang-vxworks.compile OPTIONS <warnings>on : -Wall ;
toolset.flags clang-vxworks.compile OPTIONS <warnings>all : -Wall -pedantic ;
toolset.flags clang-vxworks.compile OPTIONS <warnings-as-errors>on : -Werror ;
toolset.flags clang-vxworks.compile OPTIONS <debug-symbols>on : -g ;
toolset.flags clang-vxworks.compile OPTIONS <profiling>on : -pg ;
toolset.flags clang-vxworks.compile OPTIONS <rtti>off : -fno-rtti ;
toolset.flags clang-vxworks.compile OPTIONS <flags> ;
actions compile.c
{
"$(CONFIG_COMMAND)" -x c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
actions compile.c++
{
"$(CONFIG_COMMAND)" -x c++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
flags clang-vxworks ARFLAGS <archiveflags> ;
# Default value. Mostly for the sake of clang-linux
# that inherits from gcc, but does not has the same
# logic to set the .AR variable. We can put the same
# logic in clang-linux, but that's hardly worth the trouble
# as on Linux, 'ar' is always available.
.AR = ar ;
actions piecemeal archive
{
"$(.AR)" $(AROPTIONS) rcu "$(<)" "$(>)"
}
flags clang-vxworks.link USER_OPTIONS <linkflags> ;
# Declare actions for linking
rule link ( targets * : sources * : properties * )
{
SPACE on $(targets) = " " ;
# Serialize execution of the 'link' action, since
# running N links in parallel is just slower.
JAM_SEMAPHORE on $(targets) = <s>clang-vxworks-link-semaphore ;
}
actions link bind LIBRARIES
{
"$(.LD)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS)
}
actions link.dll bind LIBRARIES
{
"$(.LD)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" $(START-GROUP) $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) -fpic -shared -non-static
}

130
src/tools/diab.jam Normal file
View File

@@ -0,0 +1,130 @@
# Copyright 2015, Wind River Inc.
# 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)
#
# Diab C++ Compiler
#
import feature generators common ;
import toolset : flags ;
import os ;
feature.extend toolset : diab ;
# Inherit from Unix toolset to get library ordering magic.
toolset.inherit diab : unix ;
generators.override diab.prebuilt : builtin.lib-generator ;
generators.override diab.prebuilt : builtin.prebuilt ;
generators.override diab.searched-lib-generator : searched-lib-generator ;
rule init ( version ? : command * : options * )
{
local condition = [ common.check-init-parameters diab : version $(version) ] ;
local command = [ common.get-invocation-command diab : dcc : $(command) ] ;
if $(command)
{
local root = [ common.get-absolute-tool-path $(command[-1]) ] ;
if $(root)
{
flags diab .root <host-os>linux : "\"$(root)\"/" ;
flags diab .root <host-os>windows : $(root:T)/ ;
}
}
# If we can't find 'CC' anyway, at least show 'CC' in the commands
command ?= CC ;
common.handle-options diab : $(condition) : $(command) : $(options) ;
}
generators.register-c-compiler diab.compile.c++ : CPP : OBJ : <toolset>diab ;
generators.register-c-compiler diab.compile.c : C : OBJ : <toolset>diab ;
# unlike most compliers, Diab defaults to static linking.
# flags cxx LINKFLAGS <runtime-link>static : ;
flags diab.compile OPTIONS <debug-symbols>on : -g ;
flags diab.link OPTIONS <debug-symbols>on : -g ;
flags diab.compile OPTIONS <optimization>off : ;
flags diab.compile OPTIONS <optimization>speed : -speed ;
flags diab.compile OPTIONS <optimization>space : -size ;
# flags diab.compile OPTIONS <inlining>off : -Xinline=0 ;
# flags diab.compile OPTIONS <inlining>on : -Xinline=10 ;
# flags diab.compile OPTIONS <inlining>full : -Xinline=50 ;
flags diab.compile OPTIONS <cflags> ;
flags diab.compile.c++ OPTIONS <cxxflags> ;
flags diab.compile DEFINES <define> ;
flags diab.compile.c++ OPTIONS <exception-handling>off : -Xno-exceptions ;
# So Dinkum STL knows when exceptions are disabled
flags diab.compile DEFINES <exception-handling>off : _NO_EX=1 ;
flags diab.compile INCLUDES <include> ;
flags diab.link OPTIONS <linkflags> ;
flags diab.compile OPTIONS <link>shared : -Xpic ;
#flags diab.compile OPTIONS <link>static : ;
# get VxWorks link options from shell enviorment
flags diab.link OPTIONS <link>static : [ os.environ LDFLAGS_STATIC ] ;
flags diab.link.dll OPTIONS : [ os.environ LDFLAGS_SO ] ;
flags diab.link OPTIONS <link>shared : [ os.environ LDFLAGS_DYNAMIC ] ;
flags diab.link LOPTIONS <link>shared : -Xdynamic -Xshared -Xpic ;
flags diab.link LIBPATH <library-path> ;
flags diab.link LIBRARIES <library-file> ;
flags diab.link FINDLIBS-ST <find-static-library> ;
flags diab.link FINDLIBS-SA <find-shared-library> ;
actions link bind LIBRARIES
{
$(CONFIG_COMMAND) $(OPTIONS) $(LOPTIONS) -o "$(<)" -L$(LIBPATH) "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA)
}
# When creating dynamic libraries, we don't want to be warned about unresolved
# symbols, therefore all unresolved symbols are marked as expected by
# '-expect_unresolved *'. This also mirrors the behaviour of the GNU tool
# chain.
actions link.dll bind LIBRARIES
{
$(.root:E=)dplus $(OPTIONS) $(LOPTIONS) "$(LIBRARIES)" -o "$(<[1])" -L$(LIBPATH) "$(>)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA)
}
#rule compile.asm ( targets * : sources * : properties * )
#{
# setup-fpic $(targets) : $(sources) : $(properties) ;
# setup-address-model $(targets) : $(sources) : $(properties) ;
#}
actions compile.asm
{
"$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
actions compile.c
{
$(.root:E=)dcc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
}
actions compile.c++
{
$(.root:E=)dplus -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
}
# Always create archive from scratch. See the gcc toolet for rationale.
RM = [ common.rm-command ] ;
actions together piecemeal archive
{
$(RM) "$(<)"
dar rc $(<) $(>)
}

View File

@@ -11,7 +11,7 @@ import os ;
.os-names =
aix android appletv bsd cygwin darwin freebsd haiku hpux iphone linux
netbsd openbsd osf qnx qnxnto sgi solaris unix unixware windows vms
netbsd openbsd osf qnx qnxnto sgi solaris unix unixware windows vms vxworks
# Not actually an OS -- used for targeting bare metal where object
# format is ELF. This catches both -elf and -eabi gcc targets as well

View File

@@ -167,6 +167,11 @@ rule init ( version ? : command * : options * : requirement * )
local bin ;
# The compiler flavor.
local flavor = [ feature.get-values <flavor> : $(options) ] ;
# vxworks build on windows uses csh that is neither mingw or cygwin
if [ feature.get-values <target-os> : $(options) ] = vxworks
{
flavor ?= vxworks ;
}
# Autodetect the root and bin dir if not given.
if $(command)
{
@@ -278,7 +283,8 @@ rule .get-prog-name ( command-string : tool : flavor ? )
{
local prog-name = [ NORMALIZE_PATH [ MATCH "(.*)[\n]+" :
[ SHELL "$(command-string) -print-prog-name=$(tool)" ] ] ] ;
if $(flavor) != mingw && [ os.name ] = NT
if !($(flavor) = vxworks || $(flavor) = mingw) && [ os.name ] = NT
{
prog-name = [ cygwin.cygwin-to-windows-path $(prog-name) ] ;
}
@@ -400,6 +406,7 @@ rule set-threading-options ( targets * : sources * : properties * )
case *bsd : option ?= -pthread ; # There is no -lrt on BSD.
case sgi : # gcc on IRIX does not support multi-threading.
case darwin : # No threading options.
case vxworks : # No threading options.
case * : option ?= -pthread ; libs = rt ;
}
if $(option)
@@ -1015,6 +1022,14 @@ rule set-link-options ( action-name targets + : sources * : properties * )
OPTIONS on $(targets) += -static ;
}
case vxworks :
# On VxWorks we want to reflect what ever special flags have been set in the
# environment for the CPU we are targeting in the cross build
toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on : -Wl,--strip-all : unchecked ;
toolset.flags $(toolset).link OPTIONS $(condition)/<link>static : [ os.environ LDFLAGS_STATIC ] : unchecked ;
toolset.flags $(toolset).link.dll OPTIONS $(condition) : [ os.environ LDFLAGS_SO ] : unchecked ;
toolset.flags $(toolset).link OPTIONS $(condition)/<link>shared : [ os.environ LDFLAGS_DYNAMIC ] : unchecked ;
case gnu :
# Strip the binary when no debugging is needed. We use --strip-all flag

185
src/tools/intel-vxworks.jam Normal file
View File

@@ -0,0 +1,185 @@
# Copyright Wind River 2017.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
import intel ;
import feature : feature ;
import os ;
import toolset ;
import toolset : flags ;
import gcc ;
import common ;
import errors ;
import generators ;
feature.extend-subfeature toolset intel : platform : vxworks ;
toolset.inherit-generators intel-vxworks
<toolset>intel <toolset-intel:platform>vxworks
: gcc
# Don't inherit PCH generators. They were not tested, and probably
# don't work for this compiler.
: gcc.mingw.link gcc.mingw.link.dll gcc.compile.c.pch gcc.compile.c++.pch
;
generators.override intel-vxworks.prebuilt : builtin.lib-generator ;
generators.override intel-vxworks.prebuilt : builtin.prebuilt ;
generators.override intel-vxworks.searched-lib-generator : searched-lib-generator ;
toolset.inherit-rules intel-vxworks : gcc ;
toolset.inherit-flags intel-vxworks : gcc
: <inlining>off <inlining>on <inlining>full <optimization>space
<warnings>off <warnings>all <warnings>on
<architecture>x86/<address-model>32
<architecture>x86/<address-model>64
;
if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}
# Initializes the intel-vxworks toolset
# version in mandatory
# name (default icc) is used to invoke the specified intel complier
# compile and link options allow you to specify addition command line options for each version
rule init ( version ? : command * : options * )
{
local condition = [ common.check-init-parameters intel-vxworks
: version $(version) ] ;
command = [ common.get-invocation-command intel-vxworks : icc
: $(command) : /opt/intel_cc_80/bin ] ;
common.handle-options intel-vxworks : $(condition) : $(command) : $(options) ;
gcc.init-link-flags intel-vxworks vxworks $(condition) ;
# handle <library-path>
# local library-path = [ feature.get-values <library-path> : $(options) ] ;
# flags intel-vxworks.link USER_OPTIONS $(condition) : [ feature.get-values <dll-path> : $(options) ] ;
local root = [ feature.get-values <root> : $(options) ] ;
local bin ;
if $(command) || $(root)
{
bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
root ?= $(bin:D) ;
if $(root)
{
# Libraries required to run the executable may be in either
# $(root)/lib (10.1 and earlier)
# or
# $(root)/lib/architecture-name (11.0 and later:
local lib_path = $(root)/lib $(root:P)/lib/$(bin:B) ;
if $(.debug-configuration)
{
ECHO notice: using intel libraries :: $(condition) :: $(lib_path) ;
}
flags intel-vxworks.link RUN_PATH $(condition) : $(lib_path) ;
}
}
local m = [ MATCH (..).* : $(version) ] ;
local n = [ MATCH (.)\\. : $(m) ] ;
if $(n) {
m = $(n) ;
}
local major = $(m) ;
flags intel-vxworks.compile OPTIONS $(condition)/<inlining>off : -inline-level=0 ;
flags intel-vxworks.compile OPTIONS $(condition)/<inlining>on : -inline-level=1 ;
flags intel-vxworks.compile OPTIONS $(condition)/<inlining>full : -inline-level=2 ;
flags intel-vxworks.link OPTIONS $(condition)/<runtime-link>static : [ os.environ LDFLAGS_STATIC ] ;
flags intel-vxworks.link OPTIONS $(condition)/<runtime-link>shared : [ os.environ LDFLAGS_DYNAMIC ] ;
flags intel-vxworks.compile OPTIONS $(condition)/<link>shared : -fPIC ;
local minor = [ MATCH ".*\\.(.).*" : $(version) ] ;
}
SPACE = " " ;
flags intel-vxworks.compile OPTIONS <cflags> ;
flags intel-vxworks.compile.c++ OPTIONS <cxxflags> ;
flags intel-vxworks.compile INCLUDES <include> ;
.cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i
conroe conroe-xe conroe-l allendale merom
merom-xe kentsfield kentsfield-xe penryn wolfdale
yorksfield nehalem sandy-bridge ivy-bridge haswell ;
.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3
athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ;
.cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ;
#flags intel-vxworks.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>32 : -m32 ; # -mcmodel=small ;
#flags intel-vxworks.compile OPTIONS <instruction-set>$(.cpu-type-x86-64)/<address-model>64 : -m64 ; # -mcmodel=large ;
flags intel-vxworks.compile.c OPTIONS <warnings>off : -w0 ;
flags intel-vxworks.compile.c OPTIONS <warnings>on : -w1 ;
flags intel-vxworks.compile.c OPTIONS <warnings>all : -w2 ;
flags intel-vxworks.compile.c++ OPTIONS <warnings>off : -w0 ;
flags intel-vxworks.compile.c++ OPTIONS <warnings>on : -w1 ;
flags intel-vxworks.compile.c++ OPTIONS <warnings>all : -w2 ;
actions compile.c
{
"$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
actions compile.c++
{
"$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}
flags intel-vxworks ARFLAGS <archiveflags> ;
.AR = ar ;
rule archive ( targets * : sources * : properties * )
{
# Always remove archive and start again.
# of the archive.
#
local clean.a = $(targets[1])(clean) ;
TEMPORARY $(clean.a) ;
NOCARE $(clean.a) ;
LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
DEPENDS $(clean.a) : $(sources) ;
DEPENDS $(targets) : $(clean.a) ;
common.RmTemps $(clean.a) : $(targets) ;
}
actions piecemeal archive
{
"$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
}
flags intel-vxworks.link USER_OPTIONS <linkflags> ;
# Declare actions for linking
rule link ( targets * : sources * : properties * )
{
SPACE on $(targets) = " " ;
# Serialize execution of the 'link' action, since
# running N links in parallel is just slower.
JAM_SEMAPHORE on $(targets) = <s>intel-vxworks-link-semaphore ;
}
actions link bind LIBRARIES
{
"$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS)
}
actions link.dll bind LIBRARIES
{
"$(CONFIG_COMMAND)" $(USER_OPTIONS) -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS)
}

View File

@@ -410,9 +410,13 @@ rule run-path-setup ( target : source : properties * )
# test are found. So, we collect all paths from dependency libraries (via
# xdll-path property) and add whatever explicit dll-path user has specified.
# The resulting paths are added to the environment on each test invocation.
local target-os = [ feature.get-values <target-os> : $(properties) ] ;
local dll-paths = [ feature.get-values <dll-path> : $(properties) ] ;
dll-paths += [ feature.get-values <xdll-path> : $(properties) ] ;
dll-paths += [ on $(source) return $(RUN_PATH) ] ;
if $(target-os) != vxworks
{
dll-paths += [ on $(source) return $(RUN_PATH) ] ;
}
dll-paths = [ sequence.unique $(dll-paths) ] ;
if $(dll-paths)
{
@@ -421,9 +425,28 @@ rule run-path-setup ( target : source : properties * )
{
translate-to-os = path.to-VMS ;
}
dll-paths = [ sequence.transform $(translate-to-os) : $(dll-paths) ] ;
PATH_SETUP on $(target) = [ common.prepend-path-variable-command
[ os.shared-library-path-variable ] : $(dll-paths) ] ;
if $(target-os) = vxworks
{
# map <build-os> paths to <target-os> paths
local save-os = [ modules.peek os : .name ] ;
modules.poke os : .name : VXWORKS ;
local parent = [ os.environ PKG_SRC_BUILD_DIR ] ;
local prefix = [ os.environ LAYER_SRC_PATH ] ;
local target-dll-paths ;
for local e in $(dll-paths)
{
target-dll-paths += [ path.join $(prefix) [ path.relative $(e) $(parent) : noerror ] ] ;
}
PATH_SETUP on $(target) = [ common.prepend-path-variable-command
[ os.shared-library-path-variable ] : $(target-dll-paths) ] ;
modules.poke os : .name : $(save-os) ;
}
else
{
dll-paths = [ sequence.transform $(translate-to-os) : $(dll-paths) ] ;
PATH_SETUP on $(target) = [ common.prepend-path-variable-command
[ os.shared-library-path-variable ] : $(dll-paths) ] ;
}
}
}

View File

@@ -65,6 +65,7 @@ if $(.name) = NT
# constant whose value would be the same as the default, below.
.shared-library-path-variable-NT = $(.executable-path-variable-NT) ;
.path-separator-NT = ";" ;
.path-separator-VXWORKS = ";" ;
.expand-variable-prefix-NT = % ;
.expand-variable-suffix-NT = % ;
.executable-suffix-NT = .exe ;
@@ -83,6 +84,10 @@ if $(.name) = NT
.expand-variable-suffix-VMS = ' ;
.executable-suffix-VMS = .exe ;
# VxWorks uses the default LD_LIBRARY_PATH, but we need an alternate
# name on the cross build host to propigate to the target system
.shared-library-path-variable-VXWORKS = VSB_LD_LIBRARY_PATH ;
# Default constants
.shared-library-path-variable = LD_LIBRARY_PATH ;
.path-separator = ":" ;