Skip to content

Commit 7e5e98d

Browse files
committed
Clean up meson summary
Make the meson summary better by: Adding new sections for each value type (this implicitly sorts each section, making the pattern more clear) Remove the generated messon message, where we print the values of ifdefs. Enable bool_yn for feature options, which allows us to pass the feature in directly, and print and colorize yes/no answers Tested: meson setup builddir Results in no messages printed for the ifdefs, and colorized output, with yes/no answers, summarized below. Feature Options basic-auth : YES String Options dns-resolver : systemd-dbus Numeric Options http-body-limit : 30 Change-Id: I13f003846edaa355090c14113b61aacb05cbeb9a Signed-off-by: Ed Tanous <[email protected]>
1 parent aca5a54 commit 7e5e98d

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

config/meson.build

+35-17
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,44 @@ string_options = [
5252

5353
int_options = ['http-body-limit', 'watchdog-timeout-seconds']
5454

55-
feature_options_string = '\n//Feature options\n'
55+
feature_options_string = '\n// Feature options\n'
5656
string_options_string = '\n// String options\n'
5757
int_options_string = '\n// Integer options\n'
5858

59-
foreach option_key : feature_options + string_options + int_options
60-
option_key_config = 'BMCWEB_' + option_key.to_upper()
61-
option_key_config = option_key_config.replace('-', '_')
6259

63-
message(option_key_config)
64-
65-
opt = get_option(option_key)
66-
if string_options.contains(option_key)
67-
string_options_string += 'constexpr std::string_view ' + option_key_config + ' = "' + opt + '";\n'
68-
elif int_options.contains(option_key)
69-
int_options_string += 'constexpr const int ' + option_key_config + ' = ' + opt.to_string() + ';\n'
70-
else
71-
feature_options_string += 'constexpr const bool ' + option_key_config + ' = ' + opt.allowed().to_string() + ';\n'
72-
opt = opt.allowed().to_string()
73-
endif
74-
summary(option_key, opt, section: 'Features')
60+
foreach feature_type, feature_list : {
61+
'Feature': feature_options,
62+
'Numeric': int_options,
63+
'String': string_options,
64+
}
65+
summary_dict = {}
66+
foreach option_key : feature_list
67+
option_key_config = 'BMCWEB_' + option_key.to_upper()
68+
option_key_config = option_key_config.replace('-', '_')
69+
70+
opt = get_option(option_key)
71+
if feature_type == 'Feature'
72+
opt = opt.allowed()
73+
feature_options_string += 'constexpr const bool @0@=@1@;\n'.format(
74+
option_key_config,
75+
opt.to_string(),
76+
)
77+
endif
78+
if feature_type == 'Numeric'
79+
int_options_string += 'constexpr const int @0@=@1@;\n'.format(
80+
option_key_config,
81+
opt.to_string(),
82+
)
83+
endif
84+
if feature_type == 'String'
85+
string_options_string += 'constexpr std::string_view @0@="@1@";\n'.format(
86+
option_key_config,
87+
opt,
88+
)
89+
endif
90+
summary_dict += {option_key: opt}
91+
endforeach
92+
summary(summary_dict, section: feature_type + ' Options', bool_yn: true)
7593
endforeach
7694

7795
# Logging level
@@ -84,7 +102,7 @@ loglvlopt = loglvlopt.to_upper()
84102
string_options_string += 'constexpr std::string_view BMCWEB_LOGGING_LEVEL' + ' = "' + loglvlopt + '";\n'
85103

86104
# NBD proxy is disabled due to lack of maintenance. See meson_options.txt
87-
feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
105+
feature_options_string += 'constexpr const bool BMCWEB_VM_NBDPROXY = false;\n'
88106

89107
conf_data.set(
90108
'BMCWEB_OPTIONS',

meson.build

-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ incdir = include_directories(
6666
)
6767
incdir_cli = include_directories('http', 'include')
6868

69-
if (get_option('tests').allowed())
70-
summary('unittest', 'NA', section: 'Features')
71-
endif
72-
7369
# Add compiler arguments
7470
boost_flags = ['-Wno-unused-parameter']
7571
nghttp2_flags = []

0 commit comments

Comments
 (0)