workaround: avoid requiring c++14 just yet.

This commit is contained in:
Joseph Lenox 2018-05-21 22:01:35 -05:00
parent 7cb17d4fb2
commit d20c0f48ca
2 changed files with 80 additions and 55 deletions

View File

@ -31,7 +31,7 @@ endif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7.0)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(CMAKE_HOST_APPLE) IF(CMAKE_HOST_APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++ -DBOOST_THREAD_DONT_USE_CHRONO -DBOOST_NO_CXX11_RVALUE_REFERENCES -DBOOST_THREAD_USES_MOVE")
set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation -lc++") set(CMAKE_EXE_LINKER_FLAGS "-framework IOKit -framework CoreFoundation -lc++")
ELSE(CMAKE_HOST_APPLE) ELSE(CMAKE_HOST_APPLE)
# set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -L.") # set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -L.")
@ -216,7 +216,7 @@ IF(wxWidgets_FOUND)
${GUI_LIBDIR}/Settings.cpp ${GUI_LIBDIR}/Settings.cpp
${GUI_LIBDIR}/misc_ui.cpp ${GUI_LIBDIR}/misc_ui.cpp
) )
target_compile_features(slic3r_gui PUBLIC cxx_std_14) target_compile_features(slic3r_gui PUBLIC cxx_std_11)
#only build GUI lib if building with wx #only build GUI lib if building with wx
target_link_libraries (slic3r slic3r_gui ${wxWidgets_LIBRARIES}) target_link_libraries (slic3r slic3r_gui ${wxWidgets_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_WX") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_WX")

View File

@ -2,10 +2,17 @@
#define PRESETEDITOR_HPP #define PRESETEDITOR_HPP
#include <string> #include <string>
#include "libslic3r.h"
#if SLIC3R_CPPVER==11
#define st(A) (std::string(#A))
#elif SLIC3R_CPPVER==14
#define st(A) ((#A)s)
#endif
// TODO for C++14 find/replace st([A-z_]*) with "\1"s
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
using namespace std::string_literals;
class PresetEditor : public wxPanel { class PresetEditor : public wxPanel {
@ -23,69 +30,87 @@ public:
static t_config_option_keys options() { static t_config_option_keys options() {
return t_config_option_keys return t_config_option_keys
{ {
"layer_height"s, "first_layer_height"s, st(layer_height), st(first_layer_height),
"adaptive_slicing"s, "adaptive_slicing_quality"s, "match_horizontal_surfaces"s, st(adaptive_slicing), st(adaptive_slicing_quality), st(match_horizontal_surfaces),
"perimeters"s, "spiral_vase"s, st(perimeters), st(spiral_vase),
"top_solid_layers"s, "bottom_solid_layers"s, st(top_solid_layers), st(bottom_solid_layers),
"extra_perimeters"s, "avoid_crossing_perimeters"s, "thin_walls"s, "overhangs"s, st(extra_perimeters), st(avoid_crossing_perimeters), st(thin_walls), st(overhangs),
"seam_position"s, "external_perimeters_first"s, st(seam_position), st(external_perimeters_first),
"fill_density"s, "fill_pattern"s, "top_infill_pattern"s, "bottom_infill_pattern"s, "fill_gaps"s, st(fill_density), st(fill_pattern), st(top_infill_pattern), st(bottom_infill_pattern), st(fill_gaps),
"infill_every_layers"s, "infill_only_where_needed"s, st(infill_every_layers), st(infill_only_where_needed),
"solid_infill_every_layers"s, "fill_angle"s, "solid_infill_below_area"s, ""s, st(solid_infill_every_layers), st(fill_angle), st(solid_infill_below_area), st(),
"only_retract_when_crossing_perimeters"s, "infill_first"s, st(only_retract_when_crossing_perimeters), st(infill_first),
"max_print_speed"s, "max_volumetric_speed"s, st(max_print_speed), st(max_volumetric_speed),
"perimeter_speed"s, "small_perimeter_speed"s, "external_perimeter_speed"s, "infill_speed"s, ""s, st(perimeter_speed), st(small_perimeter_speed), st(external_perimeter_speed), st(infill_speed), st(),
"solid_infill_speed"s, "top_solid_infill_speed"s, "support_material_speed"s, ""s, st(solid_infill_speed), st(top_solid_infill_speed), st(support_material_speed),
"support_material_interface_speed"s, "bridge_speed"s, "gap_fill_speed"s, st(support_material_interface_speed), st(bridge_speed), st(gap_fill_speed),
"travel_speed"s, st(travel_speed),
"first_layer_speed"s, st(first_layer_speed),
"perimeter_acceleration"s, "infill_acceleration"s, "bridge_acceleration"s, ""s, st(perimeter_acceleration), st(infill_acceleration), st(bridge_acceleration),
"first_layer_acceleration"s, "default_acceleration"s, st(first_layer_acceleration), st(default_acceleration),
"skirts"s, "skirt_distance"s, "skirt_height"s, "min_skirt_length"s, st(skirts), st(skirt_distance), st(skirt_height), st(min_skirt_length),
"brim_connections_width"s, "brim_width"s, "interior_brim_width"s, st(brim_connections_width), st(brim_width), st(interior_brim_width),
"support_material"s, "support_material_threshold"s, "support_material_max_layers"s, "support_material_enforce_layers"s, st(support_material), st(support_material_threshold), st(support_material_max_layers), st(support_material_enforce_layers),
"raft_layers"s, st(raft_layers),
"support_material_pattern"s, "support_material_spacing"s, "support_material_angle"s, ""s, st(support_material_pattern), st(support_material_spacing), st(support_material_angle), st(),
"support_material_interface_layers"s, "support_material_interface_spacing"s, st(support_material_interface_layers), st(support_material_interface_spacing),
"support_material_contact_distance"s, "support_material_buildplate_only"s, "dont_support_bridges"s, st(support_material_contact_distance), st(support_material_buildplate_only), st(dont_support_bridges),
"notes"s, st(notes),
"complete_objects"s, "extruder_clearance_radius"s, "extruder_clearance_height"s, st(complete_objects), st(extruder_clearance_radius), st(extruder_clearance_height),
"gcode_comments"s, "output_filename_format"s, st(gcode_comments), st(output_filename_format),
"post_process"s, st(post_process),
"perimeter_extruder"s, "infill_extruder"s, "solid_infill_extruder"s, st(perimeter_extruder), st(infill_extruder), st(solid_infill_extruder),
"support_material_extruder"s, "support_material_interface_extruder"s, st(support_material_extruder), st(support_material_interface_extruder),
"ooze_prevention"s, "standby_temperature_delta"s, st(ooze_prevention), st(standby_temperature_delta),
"interface_shells"s, "regions_overlap"s, st(interface_shells), st(regions_overlap),
"extrusion_width"s, "first_layer_extrusion_width"s, "perimeter_extrusion_width"s, ""s, st(extrusion_width), st(first_layer_extrusion_width), st(perimeter_extrusion_width), st(),
"external_perimeter_extrusion_width"s, "infill_extrusion_width"s, "solid_infill_extrusion_width"s, st(external_perimeter_extrusion_width), st(infill_extrusion_width), st(solid_infill_extrusion_width),
"top_infill_extrusion_width"s, "support_material_extrusion_width"s, st(top_infill_extrusion_width), st(support_material_extrusion_width),
"support_material_interface_extrusion_width"s, "infill_overlap"s, "bridge_flow_ratio"s, st(support_material_interface_extrusion_width), st(infill_overlap), st(bridge_flow_ratio),
"xy_size_compensation"s, "resolution"s, "shortcuts"s, "compatible_printers"s, st(xy_size_compensation), st(resolution), st(shortcuts), st(compatible_printers),
"print_settings_id"s st(print_settings_id)
}; };
} }
t_config_option_keys my_options() override { return PrintEditor::options(); } t_config_option_keys my_options() override { return PrintEditor::options(); }
}; };
class MaterialEditor : public PresetEditor {
static t_config_option_keys options() {
return t_config_option_keys
{
st(filament_colour), st(filament_diameter), st(filament_notes), st(filament_max_volumetric_speed), st(extrusion_multiplier), st(filament_density), st(filament_cost),
st(temperature), st(first_layer_temperature), st(bed_temperature), st(first_layer_bed_temperature),
st(fan_always_on), st(cooling), st(compatible_printers),
st(min_fan_speed), st(max_fan_speed), st(bridge_fan_speed), st(disable_fan_first_layers),
st(fan_below_layer_time), st(slowdown_below_layer_time), st(min_print_speed),
st(start_filament_gcode), st(end_filament_gcode),
st(filament_settings_id)
};
}
t_config_option_keys my_options() override { return MaterialEditor::options(); }
};
class PrinterEditor : public PresetEditor { class PrinterEditor : public PresetEditor {
static t_config_option_keys options() { static t_config_option_keys options() {
return t_config_option_keys return t_config_option_keys
{ {
"bed_shape"s, "z_offset"s, "z_steps_per_mm"s, "has_heatbed"s, st(bed_shape), st(z_offset), st(z_steps_per_mm), st(has_heatbed),
"gcode_flavor"s, "use_relative_e_distances"s, st(gcode_flavor), st(use_relative_e_distances),
"serial_port"s, "serial_speed"s, st(serial_port), st(serial_speed),
"host_type"s, "print_host"s, "octoprint_apikey"s, st(host_type), st(print_host), st(octoprint_apikey),
"use_firmware_retraction"s, "pressure_advance"s, "vibration_limit"s, st(use_firmware_retraction), st(pressure_advance), st(vibration_limit),
"use_volumetric_e"s, st(use_volumetric_e),
"start_gcode"s, "end_gcode"s, "before_layer_gcode"s, "layer_gcode"s, "toolchange_gcode"s, "between_objects_gcode"s, st(start_gcode), st(end_gcode), st(before_layer_gcode), st(layer_gcode), st(toolchange_gcode), st(between_objects_gcode),
"nozzle_diameter"s, "extruder_offset"s, "min_layer_height"s, "max_layer_height"s, st(nozzle_diameter), st(extruder_offset), st(min_layer_height), st(max_layer_height),
"retract_length"s, "retract_lift"s, "retract_speed"s, "retract_restart_extra"s, "retract_before_travel"s, "retract_layer_change"s, "wipe"s, st(retract_length), st(retract_lift), st(retract_speed), st(retract_restart_extra), st(retract_before_travel), st(retract_layer_change), st(wipe),
"retract_length_toolchange"s, "retract_restart_extra_toolchange"s, "retract_lift_above"s, "retract_lift_below"s, st(retract_length_toolchange), st(retract_restart_extra_toolchange), st(retract_lift_above), st(retract_lift_below),
"printer_settings_id"s, st(printer_settings_id),
"printer_notes"s, st(printer_notes),
"use_set_and_wait_bed"s, "use_set_and_wait_extruder"s st(use_set_and_wait_bed), st(use_set_and_wait_extruder)
}; };
} }