diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d288999c1b..800d80cf17 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,7 +115,7 @@ endif(NOT GIT_VERSION STREQUAL "") find_package(Threads REQUIRED) set(Boost_NO_BOOST_CMAKE ON) -find_package(Boost REQUIRED COMPONENTS system thread filesystem) +find_package(Boost REQUIRED COMPONENTS system thread filesystem OPTIONAL_COMPONENTS nowide) set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/../xs/src/) set(GUI_LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/GUI/) @@ -231,6 +231,9 @@ add_library(libslic3r STATIC target_compile_features(libslic3r PUBLIC cxx_std_11) target_include_directories(libslic3r SYSTEM PUBLIC ${SLIC3R_INCLUDES}) target_include_directories(libslic3r PUBLIC ${LIBSLIC3R_INCLUDES}) +if (BOOST_NOWIDE_FOUND) + target_compile_options(libslic3r -DBOOST_INCLUDE_NOWIDE) +endif() add_library(BSpline STATIC ${LIBDIR}/BSpline/BSpline.cpp @@ -499,15 +502,17 @@ endif() # Windows needs a compiled component for Boost.nowide IF (WIN32) - add_library(boost-nowide STATIC - ${LIBDIR}/boost/nowide/iostream.cpp - ) - if(MSVC) - # Tell boost pragmas to not rename nowide as we are building it - add_definitions(-DBOOST_NOWIDE_NO_LIB) - endif() - target_link_libraries(slic3r boost-nowide) - target_include_directories(boost-nowide PUBLIC ${COMMON_INCLUDES}) + if (NOT BOOST_NOWIDE_FOUND) + add_library(boost-nowide STATIC + ${LIBDIR}/boost/nowide/iostream.cpp + ) + if(MSVC) + # Tell boost pragmas to not rename nowide as we are building it + add_definitions(-DBOOST_NOWIDE_NO_LIB) + endif() + target_link_libraries(slic3r boost-nowide) + target_include_directories(boost-nowide PUBLIC ${COMMON_INCLUDES}) + endif() # MinGW apparently has some multiple definitions of UUID-related items # deal with it. diff --git a/xs/Build.PL b/xs/Build.PL index 35356b8733..0655b7c12d 100644 --- a/xs/Build.PL +++ b/xs/Build.PL @@ -151,18 +151,27 @@ if (defined $ENV{BOOST_LIBRARYPATH}) { } # In order to generate the -l switches we need to know how Boost libraries are named my $have_boost = 0; +my $have_boost_optional = 0; my @boost_libraries = qw(system thread filesystem); # we need these +my @boost_optional_libraries = qw(nowide); # we need these, but if they aren't present we can deal # check without explicit lib path (works on Linux) if (! $mswin) { $have_boost = 1 if check_lib( lib => [ map "boost_${_}", @boost_libraries ], ); + $have_boost_optional = 1 + if check_lib( + lib => [ map "boost_${_}", @boost_optional_libraries ], + ); } if (!$ENV{SLIC3R_STATIC} && $have_boost) { # The boost library was detected by check_lib on Linux. push @LIBS, map "-lboost_${_}", @boost_libraries; + if (!$ENV{SLIC3R_STATIC} && $have_boost_optional) { + push @LIBS, map "-lboost_${_}", @boost_optional_libraries; + } } else { # Either static linking, or check_lib could not be used to find the boost libraries. my $lib_prefix = 'libboost_'; diff --git a/xs/src/exprtk/exprtk.hpp b/xs/src/exprtk/exprtk.hpp index cb65b5ff4f..c34063046a 100644 --- a/xs/src/exprtk/exprtk.hpp +++ b/xs/src/exprtk/exprtk.hpp @@ -11710,7 +11710,7 @@ namespace exprtk { public: - // Function of N paramters. + // Function of N parameters. typedef expression_node* expression_ptr; typedef std::pair branch_t; typedef IFunction ifunction; @@ -21226,7 +21226,7 @@ namespace exprtk if (index < error_list_.size()) return error_list_[index]; else - throw std::invalid_argument("parser::get_error() - Invalid error index specificed"); + throw std::invalid_argument("parser::get_error() - Invalid error index specified"); } inline std::string error() const diff --git a/xs/src/libslic3r/ConfigBase.cpp b/xs/src/libslic3r/ConfigBase.cpp index db2497af8e..975ac3710f 100644 --- a/xs/src/libslic3r/ConfigBase.cpp +++ b/xs/src/libslic3r/ConfigBase.cpp @@ -7,6 +7,7 @@ #include #include // std::runtime_error #include +#include #include #include #include @@ -16,7 +17,11 @@ #include #include #include +#ifdef BOOST_NOWIDE_FOUND +#include +#else #include +#endif #include #include #include diff --git a/xs/src/libslic3r/GCodeSender.hpp b/xs/src/libslic3r/GCodeSender.hpp index 0f39f5a3d1..4285025f42 100644 --- a/xs/src/libslic3r/GCodeSender.hpp +++ b/xs/src/libslic3r/GCodeSender.hpp @@ -7,7 +7,13 @@ #include #include #include + +#include +#if BOOST_VERSION >= 107300 +#include +#else #include +#endif #include #include @@ -15,6 +21,11 @@ namespace Slic3r { namespace asio = boost::asio; +#if BOOST_VERSION >= 107300 +using boost::placeholders::_1; +using boost::placeholders::_2; +#endif + class GCodeSender : private boost::noncopyable { public: GCodeSender(); diff --git a/xs/src/libslic3r/GCodeTimeEstimator.cpp b/xs/src/libslic3r/GCodeTimeEstimator.cpp index 818896bc16..f72b4762d4 100644 --- a/xs/src/libslic3r/GCodeTimeEstimator.cpp +++ b/xs/src/libslic3r/GCodeTimeEstimator.cpp @@ -1,9 +1,17 @@ #include "GCodeTimeEstimator.hpp" -#include #include +#include +#if BOOST_VERSION >= 107300 +#include +#endif namespace Slic3r { +#if BOOST_VERSION >= 107300 +using boost::placeholders::_1; +using boost::placeholders::_2; +#endif + void GCodeTimeEstimator::parse(const std::string &gcode) { diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index d9226c9913..79d0b22b4c 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -4,12 +4,20 @@ #include "Geometry.hpp" #include "Log.hpp" #include "TransformationMatrix.hpp" +#include +#if BOOST_VERSION >= 107300 +#include +#endif #include #include #include namespace Slic3r { +#if BOOST_VERSION >= 107300 +using boost::placeholders::_1; +#endif + PrintObject::PrintObject(Print* print, ModelObject* model_object, const BoundingBoxf3 &modobj_bbox) : layer_height_spline(model_object->layer_height_spline), typed_slices(false), diff --git a/xs/src/libslic3r/SLAPrint.cpp b/xs/src/libslic3r/SLAPrint.cpp index 84ce3568f8..0b5e5c528f 100644 --- a/xs/src/libslic3r/SLAPrint.cpp +++ b/xs/src/libslic3r/SLAPrint.cpp @@ -7,9 +7,17 @@ #include #include #include +#include +#if BOOST_VERSION >= 107300 +#include +#endif namespace Slic3r { +#if BOOST_VERSION >= 107300 +using boost::placeholders::_1; +#endif + void SLAPrint::slice() { diff --git a/xs/src/libslic3r/SupportMaterial.cpp b/xs/src/libslic3r/SupportMaterial.cpp index 83d5ca002f..ce9ac952c1 100644 --- a/xs/src/libslic3r/SupportMaterial.cpp +++ b/xs/src/libslic3r/SupportMaterial.cpp @@ -1,9 +1,14 @@ #include "SupportMaterial.hpp" #include "Log.hpp" + namespace Slic3r { +#if BOOST_VERSION >= 107300 +using boost::placeholders::_1; +#endif + PolylineCollection _fill_surface(Fill *fill, Surface *surface) { PolylineCollection ps; diff --git a/xs/src/libslic3r/TriangleMesh.cpp b/xs/src/libslic3r/TriangleMesh.cpp index 692fce8453..c13802c1d6 100644 --- a/xs/src/libslic3r/TriangleMesh.cpp +++ b/xs/src/libslic3r/TriangleMesh.cpp @@ -13,8 +13,12 @@ #include #include #include +#include #include #include +#if BOOST_VERSION >= 107300 +#include +#endif #ifdef SLIC3R_DEBUG #include "SVG.hpp" @@ -22,6 +26,11 @@ namespace Slic3r { + +#if BOOST_VERSION >= 107300 +using boost::placeholders::_1; +#endif + TriangleMesh::TriangleMesh() : repaired(false) {