Travis testing c++11 and gcc5

Modify testflags.py to control the -std= option passed to gcc
Install new boost for c++11 with gcc5 testing
This commit is contained in:
William S Fulton 2015-07-10 21:54:59 +01:00
commit f815209c7d
2 changed files with 31 additions and 12 deletions

View file

@ -92,9 +92,10 @@ before_install:
- uname -a
- lsb_release -a
- sudo apt-get -qq update
- time sudo apt-get -qq install libboost-dev
- if test -z "$SWIGLANG"; then sudo apt-get -qq install yodl; fi
- if test -n "$GCC5"; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && sudo apt-get -qq update && sudo apt-get install -qq g++-5 && export CC=gcc-5 && export CXX=g++-5; fi
- if test -z "$GCC5"; then sudo apt-get -qq install libboost-dev; fi
- if test -n "$GCC5"; then sudo add-apt-repository -y ppa:boost-latest/ppa && sudo apt-get -qq update && sudo apt-get install -qq libboost1.55-dev; fi
- if test -z "$SWIGLANG"; then sudo apt-get -qq install yodl; fi
- if test "$SWIGLANG" = "csharp"; then sudo apt-get -qq install mono-devel; fi
- if test "$SWIGLANG" = "d"; then wget http://downloads.dlang.org/releases/2014/dmd_2.066.0-0_amd64.deb; sudo dpkg -i dmd_2.066.0-0_amd64.deb; fi
- if test "$SWIGLANG" = "go"; then go env | sed -e 's/^/export /' > goenvsetup && source goenvsetup && rm -f goenvsetup; fi # Until configure.ac is fixed
@ -119,8 +120,8 @@ before_install:
- $CC --version
- $CXX --version
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
- export cflags=$(Tools/testflags.py --language $SWIGLANG --cflags) && echo $cflags
- export cxxflags=$(Tools/testflags.py --language $SWIGLANG --cxxflags) && echo $cxxflags
- if test -n "$SWIGLANG"; then export cflags=$(Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD) && echo $cflags; fi
- if test -n "$SWIGLANG"; then export cxxflags=$(Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD) && echo $cxxflags; fi
script:
- echo 'Configuring...' && echo -en 'travis_fold:start:script.1\\r'
- echo "${CONFIGOPTS[@]}"

View file

@ -1,6 +1,10 @@
#!/usr/bin/env python
c_common = "-fdiagnostics-show-option -std=gnu89 -Wno-long-long -Wreturn-type -Wdeclaration-after-statement"
cflags = {
def get_cflags(language, std):
if std == None or len(std) == 0:
std = "gnu89"
c_common = "-fdiagnostics-show-option -std=" + std + " -Wno-long-long -Wreturn-type -Wdeclaration-after-statement"
cflags = {
"csharp":"-Werror " + c_common,
"d":"-Werror " + c_common,
"go":"-Werror " + c_common,
@ -15,10 +19,18 @@ cflags = {
"ruby":"-Werror " + c_common,
"scilab":"-Werror " + c_common,
"tcl":"-Werror " + c_common,
}
}
cxx_common = "-fdiagnostics-show-option -std=c++98 -Wno-long-long -Wreturn-type"
cxxflags = {
if language not in cflags:
raise RuntimeError("{} is not a supported language".format(language))
return cflags[language]
def get_cxxflags(language, std):
if std == None or len(std) == 0:
std = "c++98"
cxx_common = "-fdiagnostics-show-option -std=" + std + " -Wno-long-long -Wreturn-type"
cxxflags = {
"csharp":"-Werror " + cxx_common,
"d":"-Werror " + cxx_common,
"go":"-Werror " + cxx_common,
@ -33,7 +45,12 @@ cxxflags = {
"ruby":"-Werror " + cxx_common,
"scilab": cxx_common,
"tcl":"-Werror " + cxx_common,
}
}
if language not in cxxflags:
raise RuntimeError("{} is not a supported language".format(language))
return cxxflags[language]
import argparse
parser = argparse.ArgumentParser(description="Display CFLAGS or CXXFLAGS to use for testing the SWIG examples and test-suite.")
@ -41,12 +58,13 @@ parser.add_argument('-l', '--language', required=True, help='set language to sho
flags = parser.add_mutually_exclusive_group(required=True)
flags.add_argument('-c', '--cflags', action='store_true', default=False, help='show CFLAGS')
flags.add_argument('-x', '--cxxflags', action='store_true', default=False, help='show CXXFLAGS')
parser.add_argument('-s', '--std', required=False, help='language standard flags for the -std= option')
args = parser.parse_args()
if args.cflags:
print("{}".format(cflags[args.language]))
print("{}".format(get_cflags(args.language, args.std)))
elif args.cxxflags:
print("{}".format(cxxflags[args.language]))
print("{}".format(get_cxxflags(args.language, args.std)))
else:
parser.print_help()
exit(1)