diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index cddb506c2..a8c30ef5c 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -35,7 +35,23 @@ #include "SVG.hpp" #include -#include + +#if ! defined(TBB_VERSION_MAJOR) + #include +#endif + +#if ! defined(TBB_VERSION_MAJOR) + static_assert(false, "TBB_VERSION_MAJOR not defined"); +#endif + +// Intel redesigned some TBB interface considerably when merging TBB with their oneAPI set of libraries, see GH #7332. +#if TBB_VERSION_MAJOR >= 2021 + #include + using slic3r_tbb_filtermode = tbb::filter_mode; +#else + #include + using slic3r_tbb_filtermode = tbb::filter; +#endif #include @@ -1500,7 +1516,7 @@ void GCode::process_layers( { // The pipeline is variable: The vase mode filter is optional. size_t layer_to_print_idx = 0; - const auto generator = tbb::make_filter(tbb::filter::serial_in_order, + const auto generator = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [this, &print, &tool_ordering, &print_object_instances_ordering, &layers_to_print, &layer_to_print_idx](tbb::flow_control& fc) -> GCode::LayerResult { if (layer_to_print_idx == layers_to_print.size()) { fc.stop(); @@ -1514,16 +1530,16 @@ void GCode::process_layers( return this->process_layer(print, layer.second, layer_tools, &layer == &layers_to_print.back(), &print_object_instances_ordering, size_t(-1)); } }); - const auto spiral_vase = tbb::make_filter(tbb::filter::serial_in_order, + const auto spiral_vase = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&spiral_vase = *this->m_spiral_vase.get()](GCode::LayerResult in) -> GCode::LayerResult { spiral_vase.enable(in.spiral_vase_enable); return { spiral_vase.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush }; }); - const auto cooling = tbb::make_filter(tbb::filter::serial_in_order, + const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&cooling_buffer = *this->m_cooling_buffer.get()](GCode::LayerResult in) -> std::string { return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush); }); - const auto output = tbb::make_filter(tbb::filter::serial_in_order, + const auto output = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&output_stream](std::string s) { output_stream.write(s); } ); @@ -1546,7 +1562,7 @@ void GCode::process_layers( { // The pipeline is variable: The vase mode filter is optional. size_t layer_to_print_idx = 0; - const auto generator = tbb::make_filter(tbb::filter::serial_in_order, + const auto generator = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [this, &print, &tool_ordering, &layers_to_print, &layer_to_print_idx, single_object_idx](tbb::flow_control& fc) -> GCode::LayerResult { if (layer_to_print_idx == layers_to_print.size()) { fc.stop(); @@ -1557,16 +1573,16 @@ void GCode::process_layers( return this->process_layer(print, { std::move(layer) }, tool_ordering.tools_for_layer(layer.print_z()), &layer == &layers_to_print.back(), nullptr, single_object_idx); } }); - const auto spiral_vase = tbb::make_filter(tbb::filter::serial_in_order, + const auto spiral_vase = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&spiral_vase = *this->m_spiral_vase.get()](GCode::LayerResult in)->GCode::LayerResult { spiral_vase.enable(in.spiral_vase_enable); return { spiral_vase.process_layer(std::move(in.gcode)), in.layer_id, in.spiral_vase_enable, in.cooling_buffer_flush }; }); - const auto cooling = tbb::make_filter(tbb::filter::serial_in_order, + const auto cooling = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&cooling_buffer = *this->m_cooling_buffer.get()](GCode::LayerResult in)->std::string { return cooling_buffer.process_layer(std::move(in.gcode), in.layer_id, in.cooling_buffer_flush); }); - const auto output = tbb::make_filter(tbb::filter::serial_in_order, + const auto output = tbb::make_filter(slic3r_tbb_filtermode::serial_in_order, [&output_stream](std::string s) { output_stream.write(s); } );