-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Fix compilation warnings when using VTK [version >= 8.2] #3637
Conversation
At least some of the builds are failing because they compile against vtk7. How do I fix that?
|
Hi Nick, thanks for taking the time to contribute. We have builds that use VTK 7.1 (Ubuntu-19-10) and even VTK 6.2 (Ubuntu-16-04). For the time being, we would like to keep PCL compatible with these versions since Ubuntu 16.04 is our baseline platform and the highest packaged version of VTK there is 6.2. But needless to say, we would also like to support the latest VTK releases. We'll need to work a bit on your PR to make it compatible with all VTK versions (add some CMake magic and a bit of indirection here and there). As the first step, I propose to extract everything not directly related to VTK 8.9 / QVTK widget into a separate PR. This will include changes regarding:
That PR should be compatible with the old VTK versions and thus pass our CI. Once we merge it, we can concentrate on the "real things". |
I will provide an update once I install VTK 7.1 on my machine and am able to compile PCL against it to confirm which changes are unrelated to the VTK version upgrade. |
You can use our Docker image to test compilation. Get the 19:10 tag, it contains VTK 7.1 and everything else needed to configure/build PCL. |
@nickmcummins are you still working on this - else would you mind I pick it up and continue the work? |
Hmm, what I can gather, its very little what we can extract from the PR.
why can use AllocateEstimate in hpp but not cpp?I started changing the hpp file and pcl_visualizer compiles when I added the AllocateEstimate, but when I do the same thing for the cpp file, it complains about it not exisiting. Why? The entire change in
even in CMake its not added if the version is less than 2 (same applies for the header files):
and the std:: prefix to ofstream, seems a bit overkill to make a single PR for. However, it could probably be excluded from a VTK 8.9 PR. As for the magic stuff: I guess in code we can use something like the following: // Create polys from polyMesh.polygons
vtkSmartPointer<vtkCellArray> cell_array = vtkSmartPointer<vtkCellArray>::New ();
#if VTK_MAJOR_VERSION <= 8 && VTK_MINOR_VERSION < 9
vtkIdType* cell = cell_array->WritePointer(vertices.size(), vertices.size() * (max_size_of_polygon + 1));
#endif
int idx = 0;
if (!lookup.empty ())
{
for (std::size_t i = 0; i < vertices.size (); ++i, ++idx)
{
std::size_t n_points = vertices[i].vertices.size ();
#if VTK_MAJOR_VERSION <= 8 && VTK_MINOR_VERSION < 9
*cell++ = n_points;
#else
cell_array->InsertNextCell (n_points);
#endif
for (std::size_t j = 0; j < n_points; j++, ++idx)
{
#if VTK_MAJOR_VERSION <= 8 && VTK_MINOR_VERSION < 9
*cell++ = lookup[vertices[i].vertices[j]];
#else
cell_array->InsertCellPoint (lookup[vertices[i].vertices[j]]);
#endif Should we do the same for the method name changes: The same with class name change, ie. QVTKWidget to QVTKOpenGLNativeWidget. In the CMakeList we can use the the VTK_VERSION defines. I guess for the .ui files, we would have to make two files and include the appropriate from CMake? Any else suggestions? |
Closing as it was superseded by #4262. |
Fixes #3370 by
QVTKOpenGLNativeWidget
.vtkDataSetSurfaceFilter::New()
which is inlibvtkFiltersGeometry-8.90.so
.std::ofstream
missing namespace.