-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
VTK 9.0 Support #4096
VTK 9.0 Support #4096
Changes from all commits
92d28d9
f807763
cd81974
8230bc6
4ad0cfc
e548e78
9c0ef43
382ef31
a3cef59
e85ab54
a32a9e5
e3fb9fc
ae0b7cb
965e2f1
3a522f4
2b68fcf
c8e4e83
5b8544e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#Search for VTK | ||
find_package(VTK NO_MODULE) | ||
|
||
if(NOT VTK_FOUND) | ||
return() | ||
endif() | ||
|
||
#Exit if version is below | ||
if("${VTK_VERSION}" VERSION_LESS 6.2) | ||
message(WARNING "The minimum required version of VTK is 6.2, but found ${VTK_VERSION}") | ||
set(VTK_FOUND FALSE) | ||
return() | ||
endif() | ||
|
||
#Change to use list Transform when cmake is >= 3.12 | ||
if(NOT (${VTK_VERSION} VERSION_LESS 9.0)) | ||
set(PCL_VTK_COMPONENTS | ||
ChartsCore | ||
CommonColor | ||
CommonCore | ||
CommonDataModel | ||
CommonExecutionModel | ||
CommonMath | ||
CommonMisc | ||
CommonTransforms | ||
FiltersCore | ||
FiltersExtraction | ||
FiltersGeneral | ||
FiltersGeometry | ||
FiltersModeling | ||
FiltersSources | ||
ImagingCore | ||
ImagingSources | ||
InteractionStyle | ||
InteractionWidgets | ||
IOCore | ||
IOGeometry | ||
IOImage | ||
IOLegacy | ||
IOPLY | ||
RenderingAnnotation | ||
RenderingCore | ||
RenderingContext2D | ||
RenderingLOD | ||
RenderingFreeType | ||
RenderingOpenGL2 | ||
ViewsCore | ||
ViewsContext2D | ||
) | ||
else() | ||
set(PCL_VTK_COMPONENTS | ||
vtkChartsCore | ||
vtkCommonCore | ||
vtkCommonDataModel | ||
vtkCommonExecutionModel | ||
vtkFiltersCore | ||
vtkFiltersExtraction | ||
vtkFiltersModeling | ||
vtkImagingCore | ||
vtkImagingSources | ||
vtkInteractionStyle | ||
vtkInteractionWidgets | ||
vtkIOCore | ||
vtkIOGeometry | ||
vtkIOImage | ||
vtkIOLegacy | ||
vtkIOPLY | ||
vtkRenderingAnnotation | ||
vtkRenderingLOD | ||
vtkViewsContext2D | ||
) | ||
endif() | ||
|
||
if(NOT DEFINED VTK_RENDERING_BACKEND) | ||
# Use OpenGL backend pre 8.1, else use OpenGL2 | ||
if(${VTK_VERSION} VERSION_LESS 8.1) | ||
set(VTK_RENDERING_BACKEND "OpenGL") | ||
else() | ||
set(VTK_RENDERING_BACKEND "OpenGL2") | ||
endif() | ||
endif() | ||
|
||
if(${VTK_VERSION} VERSION_LESS 9.0) | ||
list(APPEND PCL_VTK_COMPONENTS vtkRenderingContext${VTK_RENDERING_BACKEND}) | ||
else() | ||
list(APPEND PCL_VTK_COMPONENTS RenderingUI) # not available < 9.0 so append here. | ||
list(APPEND PCL_VTK_COMPONENTS RenderingContext${VTK_RENDERING_BACKEND}) | ||
endif() | ||
|
||
message("WITH_QT is:${WITH_QT}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add a space after the colon 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was more for 'debugging' - but I guess the information is nice to have, but could probably be consolidated to a single line summerizing most of the VTK settings 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was an issue about producing a full-blown CMake configuration report for PCL, maybe it's the kind of information that could go there when it happens. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's something nice and available in 3.5 too (Ubuntu 16.04's CMake version) @Morwenn is there a issue for this CMake reporting? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kunaltyagi I thought so but apparently it was merely a comment in issue #3603, my memory failed me. Such a summary is definitely something valuable when dealing with build issues (and especially good when users report issues, you don't have to ask again and again for the information). I didn't know that CMake had a built-in feature to report the options, that's nice. |
||
if(WITH_QT) | ||
message("VTK_MODULES_ENABLED is: ${VTK_MODULES_ENABLED}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VTK 9.0 has "VTK_AVAILABLE_COMPONENTS" instead of "VTK_MODULES_ENABLED" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for mentioning it. Saw it yesterday as well :-) |
||
if(";${VTK_MODULES_ENABLED};" MATCHES ";vtkGUISupportQt;" AND ";${VTK_MODULES_ENABLED};" MATCHES ";vtkRenderingQt;") | ||
set(QVTK_FOUND ON) | ||
if(NOT (${VTK_VERSION} VERSION_LESS 9.0)) | ||
list(APPEND PCL_VTK_COMPONENTS RenderingQt GUISupportQt) | ||
else() | ||
list(APPEND PCL_VTK_COMPONENTS vtkRenderingQt vtkGUISupportQt) | ||
endif() | ||
else() | ||
unset(QVTK_FOUND) | ||
endif() | ||
endif() | ||
|
||
find_package(VTK NO_MODULE COMPONENTS ${PCL_VTK_COMPONENTS}) | ||
|
||
message(STATUS "VTK_MAJOR_VERSION ${VTK_MAJOR_VERSION}, rendering backend: ${VTK_RENDERING_BACKEND}") | ||
|
||
if(PCL_SHARED_LIBS OR (NOT (PCL_SHARED_LIBS) AND NOT (VTK_BUILD_SHARED_LIBS))) | ||
if(${VTK_VERSION} VERSION_LESS 9.0) | ||
if(VTK_USE_FILE) | ||
include(${VTK_USE_FILE}) | ||
endif() | ||
|
||
message(STATUS "VTK found (include: ${VTK_INCLUDE_DIRS}, libs: ${VTK_LIBRARIES}") | ||
endif() | ||
|
||
if(APPLE) | ||
option(VTK_USE_COCOA "Use Cocoa for VTK render windows" ON) | ||
mark_as_advanced(VTK_USE_COCOA) | ||
endif() | ||
|
||
if(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL") | ||
set(VTK_RENDERING_BACKEND_OPENGL_VERSION "1") | ||
message(DEPRECATION "The rendering backend OpenGL is deprecated and not available anymore since VTK 8.2." | ||
"Please switch to the OpenGL2 backend instead, which is available since VTK 6.2." | ||
"Support of the deprecated backend will be dropped with PCL 1.13.") | ||
elseif(${VTK_RENDERING_BACKEND} STREQUAL "OpenGL2") | ||
set(VTK_RENDERING_BACKEND_OPENGL_VERSION "2") | ||
endif() | ||
|
||
else() | ||
set(VTK_FOUND OFF) | ||
message("Warning: You are to build PCL in STATIC but VTK is SHARED!") | ||
message("Warning: VTK disabled!") | ||
endif() |
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.
Indentation of
set
is missing.Is it really necessary to have two lists? I had started more than one moth ago same test (just didn't had time to continue and as this PR also exists)...
I had solved it by:
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.
I'll look into using your snippet.
Originally it was using List transform, but that wasn't available. But an "ordinary" foreach could be used ofc.