Skip to content

Commit 390b33b

Browse files
committed
Optional verbose output when processing wire files
1 parent 4ab14c9 commit 390b33b

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

cmake/scripts/wire2lua.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function(wire2lua)
2020
OPTIONS
2121
)
2222
parse_argn("" argnames ${ARGN})
23-
set(wire2lua_options ${WIRE_IDL_DIRECTORIES})
23+
set(wire2lua_options ${OPTIONS} ${WIRE_IDL_DIRECTORIES})
2424
if(NOT TARGET)
2525
message(FATAL_ERROR "No output specified for wire2lua")
2626
endif()

src/wire/idl/preprocess.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ struct preprocessor::impl {
4848
}
4949
args.push_back(file_name);
5050

51-
::std::cerr << "Execute preprocessor";
52-
for (auto const& a : args) {
53-
::std::cerr << " " << a;
51+
if (options.verbose) {
52+
::std::cerr << "Execute preprocessor";
53+
for (auto const& a : args) {
54+
::std::cerr << " " << a;
55+
}
56+
::std::cerr << "\n";
5457
}
55-
::std::cerr << "\n";
5658

5759
io::file_descriptor_sink sink{ pipe_.sink, io::close_handle };
5860

src/wire/idl/preprocess.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ using string_list = ::std::vector< ::std::string >;
2121
struct preprocess_options {
2222
string_list include_dirs;
2323
bool output_comments;
24+
bool verbose;
2425
};
2526

2627
class preprocessor {

src/wire/wire2cpp/wire2cpp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ try {
6666
("output-comments,C",
6767
po::bool_switch(&preproc_opts.output_comments),
6868
"Output comments from IDL")
69+
("verbose,v",
70+
po::bool_switch(&preproc_opts.verbose),
71+
"Verbose output")
6972
;
7073
po::options_description out_opts_desc{"Output options"};
7174
out_opts_desc.add_options()

src/wire/wire2lua/wire2lua.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ try {
7171
("output-comments,C",
7272
po::bool_switch(&preproc_opts.output_comments),
7373
"Output comments from IDL")
74+
("verbose,v",
75+
po::bool_switch(&preproc_opts.verbose),
76+
"Verbose output")
7477
;
7578
po::options_description out_opts_desc{"Output options"};
7679
out_opts_desc.add_options()
@@ -142,6 +145,9 @@ try {
142145
global_namespace_list generated;
143146
// Preprocess and parse
144147
for (auto const& file : options.files) {
148+
if (preproc_opts.verbose) {
149+
::std::cout << "Parse wire file " << file << "\n";
150+
}
145151
preprocessor preproc{ file, preproc_opts };
146152

147153
std::string input_str = preproc.to_string();
@@ -164,11 +170,13 @@ try {
164170
return ns->current_compilation_unit()->name == d->name;
165171
});
166172
if (f != generated.end()) {
167-
if (!unit_name_printed) {
168-
::std::cout << cu->name << " depends on:\n";
169-
unit_name_printed = true;
173+
if (preproc_opts.verbose) {
174+
if (!unit_name_printed) {
175+
::std::cout << cu->name << " depends on:\n";
176+
unit_name_printed = true;
177+
}
178+
::std::cout << "\t" << d->name << "\n";
170179
}
171-
::std::cout << "\t" << d->name << "\n";
172180
dependencies[cu->name].push_back(*f);
173181
}
174182
}

0 commit comments

Comments
 (0)