From 54ff8a45d7fe7bd3f48ce115bd103f2e6e84d21a Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Tue, 5 Nov 2024 16:39:54 +0100 Subject: [PATCH 1/5] started to cleanup deps --- CMakeModules/FindEigen3.cmake | 81 ------------------------ CMakeModules/FindLVR2.cmake | 30 --------- CMakeModules/FindLz4.cmake | 114 ++++++++++++++++++---------------- 3 files changed, 60 insertions(+), 165 deletions(-) delete mode 100644 CMakeModules/FindEigen3.cmake delete mode 100644 CMakeModules/FindLVR2.cmake diff --git a/CMakeModules/FindEigen3.cmake b/CMakeModules/FindEigen3.cmake deleted file mode 100644 index 9c546a05d..000000000 --- a/CMakeModules/FindEigen3.cmake +++ /dev/null @@ -1,81 +0,0 @@ -# - Try to find Eigen3 lib -# -# This module supports requiring a minimum version, e.g. you can do -# find_package(Eigen3 3.1.2) -# to require version 3.1.2 or newer of Eigen3. -# -# Once done this will define -# -# EIGEN3_FOUND - system has eigen lib with correct version -# EIGEN3_INCLUDE_DIR - the eigen include directory -# EIGEN3_VERSION - eigen version - -# Copyright (c) 2006, 2007 Montel Laurent, -# Copyright (c) 2008, 2009 Gael Guennebaud, -# Copyright (c) 2009 Benoit Jacob -# Redistribution and use is allowed according to the terms of the 2-clause BSD license. - -if(NOT Eigen3_FIND_VERSION) - if(NOT Eigen3_FIND_VERSION_MAJOR) - set(Eigen3_FIND_VERSION_MAJOR 2) - endif(NOT Eigen3_FIND_VERSION_MAJOR) - if(NOT Eigen3_FIND_VERSION_MINOR) - set(Eigen3_FIND_VERSION_MINOR 91) - endif(NOT Eigen3_FIND_VERSION_MINOR) - if(NOT Eigen3_FIND_VERSION_PATCH) - set(Eigen3_FIND_VERSION_PATCH 0) - endif(NOT Eigen3_FIND_VERSION_PATCH) - - set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}") -endif(NOT Eigen3_FIND_VERSION) - -macro(_eigen3_check_version) - file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header) - - string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}") - set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}") - set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}") - string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}") - set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}") - - set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION}) - if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION}) - set(EIGEN3_VERSION_OK FALSE) - else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION}) - set(EIGEN3_VERSION_OK TRUE) - endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION}) - - if(NOT EIGEN3_VERSION_OK) - - message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, " - "but at least version ${Eigen3_FIND_VERSION} is required") - endif(NOT EIGEN3_VERSION_OK) -endmacro(_eigen3_check_version) - -if (EIGEN3_INCLUDE_DIR) - - # in cache already - _eigen3_check_version() - set(EIGEN3_FOUND ${EIGEN3_VERSION_OK}) - -else (EIGEN3_INCLUDE_DIR) - - find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library - PATHS - ${CMAKE_INSTALL_PREFIX}/include - ${KDE4_INCLUDE_DIR} - PATH_SUFFIXES eigen3 eigen - ) - - if(EIGEN3_INCLUDE_DIR) - _eigen3_check_version() - endif(EIGEN3_INCLUDE_DIR) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK) - - mark_as_advanced(EIGEN3_INCLUDE_DIR) - -endif(EIGEN3_INCLUDE_DIR) - diff --git a/CMakeModules/FindLVR2.cmake b/CMakeModules/FindLVR2.cmake deleted file mode 100644 index 3e05e9fe5..000000000 --- a/CMakeModules/FindLVR2.cmake +++ /dev/null @@ -1,30 +0,0 @@ -############################################################################### -# Find Las Vegas Reconstruction Kit -# -# This sets the following variables: -# LVR2_FOUND - True if LVR2 was found. -# LVR2_INCLUDE_DIRS - Directories containing the LVR2 include files. -# LVR2_LIBRARIES - Libraries needed to use LVR2. -# - -find_package(PkgConfig QUIET) - -#add a hint so that it can find it without the pkg-config -find_path(LVR2_INCLUDE_DIR MeshGenerator.hpp - HINTS /usr/local/include/lvr2/reconstruction) - -message(STATUS "LVR2 include directory: ${LVR2_INCLUDE_DIR}") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LVR2 DEFAULT_MSG LVR2_INCLUDE_DIR) - - - - -if(LVR2_FOUND) - # Add the include directories - set(LVR2_INCLUDE_DIRS "${LVR2_INCLUDE_DIR}/.." "${LVR2_INCLUDE_DIR}/../../../ext/rply" "${LVR2_INCLUDE_DIR}/../../../ext/" "${LVR2_INCLUDE2_DIR}/../../../ext/stann" "${LVR2_INCLUDE_DIR}/../../../ext/psimpl/") - set(LVR2_LIBRARIES "${LVR2_INCLUDE_DIR}/../../../build/src/liblvr2/" "${LVR2_INCLUDE_DIR}/../../../build/ext/laslib/" "${LVR2_INCLUDE_DIR}/../../../build/ext/rply/" "${LVR2_INCLUDE_DIR}/../../../build/ext/slam6d/" "${LVR2_INCLUDE_DIR}/../../../lib/") - message(STATUS "LVR2 found (include: ${LVR2_INCLUDE_DIRS}, libraries: ${LVR2_LIBRARIES})") -endif(LVR2_FOUND) - diff --git a/CMakeModules/FindLz4.cmake b/CMakeModules/FindLz4.cmake index 4ba578fbd..88455b66a 100644 --- a/CMakeModules/FindLz4.cmake +++ b/CMakeModules/FindLz4.cmake @@ -20,64 +20,70 @@ # LZ4_LIBRARY, path to liblz4.so # LZ4_FOUND, whether lz4 has been found -set(LZ4_SEARCH_HEADER_PATHS - ${THIRDPARTY_PREFIX}/include - /usr/include - /usr/local/include -) +find_package(PkgConfig REQUIRED) +pkg_check_modules(lz4 REQUIRED IMPORTED_TARGET liblz4) +set(LZ4_LIBRARY PkgConfig::lz4) -set(LZ4_SEARCH_LIB_PATH - ${THIRDPARTY_PREFIX}/lib - /usr/local/lib - /usr/lib/ - /usr/lib/x86_64-linux-gnu/ - /usr/lib/aarch64-linux-gnu/ - /usr/lib/arm-linux-gnueabihf/ -) -find_path(LZ4_INCLUDE_DIR lz4.h PATHS - ${LZ4_SEARCH_HEADER_PATHS} - # make sure we don't accidentally pick up a different version - NO_DEFAULT_PATH -) -find_library(LZ4_LIB_PATH NAMES liblz4.so liblz4.dylib PATHS ${LZ4_SEARCH_LIB_PATH} NO_DEFAULT_PATH) -find_library(LZ4_STATIC_LIB NAMES liblz4.a PATHS ${LZ4_SEARCH_LIB_PATH} NO_DEFAULT_PATH) +# set(LZ4_SEARCH_HEADER_PATHS +# ${THIRDPARTY_PREFIX}/include +# /usr/include +# /usr/local/include +# ) -message(STATUS "Header ${LZ4_INCLUDE_DIR} LIB ") -if (LZ4_INCLUDE_DIR AND LZ4_LIB_PATH) - set(LZ4_FOUND TRUE) - set(LZ4_LIBS ${LZ4_SEARCH_LIB_PATH}) +# set(LZ4_SEARCH_LIB_PATH +# ${THIRDPARTY_PREFIX}/lib +# /usr/local/lib +# /usr/lib/ +# /usr/lib/x86_64-linux-gnu/ +# /usr/lib/aarch64-linux-gnu/ +# /usr/lib/arm-linux-gnueabihf/ +# ) - # mac os is using dylib instead of so for lz4 - if (APPLE) - set(LZ4_LIBRARY liblz4.dylib) - else () - set(LZ4_LIBRARY ${LZ4_LIB_PATH}) - endif () -else () - set(LZ4_FOUND FALSE) -endif () +# find_path(LZ4_INCLUDE_DIR lz4.h PATHS +# ${LZ4_SEARCH_HEADER_PATHS} +# # make sure we don't accidentally pick up a different version +# NO_DEFAULT_PATH +# ) -if (LZ4_FOUND) - if (NOT Lz4_FIND_QUIETLY) - message(STATUS "Found the Lz4 library: ${LZ4_LIB_PATH}") - endif () -else () - if (NOT Lz4_FIND_QUIETLY) - set(LZ4_ERR_MSG "Could not find the Lz4 library. Looked for headers") - set(LZ4_ERR_MSG "${LZ4_ERR_MSG} in ${LZ4_SEARCH_HEADER_PATHS}, and for libs") - set(LZ4_ERR_MSG "${LZ4_ERR_MSG} in ${LZ4_SEARCH_LIB_PATH}") - if (Lz4_FIND_REQUIRED) - message(FATAL_ERROR "${LZ4_ERR_MSG}") - else (Lz4_FIND_REQUIRED) - message(STATUS "${LZ4_ERR_MSG}") - endif (Lz4_FIND_REQUIRED) - endif () -endif () +# find_library(LZ4_LIB_PATH NAMES liblz4.so liblz4.dylib PATHS ${LZ4_SEARCH_LIB_PATH} NO_DEFAULT_PATH) +# find_library(LZ4_STATIC_LIB NAMES liblz4.a PATHS ${LZ4_SEARCH_LIB_PATH} NO_DEFAULT_PATH) -mark_as_advanced( - LZ4_INCLUDE_DIR - LZ4_LIBS - LZ4_STATIC_LIB -) +# message(STATUS "Header ${LZ4_INCLUDE_DIR} LIB ") +# if (LZ4_INCLUDE_DIR AND LZ4_LIB_PATH) +# set(LZ4_FOUND TRUE) +# set(LZ4_LIBS ${LZ4_SEARCH_LIB_PATH}) + +# # mac os is using dylib instead of so for lz4 +# if (APPLE) +# set(LZ4_LIBRARY liblz4.dylib) +# else () +# set(LZ4_LIBRARY ${LZ4_LIB_PATH}) +# endif () +# else () +# set(LZ4_FOUND FALSE) +# endif () + +# if (LZ4_FOUND) +# if (NOT Lz4_FIND_QUIETLY) +# message(STATUS "Found the Lz4 library: ${LZ4_LIB_PATH}") +# endif () +# else () +# if (NOT Lz4_FIND_QUIETLY) +# set(LZ4_ERR_MSG "Could not find the Lz4 library. Looked for headers") +# set(LZ4_ERR_MSG "${LZ4_ERR_MSG} in ${LZ4_SEARCH_HEADER_PATHS}, and for libs") +# set(LZ4_ERR_MSG "${LZ4_ERR_MSG} in ${LZ4_SEARCH_LIB_PATH}") +# if (Lz4_FIND_REQUIRED) +# message(FATAL_ERROR "${LZ4_ERR_MSG}") +# else (Lz4_FIND_REQUIRED) +# message(STATUS "${LZ4_ERR_MSG}") +# endif (Lz4_FIND_REQUIRED) +# endif () +# endif () + +# mark_as_advanced( +# LZ4_INCLUDE_DIR +# LZ4_LIBS +# LZ4_STATIC_LIB +# ) From 86e96fb298c96930fc15c9a3eab074321cc17c42 Mon Sep 17 00:00:00 2001 From: Lennart Niecksch Date: Wed, 6 Nov 2024 11:11:50 +0100 Subject: [PATCH 2/5] misc fixes for newer gcc and cmake in conda. --- CMakeLists.txt | 4 ++-- LVR2Config.cmake.in | 10 ++++++---- src/liblvr2/io/HDF5IO.cpp | 8 ++++---- src/liblvr2/io/descriptions/HDF5Kernel.cpp | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e250eb98b..75dec06b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -696,7 +696,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LVR2Config.cmake install(FILES package.xml DESTINATION share/lvr2) install(FILES - CMakeModules/FindEigen3.cmake + # CMakeModules/FindEigen3.cmake CMakeModules/FindFLANN.cmake CMakeModules/FindLz4.cmake CMakeModules/FindNABO.cmake @@ -729,4 +729,4 @@ if( DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND ) ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM ) -endif( DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND ) \ No newline at end of file +endif( DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND ) diff --git a/LVR2Config.cmake.in b/LVR2Config.cmake.in index baa044f7b..efe3c2c62 100644 --- a/LVR2Config.cmake.in +++ b/LVR2Config.cmake.in @@ -46,10 +46,12 @@ list(APPEND LVR2_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS}) find_package(Eigen3 REQUIRED) list(APPEND LVR2_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR}) -find_package(VTK) -list(APPEND LVR2_INCLUDE_DIRS ${VTK_INCLUDE_DIRS}) -list(APPEND LVR2_DEFINITIONS ${VTK_DEFINTIONS}) - +if(@VTK_FOUND@) + find_package(VTK REQUIRED) + list(APPEND LVR2_INCLUDE_DIRS ${VTK_INCLUDE_DIRS}) + list(APPEND LVR2_DEFINITIONS ${VTK_DEFINITIONS}) +endif() +# # nabo if(@NABO_FOUND@) find_package(NABO REQUIRED) diff --git a/src/liblvr2/io/HDF5IO.cpp b/src/liblvr2/io/HDF5IO.cpp index 0e6b9f623..d0994ede8 100644 --- a/src/liblvr2/io/HDF5IO.cpp +++ b/src/liblvr2/io/HDF5IO.cpp @@ -382,8 +382,8 @@ Texture HDF5IO::getImage(HighFive::Group& g, std::string datasetName) { if (g.exist(datasetName)) { - long long unsigned int width, height, planes; - long long int npals; + hsize_t width, height, planes; + hssize_t npals; char interlace[256]; if (!H5IMis_image(g.getId(), datasetName.c_str())) @@ -699,8 +699,8 @@ void HDF5IO::addImage(HighFive::Group& g, std::string datasetName, cv::Mat& img) void HDF5IO::getImage(HighFive::Group& g, std::string datasetName, cv::Mat& img) { - long long unsigned int w,h,planes; - long long int npals; + hsize_t w,h,planes; + hssize_t npals; char interlace[256]; H5IMget_image_info(g.getId(), datasetName.c_str(), &w, &h, &planes, interlace, &npals); diff --git a/src/liblvr2/io/descriptions/HDF5Kernel.cpp b/src/liblvr2/io/descriptions/HDF5Kernel.cpp index 3accb80d6..bee2ffdcf 100644 --- a/src/liblvr2/io/descriptions/HDF5Kernel.cpp +++ b/src/liblvr2/io/descriptions/HDF5Kernel.cpp @@ -292,8 +292,8 @@ boost::optional HDF5Kernel::loadImage( { if(H5IMis_image(group.getId(), datasetName.c_str())) { - long long unsigned int w, h, planes; - long long int npals; + hsize_t w, h, planes; + hssize_t npals; char interlace[256]; int err = H5IMget_image_info(group.getId(), datasetName.c_str(), &w, &h, &planes, interlace, &npals); From 18e789c4bc3843ca0e0e9ffa67db6ff3fdc83924 Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Wed, 6 Nov 2024 13:23:30 +0100 Subject: [PATCH 3/5] moved all vtk compilations to viewer related parts --- CMakeLists.txt | 186 +++++++------ CMakeModules/FindLz4.cmake | 66 +---- ext/QVTKOpenGLWidget/CMakeLists.txt | 11 +- ext/QVTKOpenGLWidget/QVTKOpenGLNativeWidget.h | 246 ++++++++++++++++++ src/tools/lvr2_viewer/CMakeLists.txt | 23 +- 5 files changed, 387 insertions(+), 145 deletions(-) create mode 100644 ext/QVTKOpenGLWidget/QVTKOpenGLNativeWidget.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 75dec06b5..aadd62baf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,60 +185,6 @@ else(WITH_DRACO) set(draco_FOUND False) endif(WITH_DRACO) -#------------------------------------------------------------------------------ -# Searching for VTK -#------------------------------------------------------------------------------ -if(BUILD_VIEWER) -#------ -# Here I assume VTK is only required for the lvr2_viewer -# - VTK doesnt occur in the core library -#------ - - set(VTK_QT_VERSION 5) - find_package(VTK REQUIRED) - - if(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_EQUAL "8") - # patched QVTKOpenGL header because of name clash with signals. - add_subdirectory(ext/QVTKOpenGLWidget) - include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) - list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${QVTK_PATCHED_INCLUDE_DIR}) - - list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK8) - endif() - - if(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_LESS "6") - list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK5) - endif() - - if(VTK_MAJOR_VERSION VERSION_EQUAL "7") - if(VTK_MINOR_VERSION VERSION_GREATER "0") - list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) - endif() - endif() - - if(VTK_MAJOR_VERSION VERSION_GREATER "7") - list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) - endif() - - if(VTK_VERSION VERSION_GREATER "7") - - list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) - set(VTK_COMPONENTS "${VTK_AVAILABLE_COMPONENTS}") - set(VTK_HAS_QT OFF) - foreach(VTK_COMPONENT ${VTK_COMPONENTS}) - if("${VTK_COMPONENT}" STREQUAL "GUISupportQt") - set(VTK_HAS_QT ON) - endif() - endforeach() - - message(STATUS "VTK > 7 found") - if(VTK_HAS_QT) - message(STATUS "Found VTK compoment QVTK") - endif() - endif() - -endif(BUILD_VIEWER) - #------------------------------------------------------------------------------ # Searching for NABO #------------------------------------------------------------------------------ @@ -506,33 +452,123 @@ endif() install(DIRECTORY include/lvr2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) + ############################################################################### -# VTK use file include. Has to be called after all CUDA code -# was generated and compiled. The VTK definitions corrupt the -# nvcc call +# LVR2 VIEWER CHECKS ############################################################################### +if(BUILD_VIEWER) + + #------ + # Here I assume VTK is only required for the lvr2_viewer + # - VTK doesnt occur in the core library + #------ + + #------------------------------------------------------------------------------ + # Searching for VTK + #------------------------------------------------------------------------------ -if(DEFINED VTK_USE_FILE) + ############################################################################### + # VTK use file include. Has to be called after all CUDA code + # was generated and compiled. The VTK definitions corrupt the + # nvcc call + ############################################################################### + + if(DEFINED VTK_USE_FILE) include(${VTK_USE_FILE}) -endif() + endif() + set(VTK_QT_VERSION 5) + find_package(VTK REQUIRED) + + message(WARNING "USE QVTK PATCH!") + + message(STATUS "Found VTK (${VTK_VERSION})") + + if(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_EQUAL "8") + + message(WARNING "USE QVTK PATCH!") + # patched QVTKOpenGL header because of name clash with signals. + add_subdirectory(ext/QVTKOpenGLWidget) + include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) + list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${QVTK_PATCHED_INCLUDE_DIR}) + list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK8) + + elseif(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_EQUAL "9") + add_subdirectory(ext/QVTKOpenGLWidget) + include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) + list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${QVTK_PATCHED_INCLUDE_DIR}) + list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK9) + endif() + + if(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_LESS "6") + list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK5) + endif() + + + if(VTK_MAJOR_VERSION VERSION_EQUAL "7") + # 7.*.* + message(WARNING "AAA") + + if(VTK_MINOR_VERSION VERSION_GREATER "0") + # 7.>=1.* + + # add_subdirectory(ext/QVTKOpenGLWidget) + # include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) + # list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${QVTK_PATCHED_INCLUDE_DIR}) + # list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) + + foreach(VTK_LIB_TMP ${VTK_LIBRARIES}) + message(STATUS "VTK: ${VTK_LIB_TMP}") + if("${VTK_LIB_TMP}" STREQUAL "GUISupportQt") + + endif() + endforeach() + + set(VTK_COMPONENTS "${VTK_AVAILABLE_COMPONENTS}") + set(VTK_HAS_QT OFF) + foreach(VTK_COMPONENT ${VTK_COMPONENTS}) + if("${VTK_COMPONENT}" STREQUAL "GUISupportQt") + set(VTK_HAS_QT ON) + endif() + endforeach() + + message(STATUS "Found VTK (Version > 7)") + if(VTK_HAS_QT) + message(STATUS "Found VTK compoment QVTK") + else() + message(STATUS) + endif() + endif() + + elseif(VTK_MAJOR_VERSION VERSION_GREATER "7") + list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) + + endif() + + + + + + find_package(Qt5 REQUIRED COMPONENTS Core Widgets Xml OpenGL) + + find_package(QVTK) + if(QVTK_FOUND) + include_directories(${QVTK_INCLUDE_DIR}) + endif(QVTK_FOUND) + + add_subdirectory(src/tools/lvr2_viewer) + + # if(QVTK_FOUND) + # message(STATUS "Found QVTK ${QVTK_INCLUDE_DIR}") + # include_directories(${QVTK_INCLUDE_DIR}) + # add_subdirectory(src/tools/lvr2_viewer) + # elseif(DEFINED VTK_VERSION AND VTK_VERSION VERSION_GREATER "7" AND VTK_HAS_QT) + # message(STATUS "Found QVTK in VTK") + # add_subdirectory(src/tools/lvr2_viewer) + # else() + # message(FATAL_ERROR "QVTK not found: ERROR") + # endif(QVTK_FOUND) -############################################################################### -# LVR2 VIEWER CHECKS -############################################################################### -if(BUILD_VIEWER) - find_package(Qt5 COMPONENTS Core Widgets Xml OpenGL) - if(Qt5_FOUND) - message(STATUS "Found QT5") - find_package(QVTK) - if(QVTK_FOUND) - message(STATUS "Found QVTK ${QVTK_INCLUDE_DIR}") - include_directories(${QVTK_INCLUDE_DIR}) - add_subdirectory(src/tools/lvr2_viewer) - elseif(DEFINED VTK_VERSION AND VTK_VERSION VERSION_GREATER "7" AND VTK_HAS_QT) - add_subdirectory(src/tools/lvr2_viewer) - endif(QVTK_FOUND) - endif(Qt5_FOUND) endif(BUILD_VIEWER) ############################################################################### diff --git a/CMakeModules/FindLz4.cmake b/CMakeModules/FindLz4.cmake index 88455b66a..f7984468c 100644 --- a/CMakeModules/FindLz4.cmake +++ b/CMakeModules/FindLz4.cmake @@ -22,68 +22,4 @@ find_package(PkgConfig REQUIRED) pkg_check_modules(lz4 REQUIRED IMPORTED_TARGET liblz4) -set(LZ4_LIBRARY PkgConfig::lz4) - - - -# set(LZ4_SEARCH_HEADER_PATHS -# ${THIRDPARTY_PREFIX}/include -# /usr/include -# /usr/local/include -# ) - -# set(LZ4_SEARCH_LIB_PATH -# ${THIRDPARTY_PREFIX}/lib -# /usr/local/lib -# /usr/lib/ -# /usr/lib/x86_64-linux-gnu/ -# /usr/lib/aarch64-linux-gnu/ -# /usr/lib/arm-linux-gnueabihf/ -# ) - -# find_path(LZ4_INCLUDE_DIR lz4.h PATHS -# ${LZ4_SEARCH_HEADER_PATHS} -# # make sure we don't accidentally pick up a different version -# NO_DEFAULT_PATH -# ) - -# find_library(LZ4_LIB_PATH NAMES liblz4.so liblz4.dylib PATHS ${LZ4_SEARCH_LIB_PATH} NO_DEFAULT_PATH) -# find_library(LZ4_STATIC_LIB NAMES liblz4.a PATHS ${LZ4_SEARCH_LIB_PATH} NO_DEFAULT_PATH) - -# message(STATUS "Header ${LZ4_INCLUDE_DIR} LIB ") -# if (LZ4_INCLUDE_DIR AND LZ4_LIB_PATH) -# set(LZ4_FOUND TRUE) -# set(LZ4_LIBS ${LZ4_SEARCH_LIB_PATH}) - -# # mac os is using dylib instead of so for lz4 -# if (APPLE) -# set(LZ4_LIBRARY liblz4.dylib) -# else () -# set(LZ4_LIBRARY ${LZ4_LIB_PATH}) -# endif () -# else () -# set(LZ4_FOUND FALSE) -# endif () - -# if (LZ4_FOUND) -# if (NOT Lz4_FIND_QUIETLY) -# message(STATUS "Found the Lz4 library: ${LZ4_LIB_PATH}") -# endif () -# else () -# if (NOT Lz4_FIND_QUIETLY) -# set(LZ4_ERR_MSG "Could not find the Lz4 library. Looked for headers") -# set(LZ4_ERR_MSG "${LZ4_ERR_MSG} in ${LZ4_SEARCH_HEADER_PATHS}, and for libs") -# set(LZ4_ERR_MSG "${LZ4_ERR_MSG} in ${LZ4_SEARCH_LIB_PATH}") -# if (Lz4_FIND_REQUIRED) -# message(FATAL_ERROR "${LZ4_ERR_MSG}") -# else (Lz4_FIND_REQUIRED) -# message(STATUS "${LZ4_ERR_MSG}") -# endif (Lz4_FIND_REQUIRED) -# endif () -# endif () - -# mark_as_advanced( -# LZ4_INCLUDE_DIR -# LZ4_LIBS -# LZ4_STATIC_LIB -# ) +set(LZ4_LIBRARY PkgConfig::lz4) \ No newline at end of file diff --git a/ext/QVTKOpenGLWidget/CMakeLists.txt b/ext/QVTKOpenGLWidget/CMakeLists.txt index 3a37260b6..36d9ac05d 100644 --- a/ext/QVTKOpenGLWidget/CMakeLists.txt +++ b/ext/QVTKOpenGLWidget/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.4) # set include dirs -set(QVTK_PATCHED_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/lvr2/ext/QVTKOpenGLWidget CACHE PATH "install location of nanoflann headers") +set(QVTK_PATCHED_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/lvr2/ext/QVTKOpenGLWidget CACHE PATH "patch directory of QVTKOpenGLWidget header.") find_path(QVTK_PATCHED_INCLUDE_DIR QVTKOpenGLWidget.h PATH .) +find_path(QVTK_PATCHED_INCLUDE_DIR QVTKOpenGLNativeWidget.h PATH .) + mark_as_advanced(QVTK_PATCHED_INCLUDE_DIR QVTK_PATCHED_INSTALL_INCLUDE_DIR) -install(DIRECTORY . DESTINATION ${QVTK_PATCHED_INSTALL_INCLUDE_DIR} - FILES_MATCHING PATTERN "*.hpp") +install(DIRECTORY . + DESTINATION ${QVTK_PATCHED_INSTALL_INCLUDE_DIR} + FILES_MATCHING PATTERN "*.h") diff --git a/ext/QVTKOpenGLWidget/QVTKOpenGLNativeWidget.h b/ext/QVTKOpenGLWidget/QVTKOpenGLNativeWidget.h new file mode 100644 index 000000000..f8f8713d9 --- /dev/null +++ b/ext/QVTKOpenGLWidget/QVTKOpenGLNativeWidget.h @@ -0,0 +1,246 @@ +/*========================================================================= + + Program: Visualization Toolkit + Module: QVTKOpenGLNativeWidget.h + + Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen + All rights reserved. + See Copyright.txt or http://www.kitware.com/Copyright.htm for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/** + * @class QVTKOpenGLNativeWidget + * @brief QOpenGLWidget subclass to house a vtkGenericOpenGLRenderWindow in a Qt + * application. + * + * QVTKOpenGLNativeWidget extends QOpenGLWidget to make it work with a + * vtkGenericOpenGLRenderWindow. + * + * Please note that QVTKOpenGLNativeWidget only works with vtkGenericOpenGLRenderWindow. + * This is necessary since QOpenGLWidget wants to take over the window management as + * well as the OpenGL context creation. Getting that to work reliably with + * vtkXRenderWindow or vtkWin32RenderWindow (and other platform specific + * vtkRenderWindow subclasses) was tricky and fraught with issues. + * + * Since QVTKOpenGLNativeWidget uses QOpenGLWidget to create the OpenGL context, + * it uses QSurfaceFormat (set using `QOpenGLWidget::setFormat` or + * `QSurfaceFormat::setDefaultFormat`) to create appropriate window and context. + * You can use `QVTKOpenGLNativeWidget::copyToFormat` to obtain a QSurfaceFormat + * appropriate for a vtkRenderWindow. + * + * A typical usage for QVTKOpenGLNativeWidget is as follows: + * @code{.cpp} + * + * // before initializing QApplication, set the default surface format. + * QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat()); + * + * vtkNew window; + * QPointer widget = new QVTKOpenGLNativeWidget(...); + * widget->SetRenderWindow(window.Get()); + * + * // If using any of the standard view e.g. vtkContextView, then + * // you can do the following. + * vtkNew view; + * view->SetRenderWindow(window.Get()); + * + * // You can continue to use `window` as a regular vtkRenderWindow + * // including adding renderers, actors etc. + * + * @endcode + * + * @section OpenGLContext OpenGL Context + * + * In QOpenGLWidget (superclass for QVTKOpenGLNativeWidget), all rendering happens in a + * framebuffer object. Thus, care must be taken in the rendering code to never + * directly re-bind the default framebuffer i.e. ID 0. + * + * QVTKOpenGLNativeWidget creates an internal QOpenGLFramebufferObject, independent of the + * one created by superclass, for vtkRenderWindow to do the rendering in. This + * explicit double-buffering is useful in avoiding temporary back-buffer only + * renders done in VTK (e.g. when making selections) from destroying the results + * composed on screen. + * + * @section RenderAndPaint Handling Render and Paint. + * + * QWidget subclasses (including `QOpenGLWidget` and `QVTKOpenGLNativeWidget`) display + * their contents on the screen in `QWidget::paint` in response to a paint event. + * `QOpenGLWidget` subclasses are expected to do OpenGL rendering in + * `QOpenGLWidget::paintGL`. QWidget can receive paint events for various + * reasons including widget getting focus/losing focus, some other widget on + * the UI e.g. QProgressBar in status bar updating, etc. + * + * In VTK applications, any time the vtkRenderWindow needs to be updated to + * render a new result, one call `vtkRenderWindow::Render` on it. + * vtkRenderWindowInteractor set on the render window ensures that as + * interactions happen that affect the rendered result, it calls `Render` on the + * render window. + * + * Since paint in Qt can be called more often then needed, we avoid potentially + * expensive `vtkRenderWindow::Render` calls each time that happens. Instead, + * QVTKOpenGLNativeWidget relies on the VTK application calling + * `vtkRenderWindow::Render` on the render window when it needs to update the + * rendering. `paintGL` simply passes on the result rendered by the most render + * vtkRenderWindow::Render to Qt windowing system for composing on-screen. + * + * There may still be occasions when we may have to render in `paint` for + * example if the window was resized or Qt had to recreate the OpenGL context. + * In those cases, `QVTKOpenGLNativeWidget::paintGL` can request a render by calling + * `QVTKOpenGLNativeWidget::renderVTK`. + * + * @section Caveats + * QVTKOpenGLNativeWidget does not support stereo, + * please use QVTKOpenGLStereoWidget if you need support for stereo rendering + * + * QVTKOpenGLNativeWidget is targeted for Qt version 5.5 and above. + * + * @sa QVTKOpenGLStereoWidget QVTKRenderWidget + * + */ +#ifndef QVTKOpenGLNativeWidget_h +#define QVTKOpenGLNativeWidget_h + +#include +#include // for QScopedPointer. + +#include "QVTKInteractor.h" // needed for QVTKInteractor +#include "vtkGUISupportQtModule.h" // for export macro +#include "vtkNew.h" // needed for vtkNew +#include "vtkSmartPointer.h" // needed for vtkSmartPointer + +class QVTKInteractor; +class QVTKInteractorAdapter; +class QVTKRenderWindowAdapter; +class vtkGenericOpenGLRenderWindow; + +class VTKGUISUPPORTQT_EXPORT QVTKOpenGLNativeWidget : public QOpenGLWidget +{ + Q_OBJECT + typedef QOpenGLWidget Superclass; + +public: + QVTKOpenGLNativeWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); + QVTKOpenGLNativeWidget(vtkGenericOpenGLRenderWindow* window, QWidget* parent = nullptr, + Qt::WindowFlags f = Qt::WindowFlags()); + ~QVTKOpenGLNativeWidget() override; + + //@{ + /** + * Set a render window to use. It a render window was already set, it will be + * finalized and all of its OpenGL resource released. If the \c win is + * non-null and it has no interactor set, then a QVTKInteractor instance will + * be created as set on the render window as the interactor. + */ + void setRenderWindow(vtkGenericOpenGLRenderWindow* win); + void setRenderWindow(vtkRenderWindow* win); + //@} + + /** + * Returns the render window that is being shown in this widget. + */ + vtkRenderWindow* renderWindow() const; + + /** + * Get the QVTKInteractor that was either created by default or set by the user. + */ + QVTKInteractor* interactor() const; + + /** + * @copydoc QVTKRenderWindowAdapter::defaultFormat(bool) + */ + static QSurfaceFormat defaultFormat(bool stereo_capable = false); + + //@{ + /** + * Enable or disable support for HiDPI displays. When enabled, this enabled + * DPI scaling i.e. `vtkWindow::SetDPI` will be called with a DPI value scaled + * by the device pixel ratio every time the widget is resized. The unscaled + * DPI value can be specified by using `setUnscaledDPI`. + */ + void setEnableHiDPI(bool enable); + bool enableHiDPI() const { return this->EnableHiDPI; } + //@} + + //@{ + /** + * Set/Get unscaled DPI value. Defaults to 72, which is also the default value + * in vtkWindow. + */ + void setUnscaledDPI(int); + int unscaledDPI() const { return this->UnscaledDPI; } + //@} + + //@{ + /** + * Set/get the default cursor to use for this widget. + */ + void setDefaultCursor(const QCursor& cursor); + const QCursor& defaultCursor() const { return this->DefaultCursor; } + //@} + + //@{ + /** + * @deprecated in VTK 9.0 + */ + VTK_LEGACY(void SetRenderWindow(vtkGenericOpenGLRenderWindow* win)); + VTK_LEGACY(void SetRenderWindow(vtkRenderWindow* win)); + //@} + + //@{ + /** + * These methods have be deprecated to fix naming style. Since + * QVTKOpenGLNativeWidget is QObject subclass, we follow Qt naming conventions + * rather than VTK's. + */ + VTK_LEGACY(vtkRenderWindow* GetRenderWindow()); + VTK_LEGACY(QVTKInteractor* GetInteractor()); + //@} + + /** + * @deprecated in VTK 9.0 + * QVTKInteractorAdapter is an internal helper. Hence the API was removed. + */ + VTK_LEGACY(QVTKInteractorAdapter* GetInteractorAdapter()); + + /** + * @deprecated in VTK 9.0. Simply use `QWidget::setCursor` API to change + * cursor. + */ + VTK_LEGACY(void setQVTKCursor(const QCursor& cursor)); + + /** + * @deprecated in VTK 9.0. Use `setDefaultCursor` instead. + */ + VTK_LEGACY(void setDefaultQVTKCursor(const QCursor& cursor)); + +protected Q_SLOTS: + /** + * Called as a response to `QOpenGLContext::aboutToBeDestroyed`. This may be + * called anytime during the widget lifecycle. We need to release any OpenGL + * resources allocated in VTK work in this method. + */ + virtual void cleanupContext(); + + void updateSize(); + +protected: + bool event(QEvent* evt) override; + void initializeGL() override; + void paintGL() override; + +protected: + vtkSmartPointer RenderWindow; + QScopedPointer RenderWindowAdapter; + +private: + Q_DISABLE_COPY(QVTKOpenGLNativeWidget); + + bool EnableHiDPI; + int UnscaledDPI; + QCursor DefaultCursor; +}; + +#endif diff --git a/src/tools/lvr2_viewer/CMakeLists.txt b/src/tools/lvr2_viewer/CMakeLists.txt index 945e45dcb..b059f6826 100644 --- a/src/tools/lvr2_viewer/CMakeLists.txt +++ b/src/tools/lvr2_viewer/CMakeLists.txt @@ -190,7 +190,23 @@ add_executable(lvr2_viewer ${LVR2_VIEWER_RES} ${LVR2_VIEWER_MOCS} ${LVR2_VIEWER_UI_HDRS}) -target_link_libraries(lvr2_viewer ${LVR2_VIEWER_DEPENDENCIES}) + +target_link_libraries(lvr2_viewer + ${LVR2_VIEWER_DEPENDENCIES} + # VTK::GUISupportQt + ${VTK_LIBRARIES} + ) + +target_include_directories(lvr2_viewer PUBLIC ${VTK_INCLUDE_DIRS}) + +target_include_directories(lvr2_viewer PUBLIC + $ + $ # /ext/QVTKOpenGLWidget +) + +# target_compile_definitions(lvr2_viewer ${VTK_DEFINITIONS}) + +message(WARNING "QVTK: ${QVTK_LIBRARY}, ${VTK_}" ) if(CUDA_FOUND) target_link_libraries(lvr2_viewer lvr2cuda) @@ -202,3 +218,8 @@ endif() install(TARGETS lvr2_viewer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + + + + # vtkChartsCore;vtkCommonColor;vtkCommonCore;vtksys;vtkCommonDataModel;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonExecutionModel;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersCore;vtkInfovisCore;vtkFiltersExtraction;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;/usr/lib/x86_64-linux-gnu/libfreetype.so;/usr/lib/x86_64-linux-gnu/libz.so;vtkDICOMParser;vtkDomainsChemistry;vtkIOLegacy;vtkIOCore;vtkIOXMLParser;/usr/lib/x86_64-linux-gnu/libexpat.so;vtkDomainsChemistryOpenGL2;vtkRenderingOpenGL2;vtkIOImage;vtkmetaio;/usr/lib/x86_64-linux-gnu/libjpeg.so;/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libtiff.so;vtkFiltersAMR;vtkIOXML;vtkParallelCore;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkFiltersHybrid;vtkImagingSources;vtkFiltersHyperTree;vtkFiltersImaging;vtkImagingGeneral;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelDIY2;vtkParallelMPI;vtkFiltersParallelFlowPaths;vtkFiltersParallelGeometry;vtkFiltersParallelImaging;vtkFiltersParallelMPI;vtkFiltersParallelStatistics;vtkFiltersPoints;vtkFiltersProgrammable;vtkFiltersPython;/usr/lib/x86_64-linux-gnu/libpython3.8.so;vtkWrappingPythonCore;vtkWrappingTools;vtkFiltersReebGraph;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersVerdict;verdict;vtkGUISupportQt;vtkInteractionStyle;vtkGUISupportQtSQL;vtkIOSQL;sqlite3;vtkGeovisCore;vtkInfovisLayout;vtkImagingHybrid;vtkInteractionWidgets;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkViewsCore;vtkproj4;vtkIOAMR;/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so;/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so;vtkIOEnSight;vtkIOExodus;vtkexoIIc;/usr/lib/x86_64-linux-gnu/libnetcdf_c++.so;/usr/lib/x86_64-linux-gnu/libnetcdf.so;vtkIOExport;vtkRenderingGL2PSOpenGL2;/usr/lib/x86_64-linux-gnu/libgl2ps.so;vtkIOFFMPEG;vtkIOMovie;/usr/lib/x86_64-linux-gnu/libtheoraenc.so;/usr/lib/x86_64-linux-gnu/libtheoradec.so;/usr/lib/x86_64-linux-gnu/libogg.so;vtkIOGDAL;vtkIOGeoJSON;/usr/lib/x86_64-linux-gnu/libjsoncpp.so;vtkIOGeometry;vtkIOImport;vtkIOInfovis;/usr/lib/x86_64-linux-gnu/libxml2.so;vtkIOLSDyna;vtkIOMINC;vtkIOMPIImage;vtkIOMPIParallel;vtkIOParallel;vtkIONetCDF;vtkIOMySQL;vtkIOODBC;vtkIOPLY;vtkIOParallelExodus;vtkIOParallelLSDyna;vtkIOParallelNetCDF;vtkIOParallelXML;vtkIOPostgreSQL;vtkIOTecplotTable;vtkIOVPIC;VPIC;vtkIOVideo;vtkIOXdmf2;vtkxdmf2;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInfovisBoostGraphAlgorithms;vtkInteractionImage;vtkLocalExample;vtkParallelMPI4Py;vtkPythonInterpreter;vtkRenderingContextOpenGL2;vtkRenderingExternal;vtkRenderingFreeTypeFontConfig;vtkRenderingImage;vtkRenderingLICOpenGL2;vtkRenderingLOD;vtkRenderingLabel;vtkRenderingMatplotlib;vtkRenderingParallel;vtkRenderingParallelLIC;vtkRenderingSceneGraph;vtkRenderingVolumeAMR;vtkRenderingVolumeOpenGL2;vtkTestingGenericBridge;vtkTestingIOSQL;vtkTestingRendering;vtkViewsContext2D;vtkViewsGeovis;vtkViewsInfovis;vtkWrappingJava From e1988909d3f51093fc694fb0ebed58d8cbea4536 Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Wed, 6 Nov 2024 13:38:54 +0100 Subject: [PATCH 4/5] cleanup --- CMakeLists.txt | 17 ++++++++++------- src/tools/lvr2_viewer/CMakeLists.txt | 14 -------------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aadd62baf..27f89c507 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -512,18 +512,22 @@ if(BUILD_VIEWER) if(VTK_MINOR_VERSION VERSION_GREATER "0") # 7.>=1.* + # Alex: This didn't work on my ubuntu 20 and vtk 7.1.1. Couldn't found QVTKOpenGL header. + # After using the patches of ext/QVTK.. it turned out even the VTK libraries didn't contain any implementation + # TODO: fix this + # add_subdirectory(ext/QVTKOpenGLWidget) # include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) # list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${QVTK_PATCHED_INCLUDE_DIR}) # list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) - foreach(VTK_LIB_TMP ${VTK_LIBRARIES}) - message(STATUS "VTK: ${VTK_LIB_TMP}") - if("${VTK_LIB_TMP}" STREQUAL "GUISupportQt") - - endif() - endforeach() + # foreach(VTK_LIB_TMP ${VTK_LIBRARIES}) + # message(STATUS "VTK: ${VTK_LIB_TMP}") + # if("${VTK_LIB_TMP}" STREQUAL "GUISupportQt") + # endif() + # endforeach() + set(VTK_COMPONENTS "${VTK_AVAILABLE_COMPONENTS}") set(VTK_HAS_QT OFF) foreach(VTK_COMPONENT ${VTK_COMPONENTS}) @@ -542,7 +546,6 @@ if(BUILD_VIEWER) elseif(VTK_MAJOR_VERSION VERSION_GREATER "7") list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) - endif() diff --git a/src/tools/lvr2_viewer/CMakeLists.txt b/src/tools/lvr2_viewer/CMakeLists.txt index b059f6826..269ff6e05 100644 --- a/src/tools/lvr2_viewer/CMakeLists.txt +++ b/src/tools/lvr2_viewer/CMakeLists.txt @@ -193,20 +193,11 @@ add_executable(lvr2_viewer target_link_libraries(lvr2_viewer ${LVR2_VIEWER_DEPENDENCIES} - # VTK::GUISupportQt ${VTK_LIBRARIES} ) target_include_directories(lvr2_viewer PUBLIC ${VTK_INCLUDE_DIRS}) -target_include_directories(lvr2_viewer PUBLIC - $ - $ # /ext/QVTKOpenGLWidget -) - -# target_compile_definitions(lvr2_viewer ${VTK_DEFINITIONS}) - -message(WARNING "QVTK: ${QVTK_LIBRARY}, ${VTK_}" ) if(CUDA_FOUND) target_link_libraries(lvr2_viewer lvr2cuda) @@ -218,8 +209,3 @@ endif() install(TARGETS lvr2_viewer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - - - - - # vtkChartsCore;vtkCommonColor;vtkCommonCore;vtksys;vtkCommonDataModel;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonExecutionModel;vtkFiltersGeneral;vtkCommonComputationalGeometry;vtkFiltersCore;vtkInfovisCore;vtkFiltersExtraction;vtkFiltersStatistics;vtkImagingFourier;vtkImagingCore;vtkalglib;vtkRenderingContext2D;vtkRenderingCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingFreeType;/usr/lib/x86_64-linux-gnu/libfreetype.so;/usr/lib/x86_64-linux-gnu/libz.so;vtkDICOMParser;vtkDomainsChemistry;vtkIOLegacy;vtkIOCore;vtkIOXMLParser;/usr/lib/x86_64-linux-gnu/libexpat.so;vtkDomainsChemistryOpenGL2;vtkRenderingOpenGL2;vtkIOImage;vtkmetaio;/usr/lib/x86_64-linux-gnu/libjpeg.so;/usr/lib/x86_64-linux-gnu/libpng.so;/usr/lib/x86_64-linux-gnu/libtiff.so;vtkFiltersAMR;vtkIOXML;vtkParallelCore;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkFiltersHybrid;vtkImagingSources;vtkFiltersHyperTree;vtkFiltersImaging;vtkImagingGeneral;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelDIY2;vtkParallelMPI;vtkFiltersParallelFlowPaths;vtkFiltersParallelGeometry;vtkFiltersParallelImaging;vtkFiltersParallelMPI;vtkFiltersParallelStatistics;vtkFiltersPoints;vtkFiltersProgrammable;vtkFiltersPython;/usr/lib/x86_64-linux-gnu/libpython3.8.so;vtkWrappingPythonCore;vtkWrappingTools;vtkFiltersReebGraph;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersVerdict;verdict;vtkGUISupportQt;vtkInteractionStyle;vtkGUISupportQtSQL;vtkIOSQL;sqlite3;vtkGeovisCore;vtkInfovisLayout;vtkImagingHybrid;vtkInteractionWidgets;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkViewsCore;vtkproj4;vtkIOAMR;/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi.so;/usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so;/usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.so;vtkIOEnSight;vtkIOExodus;vtkexoIIc;/usr/lib/x86_64-linux-gnu/libnetcdf_c++.so;/usr/lib/x86_64-linux-gnu/libnetcdf.so;vtkIOExport;vtkRenderingGL2PSOpenGL2;/usr/lib/x86_64-linux-gnu/libgl2ps.so;vtkIOFFMPEG;vtkIOMovie;/usr/lib/x86_64-linux-gnu/libtheoraenc.so;/usr/lib/x86_64-linux-gnu/libtheoradec.so;/usr/lib/x86_64-linux-gnu/libogg.so;vtkIOGDAL;vtkIOGeoJSON;/usr/lib/x86_64-linux-gnu/libjsoncpp.so;vtkIOGeometry;vtkIOImport;vtkIOInfovis;/usr/lib/x86_64-linux-gnu/libxml2.so;vtkIOLSDyna;vtkIOMINC;vtkIOMPIImage;vtkIOMPIParallel;vtkIOParallel;vtkIONetCDF;vtkIOMySQL;vtkIOODBC;vtkIOPLY;vtkIOParallelExodus;vtkIOParallelLSDyna;vtkIOParallelNetCDF;vtkIOParallelXML;vtkIOPostgreSQL;vtkIOTecplotTable;vtkIOVPIC;VPIC;vtkIOVideo;vtkIOXdmf2;vtkxdmf2;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInfovisBoostGraphAlgorithms;vtkInteractionImage;vtkLocalExample;vtkParallelMPI4Py;vtkPythonInterpreter;vtkRenderingContextOpenGL2;vtkRenderingExternal;vtkRenderingFreeTypeFontConfig;vtkRenderingImage;vtkRenderingLICOpenGL2;vtkRenderingLOD;vtkRenderingLabel;vtkRenderingMatplotlib;vtkRenderingParallel;vtkRenderingParallelLIC;vtkRenderingSceneGraph;vtkRenderingVolumeAMR;vtkRenderingVolumeOpenGL2;vtkTestingGenericBridge;vtkTestingIOSQL;vtkTestingRendering;vtkViewsContext2D;vtkViewsGeovis;vtkViewsInfovis;vtkWrappingJava From 8d218e6bffde3386c5bd436dca4b3b8f56eb009b Mon Sep 17 00:00:00 2001 From: Alexander Mock Date: Wed, 6 Nov 2024 14:04:34 +0100 Subject: [PATCH 5/5] cleanup2 --- CMakeLists.txt | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27f89c507..3eef489ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -457,12 +457,20 @@ list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_IN # LVR2 VIEWER CHECKS ############################################################################### if(BUILD_VIEWER) - #------ - # Here I assume VTK is only required for the lvr2_viewer + # Here I assume VTK and Qt is only required for the lvr2_viewer # - VTK doesnt occur in the core library #------ + find_package(Qt5 REQUIRED COMPONENTS Core Widgets Xml OpenGL) + + if(DEFINED VTK_USE_FILE) + include(${VTK_USE_FILE}) + endif() + + set(VTK_QT_VERSION 5) + find_package(VTK REQUIRED) + #------------------------------------------------------------------------------ # Searching for VTK #------------------------------------------------------------------------------ @@ -473,20 +481,12 @@ if(BUILD_VIEWER) # nvcc call ############################################################################### - if(DEFINED VTK_USE_FILE) - include(${VTK_USE_FILE}) - endif() - - set(VTK_QT_VERSION 5) - find_package(VTK REQUIRED) - - message(WARNING "USE QVTK PATCH!") + message(STATUS "Found VTK (${VTK_VERSION})") if(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_EQUAL "8") - - message(WARNING "USE QVTK PATCH!") + # 8.*.* # patched QVTKOpenGL header because of name clash with signals. add_subdirectory(ext/QVTKOpenGLWidget) include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) @@ -494,6 +494,7 @@ if(BUILD_VIEWER) list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK8) elseif(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_EQUAL "9") + # 9.*.* add_subdirectory(ext/QVTKOpenGLWidget) include_directories(BEFORE ${QVTK_PATCHED_INCLUDE_DIR} ) list(APPEND LVR2_INSTALL_INCLUDE_DIRS ${QVTK_PATCHED_INCLUDE_DIR}) @@ -507,7 +508,6 @@ if(BUILD_VIEWER) if(VTK_MAJOR_VERSION VERSION_EQUAL "7") # 7.*.* - message(WARNING "AAA") if(VTK_MINOR_VERSION VERSION_GREATER "0") # 7.>=1.* @@ -548,12 +548,8 @@ if(BUILD_VIEWER) list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1) endif() - - - find_package(Qt5 REQUIRED COMPONENTS Core Widgets Xml OpenGL) - find_package(QVTK) if(QVTK_FOUND) include_directories(${QVTK_INCLUDE_DIR})