Skip to content

Commit

Permalink
configure.py: Use the user-specified compiler for dialect detection
Browse files Browse the repository at this point in the history
Refs scylladb#483

Signed-off-by: Duarte Nunes <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
duarten authored and avikivity committed Aug 20, 2018
1 parent 4b08a58 commit beb2cd9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,6 @@ def configure_fmt(mode, cxx='g++', cc='gcc'):

all_artifacts = apps + tests + ['libseastar.a', 'seastar.pc', 'fmt/fmt/libfmt.a']

cpp_dialects = ['gnu++17', 'gnu++1z', 'gnu++14', 'gnu++1y']
try:
default_cpp_dialect = [x for x in cpp_dialects if dialect_supported(x, compiler='g++')][0]
except:
# if g++ is not available, fallback to something safe-ish
default_cpp_dialect='gnu++1y'

arg_parser = argparse.ArgumentParser('Configure seastar')
arg_parser.add_argument('--static', dest = 'static', action = 'store_const', default = '',
const = '-static',
Expand All @@ -349,7 +342,7 @@ def configure_fmt(mode, cxx='g++', cc='gcc'):
help = 'C++ compiler path')
arg_parser.add_argument('--c-compiler', action='store', dest='cc', default='gcc',
help = 'C compiler path (for bundled libraries such as dpdk and c-ares)')
arg_parser.add_argument('--c++-dialect', action='store', dest='cpp_dialect', default=default_cpp_dialect,
arg_parser.add_argument('--c++-dialect', action='store', dest='cpp_dialect', default='',
help='C++ dialect to build with [default: %(default)s]')
arg_parser.add_argument('--with-osv', action = 'store', dest = 'with_osv', default = '',
help = 'Shortcut for compile for OSv')
Expand Down Expand Up @@ -385,6 +378,15 @@ def configure_fmt(mode, cxx='g++', cc='gcc'):
help='Use C++17 std types for optional, variant, and string_view. Requires C++17 dialect and GCC >= 8.1.1-5')
args = arg_parser.parse_args()


if args.cpp_dialect == '':
cpp_dialects = ['gnu++17', 'gnu++1z', 'gnu++14', 'gnu++1y']
try:
args.cpp_dialect = [x for x in cpp_dialects if dialect_supported(x, compiler=args.cxx)][0]
except:
# if g++ is not available, fallback to something safe-ish
args.cpp_dialect='gnu++1y'

# Forwarding to CMake.
if args.cmake:
MODES = seastar_cmake.SUPPORTED_MODES if args.mode is 'all' else [args.mode]
Expand Down

0 comments on commit beb2cd9

Please sign in to comment.