Integrate OS X .travis.yml into master branch using multi-os feature.

http://docs.travis-ci.com/user/multi-os/

Expand testflags.py to support clang vs gcc, as clang is used on OS X.
This commit is contained in:
Alexey Sokolov 2015-08-29 11:59:30 +01:00
commit 9155ff0fbb
4 changed files with 227 additions and 33 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
def get_cflags(language, std):
def get_cflags(language, std, compiler):
if std == None or len(std) == 0:
std = "gnu89"
c_common = "-fdiagnostics-show-option -std=" + std + " -Wno-long-long -Wreturn-type -Wdeclaration-after-statement"
@ -20,13 +20,15 @@ def get_cflags(language, std):
"scilab":"-Werror " + c_common,
"tcl":"-Werror " + c_common,
}
if compiler == 'clang':
cflags["guile"] += " -Wno-attributes" # -Wno-attributes is for clang LLVM 3.5 and bdw-gc < 7.5 used by guile
if language not in cflags:
raise RuntimeError("{} is not a supported language".format(language))
return cflags[language]
def get_cxxflags(language, std):
def get_cxxflags(language, std, compiler):
if std == None or len(std) == 0:
std = "c++98"
cxx_common = "-fdiagnostics-show-option -std=" + std + " -Wno-long-long -Wreturn-type"
@ -46,6 +48,8 @@ def get_cxxflags(language, std):
"scilab": cxx_common,
"tcl":"-Werror " + cxx_common,
}
if compiler == 'clang':
cxxflags["guile"] += " -Wno-attributes" # -Wno-attributes is for clang LLVM 3.5 and bdw-gc < 7.5 used by guile
if language not in cxxflags:
raise RuntimeError("{} is not a supported language".format(language))
@ -59,12 +63,15 @@ 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')
parser.add_argument('-C', '--compiler', required=False, help='compiler used (clang or gcc)')
args = parser.parse_args()
if args.cflags:
print("{}".format(get_cflags(args.language, args.std)))
get_flags = get_cflags
elif args.cxxflags:
print("{}".format(get_cxxflags(args.language, args.std)))
get_flags = get_cxxflags
else:
parser.print_help()
exit(1)
print(get_flags(args.language, args.std, args.compiler))