From 72dcb2466d4eb78fe2edab0848ff2ca472be579e Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 20 Dec 2023 12:42:45 +0800 Subject: [PATCH] build: define BuildType for enclosing build_by_default in existing `modes` defined in `configure.py`, "release" is mapped to "RelWithDebInfo". this behavior matches that of seastar's `configure.py`, where we also map "release" build mode to "RelWithDebInfo" CMAKE_BUILD_TYPE. but in scylladb's existing cmake settings, it maps "release" to "Release", despite "Release" is listed as one of the typical CMAKE_BUILD_TYPE values. so, in this change, to prepare for the mapping, `BuildType` is introduced to map a build mode to its related settings. the building settings are still kept in `cmake.${CMAKE_BUILD_TYPE}.cmake`, but the other settings, like if a build type should be enabled or its mappings, are stored in `BuildType` in `configure.py`. Signed-off-by: Kefu Chai --- configure.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 585366e022..292f2d66ea 100755 --- a/configure.py +++ b/configure.py @@ -18,6 +18,7 @@ import sys import tempfile import textwrap from distutils.spawn import find_executable +from typing import NamedTuple outdir = 'build' @@ -2412,17 +2413,21 @@ def create_build_system(args): generate_compdb('compile_commands.json', ninja, args.buildfile, selected_modes) +class BuildType(NamedTuple): + build_by_default: bool + + def configure_using_cmake(args): # all supported build modes, and if they are built by default if selected - build_by_default = {'debug': True, - 'release': True, - 'dev': True, - 'sanitize': False, - 'coverage': False} - selected_modes = args.selected_modes or build_by_default.keys() + build_modes = {'debug': BuildType(True), + 'release': BuildType(True), + 'dev': BuildType(True), + 'sanitize': BuildType(False), + 'coverage': BuildType(False)} + selected_modes = args.selected_modes or build_modes.keys() selected_configs = ';'.join(mode.capitalize() for mode in selected_modes) default_configs = ';'.join(mode.capitalize() for mode in selected_modes - if build_by_default[mode]) + if build_modes[mode].build_by_default) settings = { 'CMAKE_CONFIGURATION_TYPES': selected_configs,