-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compatibility with CGAL-6.0 (and 5.6.x) #13081
base: master
Are you sure you want to change the base?
Conversation
I was having issues recompiling PrusaSlicer on Gentoo, and this fixed my issue. Hopefully it gets merged soon, because most Gentoo users running "~amd64" are likely to run into issues due to CGAL updating. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some observations, maybe take a closer look (or ignore if inappropriate).
@@ -4,6 +4,22 @@ | |||
///|/ | |||
#include "CutSurface.hpp" | |||
|
|||
template <typename T> | |||
auto access_pmap(std::optional<T> opt) -> T { | |||
return opt.value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using value() could be problematic: This functions throws std::bad_optional_access when the optional value isn't set. Perhaps value_or(T()) is more appropriate, if a default value is acceptable. Or you could check if the value is set and act accordingly?
I'm also getting these warnings, but maybe that's something that can't be fixed yet without breaking compatibility:
|
Co-authored-by: Gregor Riepl <[email protected]>
Slicer builds with the patch now, but there's still errors in a unit test:
The property map errors can be fixed easily enough, but I'm not so sure about the Catch2 initializer list... Edit: I spoke too soon - after patching the property map accessors, everything built without error. Here's a very basic patch, but it's probably better to move the accessor functions to a header file. --- a/tests/libslic3r/test_emboss.cpp
+++ b/tests/libslic3r/test_emboss.cpp
@@ -9,8 +9,16 @@
#include <libslic3r/IntersectionPoints.hpp>
using namespace Slic3r;
+template <typename T>
+auto access_pmap(std::optional<T> opt) -> T {
+ return opt.value();
+}
+
+template <typename Pair>
+auto access_pmap(Pair pair) { return pair.first; }
+
namespace Private{
-
+
// calculate multiplication of ray dir to intersect - inspired by
// segment_segment_intersection when ray dir is normalized retur distance from
// ray point to intersection No value mean no intersection
@@ -904,8 +912,8 @@
// identify glyph for intersected vertex
std::string vert_shape_map_name = "v:glyph_id";
MyMesh cgal_object = MeshBoolean::cgal2::to_cgal(cube, face_map_name);
- auto face_map = cgal_object.property_map<MyMesh::Face_index, int32_t>(face_map_name).first;
- auto vert_shape_map = cgal_object.add_property_map<MyMesh::Vertex_index, IntersectingElemnt>(vert_shape_map_name).first;
+ auto face_map = access_pmap(cgal_object.property_map<MyMesh::Face_index, int32_t>(face_map_name));
+ auto vert_shape_map = access_pmap(cgal_object.add_property_map<MyMesh::Vertex_index, IntersectingElemnt>(vert_shape_map_name));
std::string edge_shape_map_name = "e:glyph_id";
std::string face_shape_map_name = "f:glyph_id";
@@ -913,8 +921,8 @@
MyMesh cgal_shape = MeshBoolean::cgal2::to_cgal(shape, projection, 0, edge_shape_map_name, face_shape_map_name, glyph_contours);
- auto edge_shape_map = cgal_shape.property_map<MyMesh::Edge_index, IntersectingElemnt>(edge_shape_map_name).first;
- auto face_shape_map = cgal_shape.property_map<MyMesh::Face_index, IntersectingElemnt>(face_shape_map_name).first;
+ auto edge_shape_map = access_pmap(cgal_shape.property_map<MyMesh::Edge_index, IntersectingElemnt>(edge_shape_map_name));
+ auto face_shape_map = access_pmap(cgal_shape.property_map<MyMesh::Face_index, IntersectingElemnt>(face_shape_map_name));
// bool map for affected edge
using d_prop_bool = CGAL::dynamic_edge_property_t<bool>;
|
Hi. a little rebase please? greetings |
[ 20%] Built target avrdude-slic3r
En el fichero incluido desde /usr/include/CGAL/AABB_traits.h:19,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/bundled_deps/libigl/igl/copyleft/cgal/closest_facet.h:17,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/bundled_deps/libigl/igl/copyleft/cgal/extract_cells.cpp:10,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/bundled_deps/libigl/igl/copyleft/cgal/extract_cells.h:114,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/bundled_deps/libigl/igl/copyleft/cgal/mesh_boolean.cpp:12,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/bundled_deps/libigl/igl/copyleft/cgal/mesh_boolean.h:226,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/src/libslic3r/MeshBoolean.cpp:14:
/usr/include/CGAL/Installation/internal/deprecation_warning.h:80:6: aviso: #warning "A deprecated header has been included." [-Wcpp]
80 | # warning "A deprecated header has been included."
| ^~~~~~~
En el fichero incluido desde /usr/include/CGAL/AABB_triangle_primitive.h:21,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/bundled_deps/libigl/igl/copyleft/cgal/closest_facet.h:18:
/usr/include/CGAL/Installation/internal/deprecation_warning.h:80:6: aviso: #warning "A deprecated header has been included." [-Wcpp]
80 | # warning "A deprecated header has been included."
| ^~~~~~~
En el fichero incluido desde /usr/include/CGAL/AABB_traits.h:19,
desde /tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/src/libslic3r/CutSurface.cpp:43:
/usr/include/CGAL/Installation/internal/deprecation_warning.h:80:6: aviso: #warning "A deprecated header has been included." [-Wcpp]
80 | # warning "A deprecated header has been included."
| ^~~~~~~
/usr/include/CGAL/Installation/internal/deprecation_warning.h:81:54: nota: ‘#pragma message: Warning: The header `<CGAL/AABB_traits.h>` is deprecated. Please use `<CGAL/AABB_traits_3.h>` instead. ’
81 | # pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
| ^
/usr/include/CGAL/Installation/internal/deprecation_warning.h:81:54: nota: ‘#pragma message: Warning: The header `<CGAL/AABB_triangle_primitive.h>` is deprecated. Please use `<CGAL/AABB_triangle_primitive_3.h>` instead. ’
81 | # pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
| ^
/usr/include/CGAL/Installation/internal/deprecation_warning.h:81:54: nota: ‘#pragma message: Warning: The header `<CGAL/AABB_traits.h>` is deprecated. Please use `<CGAL/AABB_traits_3.h>` instead. ’
81 | # pragma message (CGAL_INTERNAL_DEPRECATED_MESSAGE)
| ^
[ 20%] Linking CXX static library liblibslic3r_cgal.a ^ |
This patch ensures that PrusaSlicer can be compile with CGAL-6.0, or a previous version (like CGAL-5.6.2).
The main breaking change for PruseSlicer was the return type of
mesh.add_property_map
.