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:
parent
0d886a133f
commit
f136f04cfd
17 changed files with 45 additions and 38 deletions
|
@ -127,8 +127,11 @@ then
|
|||
if [[ -n "${BUILD_DEBUG}" ]]
|
||||
then
|
||||
# have to build deps with debug & release or the cmake won't find everything it needs
|
||||
if [ ! -d "deps/build/release" ]
|
||||
then
|
||||
mkdir deps/build/release
|
||||
cmake -S deps -B deps/build/release -G Ninja -DDESTDIR="../destdir" ${BUILD_ARGS}
|
||||
fi
|
||||
cmake -S deps -B deps/build/release -G Ninja -DDESTDIR="${PWD}/deps/build/destdir" -DDEP_DOWNLOAD_DIR="${PWD}/deps/DL_CACHE" ${BUILD_ARGS}
|
||||
cmake --build deps/build/release
|
||||
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
|
||||
fi
|
||||
|
|
|
@ -23,7 +23,7 @@ Clipper2Lib::Paths64 Slic3rPoints_to_Paths64(const std::vector<T>& in)
|
|||
{
|
||||
Clipper2Lib::Paths64 out;
|
||||
out.reserve(in.size());
|
||||
for (const T item: in) {
|
||||
for (const T& item: in) {
|
||||
Clipper2Lib::Path64 path;
|
||||
path.reserve(item.size());
|
||||
for (const Slic3r::Point& point : item.points)
|
||||
|
|
|
@ -334,8 +334,8 @@ bool Emboss::divide_segments_for_close_point(ExPolygons &expolygons, double dist
|
|||
const Points &poly_pts = poly.points;
|
||||
const Point &line_a = poly_pts[id.point_index];
|
||||
const Point &line_b = (!ids.is_last_point(id)) ? poly_pts[id.point_index + 1] : poly_pts.front();
|
||||
assert(line_a == lines[index].a.cast<int>());
|
||||
assert(line_b == lines[index].b.cast<int>());
|
||||
assert(line_a == lines[index].a.cast<coord_t>());
|
||||
assert(line_b == lines[index].b.cast<coord_t>());
|
||||
if (p == line_a || p == line_b) continue;
|
||||
|
||||
divs.emplace_back(p, index);
|
||||
|
|
|
@ -4622,7 +4622,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
|||
its.vertices.assign(sub_object->geometry.vertices.begin(), sub_object->geometry.vertices.end());
|
||||
|
||||
// BBS
|
||||
for (const std::string prop_str : sub_object->geometry.face_properties) {
|
||||
for (const std::string& prop_str : sub_object->geometry.face_properties) {
|
||||
FaceProperty face_prop;
|
||||
face_prop.from_string(prop_str);
|
||||
its.properties.push_back(face_prop);
|
||||
|
|
|
@ -3538,7 +3538,7 @@ void check_model_ids_validity(const Model &model)
|
|||
for (const ModelInstance *model_instance : model_object->instances)
|
||||
check(model_instance->id());
|
||||
}
|
||||
for (const auto mm : model.materials) {
|
||||
for (const auto& mm : model.materials) {
|
||||
check(mm.second->id());
|
||||
check(mm.second->config.id());
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ void Preset::normalize(DynamicPrintConfig &config)
|
|||
static_cast<ConfigOptionVectorBase*>(opt)->resize(n, defaults.option(key));
|
||||
}
|
||||
// The following keys are mandatory for the UI, but they are not part of FullPrintConfig, therefore they are handled separately.
|
||||
for (const std::string &key : { "filament_settings_id" }) {
|
||||
for (const std::string key : { "filament_settings_id" }) {
|
||||
auto *opt = config.option(key, false);
|
||||
assert(opt == nullptr || opt->type() == coStrings);
|
||||
if (opt != nullptr && opt->type() == coStrings)
|
||||
|
|
|
@ -2925,7 +2925,7 @@ DynamicConfig PrintStatistics::config() const
|
|||
DynamicConfig PrintStatistics::placeholders()
|
||||
{
|
||||
DynamicConfig config;
|
||||
for (const std::string &key : {
|
||||
for (const std::string key : {
|
||||
"print_time", "normal_print_time", "silent_print_time",
|
||||
"used_filament", "extruded_volume", "total_cost", "total_weight",
|
||||
"initial_tool", "total_toolchanges", "total_wipe_tower_cost", "total_wipe_tower_filament"})
|
||||
|
|
|
@ -5329,11 +5329,11 @@ void PrintConfigDef::init_extruder_option_keys()
|
|||
"retraction_length",
|
||||
"retraction_minimum_travel",
|
||||
"retraction_speed",
|
||||
"travel_slope",
|
||||
"wipe",
|
||||
"wipe_distance",
|
||||
"z_hop",
|
||||
"z_hop_types",
|
||||
"travel_slope"
|
||||
"z_hop_types"
|
||||
};
|
||||
assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end()));
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ template<typename T> inline void reorder_by_shortest_traverse(std::vector<T> &po
|
|||
{
|
||||
Points start_point;
|
||||
start_point.reserve(polylines_out.size());
|
||||
for (const T contour : polylines_out) start_point.push_back(contour.points.front());
|
||||
for (const T& contour : polylines_out) start_point.push_back(contour.points.front());
|
||||
|
||||
std::vector<Points::size_type> order = chain_points(start_point);
|
||||
|
||||
|
|
|
@ -482,7 +482,7 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
|
|||
// because we compare with vsize2_with_unscale here (no division by zero), we also need to compare by vsize2_with_unscale inside the loop
|
||||
// to avoid integer rounding edge cases
|
||||
bool projected_p_beyond_prev_segment = dot_with_unscale(p1 - p0, from - p0) >= vsize2_with_unscale(p1 - p0);
|
||||
for(const Point p2 : poly.contour.points)
|
||||
for(const Point& p2 : poly.contour.points)
|
||||
{
|
||||
// X = A + Normal(B-A) * (((B-A) dot_with_unscale (P-A)) / VSize(B-A));
|
||||
// = A + (B-A) * ((B-A) dot_with_unscale (P-A)) / VSize2(B-A);
|
||||
|
@ -1437,11 +1437,11 @@ void TreeSupport::generate_toolpaths()
|
|||
|
||||
if (m_object->support_layer_count() > m_raft_layers) {
|
||||
const SupportLayer *ts_layer = m_object->get_support_layer(m_raft_layers);
|
||||
for (const ExPolygon expoly : ts_layer->floor_areas)
|
||||
for (const ExPolygon& expoly : ts_layer->floor_areas)
|
||||
raft_areas.push_back(expoly);
|
||||
for (const ExPolygon expoly : ts_layer->roof_areas)
|
||||
for (const ExPolygon& expoly : ts_layer->roof_areas)
|
||||
raft_areas.push_back(expoly);
|
||||
for (const ExPolygon expoly : ts_layer->base_areas)
|
||||
for (const ExPolygon& expoly : ts_layer->base_areas)
|
||||
raft_areas.push_back(expoly);
|
||||
}
|
||||
|
||||
|
@ -3628,7 +3628,7 @@ const ExPolygons& TreeSupportData::get_avoidance(coordf_t radius, size_t layer_n
|
|||
Polygons TreeSupportData::get_contours(size_t layer_nr) const
|
||||
{
|
||||
Polygons contours;
|
||||
for (const ExPolygon expoly : m_layer_outlines[layer_nr]) {
|
||||
for (const ExPolygon& expoly : m_layer_outlines[layer_nr]) {
|
||||
contours.push_back(expoly.contour);
|
||||
}
|
||||
|
||||
|
@ -3638,7 +3638,7 @@ Polygons TreeSupportData::get_contours(size_t layer_nr) const
|
|||
Polygons TreeSupportData::get_contours_with_holes(size_t layer_nr) const
|
||||
{
|
||||
Polygons contours;
|
||||
for (const ExPolygon expoly : m_layer_outlines[layer_nr]) {
|
||||
for (const ExPolygon& expoly : m_layer_outlines[layer_nr]) {
|
||||
for(int i=0;i<expoly.num_contours();i++)
|
||||
contours.push_back(expoly.contour_or_hole(i));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,11 @@ if(Qhull_FOUND)
|
|||
message(STATUS "Using qhull from system.")
|
||||
if(SLIC3R_STATIC)
|
||||
slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhullstatic_r" RelWithDebInfo Release)
|
||||
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
target_link_libraries(qhull INTERFACE Qhull::qhullcpp_d Qhull::qhullstatic_rd)
|
||||
else()
|
||||
target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhullstatic_r)
|
||||
endif()
|
||||
else()
|
||||
slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhull_r" RelWithDebInfo Release)
|
||||
target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhull_r)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue