From 28a6bd7c3013ebf9c57353c600fc9a60f0f75ad2 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 21 Oct 2019 08:48:38 +0200 Subject: [PATCH 1/8] #3075 - Fixed Reload from disk command for .amf files --- src/libslic3r/Format/AMF.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/AMF.cpp b/src/libslic3r/Format/AMF.cpp index 2d77d3daa..181d6cb99 100644 --- a/src/libslic3r/Format/AMF.cpp +++ b/src/libslic3r/Format/AMF.cpp @@ -584,8 +584,16 @@ void AMFParserContext::endElement(const char * /* name */) stl_get_size(&stl); mesh.repair(); m_volume->set_mesh(std::move(mesh)); - // pass false if the mesh offset has been already taken from the data - m_volume->center_geometry_after_creation(m_volume->source.input_file.empty()); + if (m_volume->source.input_file.empty() && (m_volume->type() == ModelVolumeType::MODEL_PART)) + { + m_volume->source.object_idx = (int)m_model.objects.size() - 1; + m_volume->source.volume_idx = (int)m_model.objects.back()->volumes.size() - 1; + m_volume->center_geometry_after_creation(); + } + else + // pass false if the mesh offset has been already taken from the data + m_volume->center_geometry_after_creation(m_volume->source.input_file.empty()); + m_volume->calculate_convex_hull(); m_volume_facets.clear(); m_volume = nullptr; @@ -799,6 +807,15 @@ bool load_amf_file(const char *path, DynamicPrintConfig *config, Model *model) if (result) ctx.endDocument(); + for (ModelObject* o : model->objects) + { + for (ModelVolume* v : o->volumes) + { + if (v->source.input_file.empty() && (v->type() == ModelVolumeType::MODEL_PART)) + v->source.input_file = path; + } + } + return result; } From 2d610f9b84df1be44682e2fd1a94f05592f39841 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 21 Oct 2019 10:12:42 +0200 Subject: [PATCH 2/8] #3082 - Workaround to fix incorrect object position after applying gcode line G92 into custom gcode --- src/libslic3r/GCode/Analyzer.cpp | 24 ++++++++++++++++++++++++ src/libslic3r/GCode/Analyzer.hpp | 3 +++ 2 files changed, 27 insertions(+) diff --git a/src/libslic3r/GCode/Analyzer.cpp b/src/libslic3r/GCode/Analyzer.cpp index 78f6c6806..3f0b8735f 100644 --- a/src/libslic3r/GCode/Analyzer.cpp +++ b/src/libslic3r/GCode/Analyzer.cpp @@ -285,6 +285,11 @@ void GCodeAnalyzer::_process_gcode_line(GCodeReader&, const GCodeReader::GCodeLi _processM108orM135(line); break; } + case 132: // Recall stored home offsets + { + _processM132(line); + break; + } case 401: // Repetier: Store x, y and z position { _processM401(line); @@ -504,6 +509,25 @@ void GCodeAnalyzer::_processM108orM135(const GCodeReader::GCodeLine& line) } } +void GCodeAnalyzer::_processM132(const GCodeReader::GCodeLine& line) +{ + // This command is used by Makerbot to load the current home position from EEPROM + // see: https://github.com/makerbot/s3g/blob/master/doc/GCodeProtocol.md + // Using this command to reset the axis origin to zero helps in fixing: https://github.com/prusa3d/PrusaSlicer/issues/3082 + + if (line.has_x()) + _set_axis_origin(X, 0.0f); + + if (line.has_y()) + _set_axis_origin(Y, 0.0f); + + if (line.has_z()) + _set_axis_origin(Z, 0.0f); + + if (line.has_e()) + _set_axis_origin(E, 0.0f); +} + void GCodeAnalyzer::_processM401(const GCodeReader::GCodeLine& line) { if (m_gcode_flavor != gcfRepetier) diff --git a/src/libslic3r/GCode/Analyzer.hpp b/src/libslic3r/GCode/Analyzer.hpp index e90175c49..df4f6f652 100644 --- a/src/libslic3r/GCode/Analyzer.hpp +++ b/src/libslic3r/GCode/Analyzer.hpp @@ -182,6 +182,9 @@ private: // Set tool (MakerWare and Sailfish flavor) void _processM108orM135(const GCodeReader::GCodeLine& line); + // Recall stored home offsets + void _processM132(const GCodeReader::GCodeLine& line); + // Repetier: Store x, y and z position void _processM401(const GCodeReader::GCodeLine& line); From bd15efd17ace02d61b2e5b03af4291a32adf3fb3 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 09:58:32 +0200 Subject: [PATCH 3/8] Fix qhull compilation on Mac --- deps/deps-unix-common.cmake | 6 +- deps/deps-windows.cmake | 6 +- deps/{igl-fixes.patch => igl-mods.patch} | 0 deps/qhull-mods.patch | 144 ++++++----------------- 4 files changed, 42 insertions(+), 114 deletions(-) rename deps/{igl-fixes.patch => igl-mods.patch} (100%) diff --git a/deps/deps-unix-common.cmake b/deps/deps-unix-common.cmake index 6e559d05a..8f3af3851 100644 --- a/deps/deps-unix-common.cmake +++ b/deps/deps-unix-common.cmake @@ -53,8 +53,8 @@ find_package(Git REQUIRED) ExternalProject_Add(dep_qhull EXCLUDE_FROM_ALL 1 - URL "https://github.com/qhull/qhull/archive/v7.2.1.tar.gz" - URL_HASH SHA256=6fc251e0b75467e00943bfb7191e986fce0e1f8f6f0251f9c6ce5a843821ea78 + URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz" + URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0 CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local @@ -87,6 +87,6 @@ ExternalProject_Add(dep_libigl -DLIBIGL_WITH_TETGEN=OFF -DLIBIGL_WITH_TRIANGLE=OFF -DLIBIGL_WITH_XML=OFF - PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-mods.patch ) diff --git a/deps/deps-windows.cmake b/deps/deps-windows.cmake index 85013fbdd..6ecd5c0df 100644 --- a/deps/deps-windows.cmake +++ b/deps/deps-windows.cmake @@ -238,8 +238,8 @@ find_package(Git REQUIRED) ExternalProject_Add(dep_qhull EXCLUDE_FROM_ALL 1 - URL "https://github.com/qhull/qhull/archive/v7.2.1.tar.gz" - URL_HASH SHA256=6fc251e0b75467e00943bfb7191e986fce0e1f8f6f0251f9c6ce5a843821ea78 + URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz" + URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0 CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local @@ -300,7 +300,7 @@ ExternalProject_Add(dep_libigl -DLIBIGL_WITH_XML=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_DEBUG_POSTFIX=d - PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch + PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-mods.patch BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj INSTALL_COMMAND "" ) diff --git a/deps/igl-fixes.patch b/deps/igl-mods.patch similarity index 100% rename from deps/igl-fixes.patch rename to deps/igl-mods.patch diff --git a/deps/qhull-mods.patch b/deps/qhull-mods.patch index 94aeeca2f..70f7be6a7 100644 --- a/deps/qhull-mods.patch +++ b/deps/qhull-mods.patch @@ -1,121 +1,49 @@ -From a31ae4781a4afa60e21c70e5b4ae784bcd447c8a Mon Sep 17 00:00:00 2001 +From 7f55a56b3d112f4dffbf21b1722f400c64bf03b1 Mon Sep 17 00:00:00 2001 From: tamasmeszaros -Date: Thu, 6 Jun 2019 15:41:43 +0200 -Subject: [PATCH] prusa-slicer changes +Date: Mon, 21 Oct 2019 16:52:04 +0200 +Subject: [PATCH] Fix the build on macOS --- - CMakeLists.txt | 44 +++++++++++++++++++++++++++++++++++--- - Config.cmake.in | 2 ++ - src/libqhull_r/qhull_r-exports.def | 2 ++ - src/libqhull_r/user_r.h | 2 +- - 4 files changed, 46 insertions(+), 4 deletions(-) - create mode 100644 Config.cmake.in + CMakeLists.txt | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 59dff41..20c2ec5 100644 +index 07d3da2..14df8e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -61,7 +61,7 @@ - # $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $ +@@ -626,18 +626,18 @@ install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets + include(CMakePackageConfigHelpers) - project(qhull) --cmake_minimum_required(VERSION 2.6) -+cmake_minimum_required(VERSION 3.0) + write_basic_package_version_file( +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfigVersion.cmake" + VERSION ${qhull_VERSION} + COMPATIBILITY AnyNewerVersion + ) - # Define qhull_VERSION in CMakeLists.txt, Makefile, qhull-exports.def, qhull_p-exports.def, qhull_r-exports.def, qhull-warn.pri - set(qhull_VERSION2 "2015.2 2016/01/18") # not used, See global.c, global_r.c, rbox.c, rbox_r.c -@@ -610,10 +610,48 @@ add_test(NAME user_eg3 - # Define install - # --------------------------------------- + export(EXPORT QhullTargets +- FILE "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullTargets.cmake" ++ FILE "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullTargets.cmake" + NAMESPACE Qhull:: + ) --install(TARGETS ${qhull_TARGETS_INSTALL} -+install(TARGETS ${qhull_TARGETS_INSTALL} EXPORT QhullTargets - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR} -- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}) -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} -+ INCLUDES DESTINATION include) -+ -+include(CMakePackageConfigHelpers) -+ -+write_basic_package_version_file( -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" -+ VERSION ${qhull_VERSION} -+ COMPATIBILITY AnyNewerVersion -+) -+ -+export(EXPORT QhullTargets -+ FILE "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullTargets.cmake" -+ NAMESPACE Qhull:: -+) -+ -+configure_file(Config.cmake.in -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" -+ @ONLY -+) -+ -+set(ConfigPackageLocation lib/cmake/Qhull) -+install(EXPORT QhullTargets -+ FILE -+ QhullTargets.cmake -+ NAMESPACE -+ Qhull:: -+ DESTINATION -+ ${ConfigPackageLocation} -+) -+install( -+ FILES -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" -+ "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" -+ DESTINATION -+ ${ConfigPackageLocation} -+ COMPONENT -+ Devel -+) + configure_file(${PROJECT_SOURCE_DIR}/build/config.cmake.in +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfig.cmake" + @ONLY + ) - install(FILES ${libqhull_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull) - install(FILES ${libqhull_DOC} DESTINATION ${INCLUDE_INSTALL_DIR}/libqhull) -diff --git a/Config.cmake.in b/Config.cmake.in -new file mode 100644 -index 0000000..bc92bfe ---- /dev/null -+++ b/Config.cmake.in -@@ -0,0 +1,2 @@ -+include("${CMAKE_CURRENT_LIST_DIR}/QhullTargets.cmake") -+ -diff --git a/src/libqhull_r/qhull_r-exports.def b/src/libqhull_r/qhull_r-exports.def -index 325d57c..72f6ad0 100644 ---- a/src/libqhull_r/qhull_r-exports.def -+++ b/src/libqhull_r/qhull_r-exports.def -@@ -185,6 +185,7 @@ qh_memsetup - qh_memsize - qh_memstatistics - qh_memtotal -+qh_memcheck - qh_merge_degenredundant - qh_merge_nonconvex - qh_mergecycle -@@ -372,6 +373,7 @@ qh_settruncate - qh_setunique - qh_setvoronoi_all - qh_setzero -+qh_setendpointer - qh_sharpnewfacets - qh_skipfacet - qh_skipfilename -diff --git a/src/libqhull_r/user_r.h b/src/libqhull_r/user_r.h -index fc105b9..7cca65a 100644 ---- a/src/libqhull_r/user_r.h -+++ b/src/libqhull_r/user_r.h -@@ -139,7 +139,7 @@ Code flags -- - REALfloat = 1 all numbers are 'float' type - = 0 all numbers are 'double' type - */ --#define REALfloat 0 -+#define REALfloat 1 - - #if (REALfloat == 1) - #define realT float +@@ -652,8 +652,8 @@ install(EXPORT QhullTargets + ) + install( + FILES +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfig.cmake" +- "${CMAKE_CURRENT_BINARY_DIR}/Qhull/QhullConfigVersion.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfig.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/QhullExport/QhullConfigVersion.cmake" + DESTINATION + ${ConfigPackageLocation} + COMPONENT -- -2.16.2.windows.1 +2.17.1 From 0d89fd84db41e582381a310904765b4f37aacfdb Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 22 Oct 2019 10:26:51 +0200 Subject: [PATCH 4/8] Fixed a case when (under OSX) after some manipulation with an object or a part and then add some setting from 3dScene, "Revert button(s)" are still appear(s) in right panel --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 0b3f2b098..4ecab8a0f 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -632,7 +632,11 @@ void ObjectManipulation::update_reset_buttons_visibility() show_drop_to_bed = (std::abs(min_z) > EPSILON); } - wxGetApp().CallAfter([this, show_rotation, show_scale, show_drop_to_bed]{ + wxGetApp().CallAfter([this, show_rotation, show_scale, show_drop_to_bed] { + // There is a case (under OSX), when this function is called after the Manipulation panel is hidden + // So, let check if Manipulation panel is still shown for this moment + if (!this->IsShown()) + return; m_reset_rotation_button->Show(show_rotation); m_reset_scale_button->Show(show_scale); m_drop_to_bed_button->Show(show_drop_to_bed); From 8dea6c2fd8fb31502a6c5ab38298a046c436b8d9 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 22 Oct 2019 12:39:22 +0200 Subject: [PATCH 5/8] Fixed a crash with the following repro: 1) Start PrusaSlicer 2) Select printer: Original Prusa i3 MK2.5 3) Load any stl file 4) In Printer Settings turn on "Support stealth mode" 5) Press "Slice now" -> crash All the "machine_XXXXX" vectors in the print config contain a single value instead of two leading to a vector subscript out of range when read into GCode::_do_export() --- src/libslic3r/GCode.cpp | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 3a72657c3..26d9c90f8 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -778,22 +778,26 @@ void GCode::_do_export(Print &print, FILE *file) { m_silent_time_estimator.reset(); m_silent_time_estimator.set_dialect(print.config().gcode_flavor); - m_silent_time_estimator.set_max_acceleration((float)print.config().machine_max_acceleration_extruding.values[1]); - m_silent_time_estimator.set_retract_acceleration((float)print.config().machine_max_acceleration_retracting.values[1]); - m_silent_time_estimator.set_minimum_feedrate((float)print.config().machine_min_extruding_rate.values[1]); - m_silent_time_estimator.set_minimum_travel_feedrate((float)print.config().machine_min_travel_rate.values[1]); - m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::X, (float)print.config().machine_max_acceleration_x.values[1]); - m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Y, (float)print.config().machine_max_acceleration_y.values[1]); - m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Z, (float)print.config().machine_max_acceleration_z.values[1]); - m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::E, (float)print.config().machine_max_acceleration_e.values[1]); - m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::X, (float)print.config().machine_max_feedrate_x.values[1]); - m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Y, (float)print.config().machine_max_feedrate_y.values[1]); - m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Z, (float)print.config().machine_max_feedrate_z.values[1]); - m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::E, (float)print.config().machine_max_feedrate_e.values[1]); - m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::X, (float)print.config().machine_max_jerk_x.values[1]); - m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Y, (float)print.config().machine_max_jerk_y.values[1]); - m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, (float)print.config().machine_max_jerk_z.values[1]); - m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, (float)print.config().machine_max_jerk_e.values[1]); + /* "Stealth mode" values can be just a copy of "normal mode" values + * (when they aren't input for a printer preset). + * Thus, use back value from values, instead of second one, which could be absent + */ + m_silent_time_estimator.set_max_acceleration((float)print.config().machine_max_acceleration_extruding.values.back()); + m_silent_time_estimator.set_retract_acceleration((float)print.config().machine_max_acceleration_retracting.values.back()); + m_silent_time_estimator.set_minimum_feedrate((float)print.config().machine_min_extruding_rate.values.back()); + m_silent_time_estimator.set_minimum_travel_feedrate((float)print.config().machine_min_travel_rate.values.back()); + m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::X, (float)print.config().machine_max_acceleration_x.values.back()); + m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Y, (float)print.config().machine_max_acceleration_y.values.back()); + m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::Z, (float)print.config().machine_max_acceleration_z.values.back()); + m_silent_time_estimator.set_axis_max_acceleration(GCodeTimeEstimator::E, (float)print.config().machine_max_acceleration_e.values.back()); + m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::X, (float)print.config().machine_max_feedrate_x.values.back()); + m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Y, (float)print.config().machine_max_feedrate_y.values.back()); + m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::Z, (float)print.config().machine_max_feedrate_z.values.back()); + m_silent_time_estimator.set_axis_max_feedrate(GCodeTimeEstimator::E, (float)print.config().machine_max_feedrate_e.values.back()); + m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::X, (float)print.config().machine_max_jerk_x.values.back()); + m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Y, (float)print.config().machine_max_jerk_y.values.back()); + m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::Z, (float)print.config().machine_max_jerk_z.values.back()); + m_silent_time_estimator.set_axis_max_jerk(GCodeTimeEstimator::E, (float)print.config().machine_max_jerk_e.values.back()); if (print.config().single_extruder_multi_material) { // As of now the fields are shown at the UI dialog in the same combo box as the ramming values, so they // are considered to be active for the single extruder multi-material printers only. From 9f9a40100f13a0b8e8b0703a9b034184c47244ed Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 16:32:21 +0200 Subject: [PATCH 6/8] Solve build fail in RelWithDebInfo config with several imported targets. --- CMakeLists.txt | 27 ++++++++++++++++++++------- src/qhull/CMakeLists.txt | 4 +++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96752abb8..2d620f869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,7 +255,8 @@ if(NOT WIN32) # boost::process was introduced first in version 1.64.0 set(MINIMUM_BOOST_VERSION "1.64.0") endif() -find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS system filesystem thread log locale regex) +set(_boost_components "system;filesystem;thread;log;locale;regex") +find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components}) add_library(boost_libs INTERFACE) add_library(boost_headeronly INTERFACE) @@ -269,23 +270,35 @@ if(NOT SLIC3R_STATIC) target_compile_definitions(boost_headeronly INTERFACE BOOST_LOG_DYN_LINK) endif() +function(slic3r_remap_configs targets from_Cfg to_Cfg) + string(TOUPPER ${from_Cfg} from_CFG) + string(TOLOWER ${from_Cfg} from_cfg) + + message(STATUS "remapping targets: ${targets}") + foreach(tgt ${targets}) + if(TARGET ${tgt}) + set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg}) + message(STATUS "remap ${tgt} from ${from_Cfg} to ${to_Cfg}") + endif() + endforeach() +endfunction() + if(TARGET Boost::system) message(STATUS "Boost::boost exists") target_link_libraries(boost_headeronly INTERFACE Boost::boost) + list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets) target_link_libraries(boost_libs INTERFACE boost_headeronly # includes the custom compile definitions as well - Boost::system - Boost::filesystem - Boost::thread - Boost::log - Boost::locale - Boost::regex + ${_boost_targets} ) + slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release) else() target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS}) target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES}) endif() + + # Find and configure intel-tbb if(SLIC3R_STATIC) set(TBB_STATIC 1) diff --git a/src/qhull/CMakeLists.txt b/src/qhull/CMakeLists.txt index 9ca0bdff2..ab9aba9af 100644 --- a/src/qhull/CMakeLists.txt +++ b/src/qhull/CMakeLists.txt @@ -18,11 +18,13 @@ if(Qhull_FOUND) message(STATUS "Using qhull from system.") if(SLIC3R_STATIC) + slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhullstatic_r" RelWithDebInfo Release) target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhullstatic_r) else() + slic3r_remap_configs("Qhull::qhullcpp;Qhull::qhull_r" RelWithDebInfo Release) target_link_libraries(qhull INTERFACE Qhull::qhullcpp Qhull::qhull_r) endif() - + else(Qhull_FOUND) project(qhull) From 7f0c4fafe6677c32dc4ae09d512f2ee2f242fa45 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 16:42:40 +0200 Subject: [PATCH 7/8] Remove cmake debug messages --- CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d620f869..31d2b7c8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,11 +274,9 @@ function(slic3r_remap_configs targets from_Cfg to_Cfg) string(TOUPPER ${from_Cfg} from_CFG) string(TOLOWER ${from_Cfg} from_cfg) - message(STATUS "remapping targets: ${targets}") foreach(tgt ${targets}) if(TARGET ${tgt}) set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg}) - message(STATUS "remap ${tgt} from ${from_Cfg} to ${to_Cfg}") endif() endforeach() endfunction() From 8961e68f5ed2b2fe969c61cd06158c7384c9dbdb Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 22 Oct 2019 17:04:32 +0200 Subject: [PATCH 8/8] another cleanup --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31d2b7c8a..dde5a51f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,7 +272,6 @@ endif() function(slic3r_remap_configs targets from_Cfg to_Cfg) string(TOUPPER ${from_Cfg} from_CFG) - string(TOLOWER ${from_Cfg} from_cfg) foreach(tgt ${targets}) if(TARGET ${tgt})