Add tests for clang-vxworks and some fixes. Fixes #278.

Squashed commit of the following:

commit a777fc2ed9c5ba9a204f4dfea46c4945ca291017
Author: Brian Kuhl <brian.kuhl@windriver.com>
Date:   Fri Jan 12 00:22:37 2018 -0500

    configure VxWorks/Dinkum STL to match <rtti>/<exception-handling>
This commit is contained in:
Steven Watanabe 2018-01-25 10:22:21 -07:00
parent eae02a51f5
commit b5605d6f4a
11 changed files with 128 additions and 25 deletions

View File

@ -31,8 +31,7 @@ generators.override clang-vxworks.searched-lib-generator : searched-lib-generato
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
: <inlining>full
<architecture>x86/<address-model>32
<architecture>x86/<address-model>64
;
@ -41,10 +40,6 @@ 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
@ -70,6 +65,10 @@ rule init ( version ? : command * : options * )
common.handle-options clang-vxworks : $(condition) : $(command) : $(options) ;
toolset.flags clang-vxworks.link .LD : $(linker) ;
# - Archive builder.
local archiver = [ feature.get-values <archiver> : $(options) ] ;
toolset.flags clang-vxworks.archive .AR $(condition) : $(archiver[1]) ;
}
SPACE = " " ;
@ -78,25 +77,9 @@ 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> ;

View File

@ -63,9 +63,10 @@ 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 ;
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.c++ DEFINES <exception-handling>off : _NO_EX=1 ;
flags diab.compile.c++ DEFINES <rtti>off : _NO_RTTI ;
flags diab.compile INCLUDES <include> ;
flags diab.link OPTIONS <linkflags> ;

View File

@ -628,6 +628,10 @@ toolset.flags gcc.compile OPTIONS <profiling>on : -pg ;
toolset.flags gcc.compile.c++ OPTIONS <rtti>off : -fno-rtti ;
toolset.flags gcc.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ;
# configure Dinkum STL to match compiler options
toolset.flags gcc.compile.c++ DEFINES <rtti>off/<target-os>vxworks : _NO_RTTI ;
toolset.flags gcc.compile.c++ DEFINES <exception-handling>off/<target-os>vxworks : _NO_EX=1 ;
###
### User free feature options.
###

View File

@ -50,8 +50,12 @@ def expand_properties(properties):
result += ["variant=debug"]
if not has_property("threading", properties):
result += ["threading=single"]
if not has_property("exception-handling", properties):
result += ["exception-handling=on"]
if not has_property("link", properties):
result += ["link=shared"]
if not has_property("rtti", properties):
result += ["rtti=on"]
if not has_property("runtime-link", properties):
result += ["runtime-link=shared"]
if not has_property("strip", properties):
@ -72,8 +76,12 @@ def compute_path(properties, target_type):
path += "/architecture-" + get_property("architecture", properties)
if "cxxstd=latest" in properties:
path += "/cxxstd-latest-iso"
if "exception-handling=off" in properties:
path += "/exception-handling-off"
if "link=static" in properties:
path += "/link-static"
if "rtti=off" in properties:
path += "/rtti-off"
if "runtime-link=static" in properties and target_type in ["exe"]:
path += "/runtime-link-static"
if "strip=on" in properties and target_type in ["dll", "exe", "obj2"]:

View File

@ -286,6 +286,7 @@ tests = ["absolute_sources",
"timedata",
"toolset_clang_darwin",
"toolset_clang_linux",
"toolset_clang_vxworks",
"toolset_darwin",
"toolset_gcc",
"toolset_intel_darwin",

View File

@ -29,6 +29,11 @@ using clang-linux : 3.9.0 : python $(here)/src/clang-linux-3.9.0.py
<ranlib>$(here)/src/bin/ranlib
;
using clang-vxworks : 4.0.1 : python $(here)/src/clang-vxworks-4.0.1.py
: <linker>$(here)/src/bin/ld
<archiver>$(here)/src/bin/ar
;
using intel-darwin : 10.2 : python $(here)/src/intel-darwin-10.2.py
: <archiver>$(here)/src/bin/ar
<ranlib>$(here)/src/bin/ranlib

View File

@ -14,6 +14,7 @@ path-constant .AR : ar.py ;
path-constant .RANLIB : ranlib.py ;
path-constant .LIBTOOL : libtool.py ;
path-constant .STRIP : strip.py ;
path-constant .LD : ld.py ;
rule c-escape ( str )
{
@ -27,12 +28,14 @@ rule cfg-header ( target : : properties * )
local RANLIB = [ c-escape $(.RANLIB) ] ;
local LIBTOOL = [ c-escape $(.LIBTOOL) ] ;
local STRIP = [ c-escape $(.STRIP) ] ;
local LD = [ c-escape $(.LD) ] ;
print.output $(target) ;
print.text "#define PYTHON_CMD "\"$(PYTHON)\" : true ;
print.text "#define AR_CMD "\"$(AR)\" : true ;
print.text "#define RANLIB_CMD "\"$(RANLIB)\" : true ;
print.text "#define LIBTOOL_CMD "\"$(LIBTOOL)\" : true ;
print.text "#define STRIP_CMD "\"$(STRIP)\" : true ;
print.text "#define LD_CMD "\"$(LD)\" : true ;
}
# We can only build one variant at a time and we need to have a fixed path
@ -55,3 +58,4 @@ exe ar : [ obj ar.obj : mock-program.cpp : <define>PY_SCRIPT=AR_CMD ] ;
exe ranlib : [ obj ranlib.obj : mock-program.cpp : <define>PY_SCRIPT=RANLIB_CMD ] ;
exe libtool : [ obj libtool.obj : mock-program.cpp : <define>PY_SCRIPT=LIBTOOL_CMD ] ;
exe strip : [ obj strip.obj : mock-program.cpp : <define>PY_SCRIPT=STRIP_CMD ] ;
exe ld : [ obj ld.obj : mock-program.cpp : <define>PY_SCRIPT=LD_CMD ] ;

View File

@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright 2017 Steven Watanabe
# Copyright 2017-2018 Steven Watanabe
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
@ -18,5 +18,7 @@ command('ar', 'rc', output_file('bin/intel-darwin-10.2/debug/link-static/target-
command('ar', 'rc', output_file('bin/intel-darwin-10.2/debug/link-static/runtime-link-static/target-os-darwin/libl1.a'), input_file('bin/intel-darwin-10.2/debug/link-static/runtime-link-static/target-os-darwin/lib.o'))
command('ar', 'rc', output_file('bin/clang-linux-3.9.0/debug/link-static/libl1.a'), input_file('bin/clang-linux-3.9.0/debug/link-static/lib.o'))
command('ar', 'rc', output_file('bin/clang-linux-3.9.0/debug/link-static/runtime-link-static/libl1.a'), input_file('bin/clang-linux-3.9.0/debug/link-static/runtime-link-static/lib.o'))
command('ar', 'rcu', output_file('bin/clang-vxworks-4.0.1/debug/link-static/libl1.a'), input_file('bin/clang-vxworks-4.0.1/debug/link-static/lib.o'))
command('ar', 'rcu', output_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/libl1.a'), input_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/lib.o'))
main()

View File

@ -0,0 +1,42 @@
#!/usr/bin/python
#
# Copyright 2018 Steven Watanabe
#
# 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)
from MockProgram import *
command('clang++', '-print-prog-name=ar', stdout=script('ar.py'))
command('clang++', '-print-prog-name=ranlib', stdout=script('ranlib.py'))
if allow_properties('variant=debug', 'link=shared', 'threading=single', 'runtime-link=shared'):
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-fPIC', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-fPIC', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/main.o'), input_file(source='main.cpp'))
if allow_properties('variant=release', 'link=shared', 'threading=single', 'runtime-link=shared', 'strip=on'):
command('clang++', unordered(ordered('-x', 'c++'), '-O3', '-Wno-inline', '-Wall', '-fPIC', '-DNDEBUG', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/release/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O3', '-Wno-inline', '-Wall', '-fPIC', '-DNDEBUG', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/release/main.o'), input_file(source='main.cpp'))
if allow_properties('variant=debug', 'link=shared', 'threading=multi', 'runtime-link=shared'):
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-fPIC', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/threading-multi/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-fPIC', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/threading-multi/main.o'), input_file(source='main.cpp'))
if allow_properties('variant=debug', 'link=static', 'threading=single', 'runtime-link=shared'):
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/link-static/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/link-static/main.o'), input_file(source='main.cpp'))
if allow_properties('variant=debug', 'link=static', 'threading=single', 'runtime-link=static'):
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/main.o'), input_file(source='main.cpp'))
if allow_properties('variant=debug', 'link=shared', 'threading=single', 'runtime-link=shared', 'architecture=x86', 'address-model=32'):
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-march=i686', '-m32', '-fPIC', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-Wall', '-g', '-march=i686', '-m32', '-fPIC', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/main.o'), input_file(source='main.cpp'))
if allow_properties('variant=debug', 'link=shared', 'threading=single', 'runtime-link=shared', 'rtti=off', 'exception-handling=off'):
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-fno-rtti', '-fno-exceptions', '-Wall', '-g', '-fPIC', '-D_NO_RTTI', '-D_NO_EX=1', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/lib.o'), input_file(source='lib.cpp'))
command('clang++', unordered(ordered('-x', 'c++'), '-O0', '-fno-inline', '-fno-rtti', '-fno-exceptions', '-Wall', '-g', '-fPIC', '-D_NO_RTTI', '-D_NO_EX=1', '-c'), '-o', output_file('bin/clang-vxworks-4.0.1/debug/main.o'), input_file(source='main.cpp'))
main()

View File

@ -0,0 +1,33 @@
#!/usr/bin/python
#
# Copyright 2018 Steven Watanabe
#
# 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)
from MockProgram import *
if allow_properties('variant=debug', 'link=shared', 'threading=single', 'runtime-link=shared'):
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/libl1.so'), input_file('bin/clang-vxworks-4.0.1/debug/lib.o'), unordered('-g', '-fPIC'), '-fpic', '-shared', '-non-static')
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/test'), input_file('bin/clang-vxworks-4.0.1/debug/main.o'), input_file('bin/clang-vxworks-4.0.1/debug/libl1.so'), unordered('-g', '-fPIC'))
if allow_properties('variant=release', 'link=shared', 'threading=single', 'runtime-link=shared', 'strip=on'):
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/release/libl1.so'), input_file('bin/clang-vxworks-4.0.1/release/lib.o'), unordered('-fPIC', '-Wl,--strip-all'), '-fpic', '-shared', '-non-static')
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/release/test'), input_file('bin/clang-vxworks-4.0.1/release/main.o'), input_file('bin/clang-vxworks-4.0.1/release/libl1.so'), unordered('-fPIC', '-Wl,--strip-all'))
if allow_properties('variant=debug', 'link=shared', 'threading=multi', 'runtime-link=shared'):
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/threading-multi/libl1.so'), input_file('bin/clang-vxworks-4.0.1/debug/threading-multi/lib.o'), unordered('-g', '-fPIC'), '-fpic', '-shared', '-non-static')
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/threading-multi/test'), input_file('bin/clang-vxworks-4.0.1/debug/threading-multi/main.o'), input_file('bin/clang-vxworks-4.0.1/debug/threading-multi/libl1.so'), unordered('-g', '-fPIC'))
if allow_properties('variant=debug', 'link=static', 'threading=single', 'runtime-link=shared'):
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/link-static/test'), input_file('bin/clang-vxworks-4.0.1/debug/link-static/main.o'), input_file('bin/clang-vxworks-4.0.1/debug/link-static/libl1.a'), '-g')
if allow_properties('variant=debug', 'link=static', 'threading=single', 'runtime-link=static'):
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/test'), input_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/main.o'), input_file('bin/clang-vxworks-4.0.1/debug/link-static/runtime-link-static/libl1.a'), unordered('-g'))
if allow_properties('variant=debug', 'link=shared', 'threading=single', 'runtime-link=shared', 'architecture=x86', 'address-model=32'):
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/libl1.so'), input_file('bin/clang-vxworks-4.0.1/debug/lib.o'), unordered('-g', '-march=i686', '-fPIC', '-m32'), '-fpic', '-shared', '-non-static')
command('ld', '-o', output_file('bin/clang-vxworks-4.0.1/debug/test'), input_file('bin/clang-vxworks-4.0.1/debug/main.o'), input_file('bin/clang-vxworks-4.0.1/debug/libl1.so'), unordered('-g', '-march=i686', '-fPIC', '-m32'))
main()

View File

@ -0,0 +1,20 @@
#!/usr/bin/python
#
# Copyright 2018 Steven Watanabe
#
# 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)
# validates the clang_vxworks toolset using a mock of clang
from TestToolset import test_toolset
test_toolset("clang-vxworks", "4.0.1", [
["target-os=vxworks"],
["target-os=vxworks", "release", "strip=on"],
["target-os=vxworks", "threading=multi"],
["target-os=vxworks", "link=static"],
["target-os=vxworks", "link=static", "runtime-link=static"],
["target-os=vxworks", "architecture=x86", "address-model=32"],
["target-os=vxworks", "rtti=off", "exception-handling=off"]])