-
Notifications
You must be signed in to change notification settings - Fork 96
Added support for the Meson Build System #298
Conversation
7638e5a
to
3864fc9
Compare
I'll have a look, please give me some time to learn meson. |
Sure, and thank you:) |
else if(parameter==paramter_name) | ||
found_argument=true; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::copy_if(parameters.begin(),paramerters.end(),parameter_values.end(),[](){}));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function gets more complicated if copy_if is to be used:
std::vector<std::string> CompileCommands::Command::paramter_values(const std::string ¶meter_name) const {
std::vector<std::string> parameter_values(parameters);
bool found_argument=false;
auto it=std::copy_if(parameters.begin(), parameters.end(), parameter_values.begin(),
[¶meter_name, &found_argument](const std::string ¶meter){
if(found_argument) {
found_argument=false;
return true;
}
else if(parameter==parameter_name) {
found_argument=true;
return false;
}
return false;
});
parameter_values.resize(std::distance(parameter_values.begin(), it));
return parameter_values;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::copy_if(parameters.begin(),paramerters.end(),parameter_values.end(),[¶meter_name](const std::string ¶m){
return parameter_name == param;
}));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the same. The idea is to return for instance some_file
after -o some_file
when the parameter_name
is -o
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, sorry I missed the else if, but at least this made me notice the miss spelt paramter_name
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the misspelling yesterday:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you push the spellfix? It still says paramter for me.
try { | ||
boost::property_tree::ptree root_pt; | ||
boost::property_tree::json_parser::read_json((build_path/"compile_commands.json").string(), root_pt); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if I'm wrong, but I think read_json can cause problems. I think there is a error_code version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be safe, since the exceptions are caught.
backslash=true; | ||
else if((parameters_str[c]==' ' || parameters_str[c]=='\t') && !backslash && !single_quote && !double_quote) { | ||
if(parameter_start_pos!=static_cast<size_t>(-1)) { | ||
add_parameter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::npos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, will fix
return false; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
if(project_path.empty() || default_build_path.empty())
return false;
if(!boost::filesystem::exists(project_path/"meson.build"))
return false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will clean up this as well.
return false; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This calls for abstraction, but I agree to wait if we are introducing more build systems.
…on if no executable was found previously.
… the latest homebrew meson package
@zalox Are you happy with the changes? Can we merge this PR? |
@zalox the spelling errors should be fixed now. Thought that I had fixed them, but apparently not all. |
Looks good, sorry about my late responses, been flying all over Europe! |
Should be 100%, but some additional testing needed. Let me know if there are any issues or not.