Fix Linux build & some warnings (#6438)

* Fix linux deps debug build

* Use the same DL_CACHE for release build when building debug version of deps on Linux.
This prevents downloading the same source packages twice, and avoid downloading again after deleting the build dir.

* Fix debug build

* Fix warnings "loop variable creates a copy from type" and "loop variable binds to a temporary constructed from type"
This commit is contained in:
Noisyfox
2024-08-18 11:33:00 +08:00
committed by GitHub
parent 0d886a133f
commit f136f04cfd
17 changed files with 45 additions and 38 deletions
+10 -10
View File
@@ -277,7 +277,7 @@ static wxArrayString get_exist_vendor_choices(VendorMap& vendors)
vendors[users_models.name] = users_models;
}
for (const pair<std::string, VendorProfile> &vendor : vendors) {
for (const auto& vendor : vendors) {
if (vendor.second.models.empty() || vendor.second.id.empty()) continue;
choices.Add(vendor.first);
}
@@ -658,11 +658,11 @@ void CreateFilamentPresetDialog::on_dpi_changed(const wxRect &suggested_rect) {
bool CreateFilamentPresetDialog::is_check_box_selected()
{
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_filament_preset) {
for (const auto& checkbox_preset : m_filament_preset) {
if (checkbox_preset.first->GetValue()) { return true; }
}
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_machint_filament_preset) {
for (const auto& checkbox_preset : m_machint_filament_preset) {
if (checkbox_preset.first->GetValue()) { return true; }
}
@@ -693,7 +693,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_vendor_item()
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
wxArrayString choices;
for (const wxString &vendor : filament_vendors) {
for (const wxString vendor : filament_vendors) {
choices.push_back(vendor);
}
choices.Sort();
@@ -775,7 +775,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_type_item()
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
wxArrayString filament_type;
for (const wxString &filament : m_system_filament_types_set) {
for (const wxString filament : m_system_filament_types_set) {
filament_type.Add(filament);
}
filament_type.Sort();
@@ -1050,7 +1050,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
if (curr_create_type == m_create_type.base_filament) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament create type filament ";
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_filament_preset) {
for (const auto& checkbox_preset : m_filament_preset) {
if (checkbox_preset.first->GetValue()) {
std::string compatible_printer_name = checkbox_preset.second.first;
std::vector<std::string> failures;
@@ -1077,7 +1077,7 @@ wxBoxSizer *CreateFilamentPresetDialog::create_button_item()
}
} else if (curr_create_type == m_create_type.base_filament_preset) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":clone filament presets create type filament preset";
for (const std::pair<::CheckBox *, std::pair<std::string, Preset *>> &checkbox_preset : m_machint_filament_preset) {
for (const auto& checkbox_preset : m_machint_filament_preset) {
if (checkbox_preset.first->GetValue()) {
std::string compatible_printer_name = checkbox_preset.second.first;
std::vector<std::string> failures;
@@ -1155,7 +1155,7 @@ wxArrayString CreateFilamentPresetDialog::get_filament_preset_choices()
}
int suffix = 0;
for (const pair<std::string, std::vector<Preset *>> &preset : m_filament_choice_map) {
for (const auto& preset : m_filament_choice_map) {
if (preset.second.empty()) continue;
std::set<wxString> preset_name_set;
for (Preset* filament_preset : preset.second) {
@@ -1752,7 +1752,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_nozzle_diameter_item(wxWindow *par
wxBoxSizer *comboBoxSizer = new wxBoxSizer(wxVERTICAL);
m_nozzle_diameter = new ComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, OPTION_SIZE, 0, nullptr, wxCB_READONLY);
wxArrayString nozzle_diameters;
for (const std::string nozzle : nozzle_diameter_vec) {
for (const std::string& nozzle : nozzle_diameter_vec) {
nozzle_diameters.Add(nozzle + " mm");
}
m_nozzle_diameter->Set(nozzle_diameters);
@@ -3899,7 +3899,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_filament_bundle_to_
BOOST_LOG_TRIVIAL(info) << "Filament preset json add successful: " << filament_preset->name;
}
for (const std::pair<std::string, json>& vendor_name_to_json : vendor_structure) {
for (const auto& vendor_name_to_json : vendor_structure) {
json j;
std::string printer_vendor = vendor_name_to_json.first;
j["vendor"] = printer_vendor;
+3 -3
View File
@@ -9466,21 +9466,21 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
print_config.set_key_value( "travel_jerk", new ConfigOptionFloat(jerk));
}
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) {
print_config.set_key_value(
opt.first,
new ConfigOptionFloat(opt.second)
);
}
for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
print_config.set_key_value(
opt.first,
new ConfigOptionFloatOrPercent(nozzle_diameter * opt.second / 100, false)
);
}
for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().int_pairs) {
print_config.set_key_value(
opt.first,
new ConfigOptionInt(opt.second)
+1 -1
View File
@@ -866,7 +866,7 @@ void SearchDialog::msw_rescale()
SearchListModel::SearchListModel(wxWindow *parent) : wxDataViewVirtualListModel(0)
{
int icon_id = 0;
for (const std::string &icon : {"cog", "printer", "printer", "spool", "blank_16"}) m_icon[icon_id++] = ScalableBitmap(parent, icon);
for (const std::string icon : {"cog", "printer", "printer", "spool", "blank_16"}) m_icon[icon_id++] = ScalableBitmap(parent, icon);
}
void SearchListModel::Clear()
+1 -1
View File
@@ -4846,7 +4846,7 @@ wxBoxSizer *ScoreDialog::get_photo_btn_sizer() {
it = m_selected_image_list.erase(it);
}
m_image_url_paths.clear();
for (const std::pair<wxStaticBitmap *, ImageMsg> &bitmap : m_image) {
for (const auto& bitmap : m_image) {
if (bitmap.second.is_uploaded) {
if (!bitmap.second.img_url_paths.empty()) {
m_image_url_paths.push_back(bitmap.second.img_url_paths);
+1 -1
View File
@@ -858,7 +858,7 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
const std::map<std::string, std::set<std::string>>& model_maps = config->second;
//for (const auto& vendor_profile : preset_bundle->vendors) {
for (const auto model_it: model_maps) {
for (const auto& model_it: model_maps) {
if (model_it.second.size() > 0) {
variant = *model_it.second.begin();
const auto config_old = old_enabled_vendors.find(bundle_name);
+3 -3
View File
@@ -618,7 +618,7 @@ void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model)
float nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0);
for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().float_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionFloat(opt.second));
}
@@ -627,11 +627,11 @@ void CalibUtils::calib_pa_pattern(const CalibInfo &calib_info, Model& model)
full_config, print_config.get_abs_value("line_width"),
print_config.get_abs_value("layer_height"), 0)));
for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionFloat(nozzle_diameter * opt.second / 100));
}
for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) {
for (const auto& opt : SuggestedConfigCalibPAPattern().int_pairs) {
print_config.set_key_value(opt.first, new ConfigOptionInt(opt.second));
}