Skip to content

Commit

Permalink
Merge pull request #16 from naturerobots/humble
Browse files Browse the repository at this point in the history
Ubuntu 22 + ROS2 humble
  • Loading branch information
amock authored Jan 22, 2024
2 parents 9bb03a3 + c5db059 commit c848c2e
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 159 deletions.
230 changes: 127 additions & 103 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ project(LAS_VEGAS VERSION 2)

# OPTIONS
option(BUILD_EXAMPLES "Build the examples" OFF)
option(BUILD_VIEWER "Build lvr2_viewer" OFF)
option(BUILD_TOOLS "Build tools including lvr2_reconstruct" ON)
option(BUILD_TOOLS_EXPERIMENTAL "Build experimental tools" OFF)
option(WITH_DRACO "Build libraries with draco enabled" OFF)

set_property(GLOBAL PROPERTY USE_FOLDERS On)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)


set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include(GNUInstallDirs)



set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand Down Expand Up @@ -54,9 +61,6 @@ if(MSVC)
list(APPEND LVR2_DEFINITIONS -DNOMINMAX)
else(MSVC)
add_compile_options(-fmessage-length=0 -fPIC -Wno-deprecated)
# with cmake 3.3
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++1z>)
set(CMAKE_CXX_STANDARD 17)
endif(MSVC)

###############################################################################
Expand Down Expand Up @@ -86,7 +90,7 @@ endif(GDAL_FOUND)
#------------------------------------------------------------------------------
option(WITH_CUDA "Compile with CUDA support" ON)
if(NOT APPLE AND WITH_CUDA)
find_package( CUDA 8)
find_package( CUDA )
if(CUDA_FOUND)
message(STATUS "Found CUDA")
include_directories(${CUDA_INCLUDE_DIRS})
Expand Down Expand Up @@ -160,63 +164,75 @@ endif()
#------------------------------------------------------------------------------
# Searching for Draco
#------------------------------------------------------------------------------
if(WITH_DRACO)
find_package(Draco)
if(draco_FOUND)
message(STATUS "Found Draco")
include_directories(${draco_INCLUDE_DIRS})
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_DRACO)
endif(draco_FOUND)
else(WITH_DRACO)
set(draco_FOUND False)
endif(WITH_DRACO)

#------------------------------------------------------------------------------
# Searching for VTK
#------------------------------------------------------------------------------
set(VTK_QT_VERSION 5)
find_package(VTK REQUIRED)
if(BUILD_VIEWER)
#------
# Here I assume VTK is only required for the lvr2_viewer
# - VTK doesnt occur in the core library
#------

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})
set(VTK_QT_VERSION 5)
find_package(VTK REQUIRED)

list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK8)
endif()
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})

if(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_LESS "6")
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK5)
endif()
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK8)
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(DEFINED VTK_MAJOR_VERSION AND VTK_MAJOR_VERSION VERSION_LESS "6")
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK5)
endif()

if(VTK_MAJOR_VERSION VERSION_GREATER "7")
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1)
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_VERSION VERSION_GREATER "7")
if(VTK_MAJOR_VERSION VERSION_GREATER "7")
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_VTK_GE_7_1)
endif()

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()
if(VTK_VERSION VERSION_GREATER "7")

message(STATUS "VTK > 7 found")
if(VTK_HAS_QT)
message(STATUS "Found VTK compoment QVTK")
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()

endif(BUILD_VIEWER)

#------------------------------------------------------------------------------
# Searching for NABO
#------------------------------------------------------------------------------
find_package(Nabo)
find_package(NABO)
if(NABO_FOUND)
include_directories(${NABO_INCLUDE_DIRS})
list(APPEND LVR2_DEFINITIONS -DLVR2_USE_NABO)
Expand Down Expand Up @@ -426,17 +442,19 @@ option(WITH_KINFU "Compile LVR Kinfu" OFF)
# compatible to gcc4.8. Older CUDA versions require GCC lower
# than 4.8
###############################################################################
if(CUDA_FOUND AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU"
AND CUDA_VERSION VERSION_GREATER 8
AND CUDA_VERSION VERSION_LESS 10)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5 )
message(STATUS "******************************************************************")
message(STATUS "* Your gcc version needs to be lower than 6 to compile the LVR *")
message(STATUS "* CUDA library and apps with CUDA. Setting CUDA_HOST_COMPILER to *")
message(STATUS "* g++-6*. Please ensure that g++ 6 is installed on your system. *")
message(STATUS "******************************************************************")
set(CUDA_HOST_COMPILER "g++-6" CACHE STRING "" FORCE)
endif()
if(CUDA_FOUND)
include(max_cuda_gcc_version)
max_cuda_gcc_version(CUDA_VERSION MAX_CUDA_GCC_VERSION)
message(STATUS "Highest supported GCC version for CUDA: ${MAX_CUDA_GCC_VERSION}")

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER ${MAX_CUDA_GCC_VERSION})
message(STATUS "******************************************************************")
message(STATUS "* Your gcc version needs to be lower than or equal ${MAX_CUDA_GCC_VERSION} to compile *")
message(STATUS "* the CUDA library and apps. Setting CUDA_HOST_COMPILER to *")
message(STATUS "* g++-${MAX_CUDA_GCC_VERSION}. Please ensure that g++-${MAX_CUDA_GCC_VERSION} is installed on your system. *")
message(STATUS "******************************************************************")
set(CUDA_HOST_COMPILER "g++-${MAX_CUDA_GCC_VERSION}" CACHE STRING "" FORCE)
endif()
endif()

if(CUDA_FOUND AND "${OpenCV_VERSION_PATCH}" VERSION_GREATER "8" AND WITH_KINFU)
Expand Down Expand Up @@ -472,12 +490,9 @@ endif()
###############################################################################
# HEADERS
###############################################################################

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
Expand All @@ -492,19 +507,20 @@ endif()
###############################################################################
# LVR2 VIEWER CHECKS
###############################################################################

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)
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)

###############################################################################
# LVR2 ASCII VIEWER CHECKS
Expand Down Expand Up @@ -584,45 +600,51 @@ add_subdirectory(src/liblvr2)
# BINARIES
###############################################################################

add_subdirectory(src/tools/lvr2_reconstruct)
add_subdirectory(src/tools/lvr2_dmc_reconstruction)
add_subdirectory(src/tools/lvr2_gs_reconstruction)
add_subdirectory(src/tools/lvr2_largescale_reconstruct)
add_subdirectory(src/tools/lvr2_asciiconverter)
add_subdirectory(src/tools/lvr2_transform)
add_subdirectory(src/tools/lvr2_kaboom)
add_subdirectory(src/tools/lvr2_octree_test)
add_subdirectory(src/tools/lvr2_image_normals)
add_subdirectory(src/tools/lvr2_plymerger)
# add_subdirectory(src/tools/lvr2_hdf5_builder)
add_subdirectory(src/tools/lvr2_hdf5_builder_2)
add_subdirectory(src/tools/lvr2_hdf5_mesh_builder)
add_subdirectory(src/tools/lvr2_slam2hdf5)
add_subdirectory(src/tools/lvr2_hdf5togeotiff)
add_subdirectory(src/tools/lvr2_slam6d_merger)
add_subdirectory(src/tools/lvr2_chunking)
add_subdirectory(src/tools/lvr2_registration)
add_subdirectory(src/tools/lvr2_mesh_reducer)
add_subdirectory(src/tools/lvr2_chunking_server)
add_subdirectory(src/tools/lvr2_scanproject_parser)

if(CURSES_FOUND AND embree_FOUND)
add_subdirectory(src/tools/lvr2_ascii_viewer)
endif()
if(BUILD_TOOLS)
add_subdirectory(src/tools/lvr2_reconstruct)
add_subdirectory(src/tools/lvr2_mesh_reducer)
endif(BUILD_TOOLS)

if(BUILD_TOOLS_EXPERIMENTAL)
add_subdirectory(src/tools/lvr2_dmc_reconstruction)
add_subdirectory(src/tools/lvr2_gs_reconstruction)
add_subdirectory(src/tools/lvr2_largescale_reconstruct)
add_subdirectory(src/tools/lvr2_asciiconverter)
add_subdirectory(src/tools/lvr2_transform)
add_subdirectory(src/tools/lvr2_kaboom)
add_subdirectory(src/tools/lvr2_octree_test)
add_subdirectory(src/tools/lvr2_image_normals)
add_subdirectory(src/tools/lvr2_plymerger)
# add_subdirectory(src/tools/lvr2_hdf5_builder)
add_subdirectory(src/tools/lvr2_hdf5_builder_2)
add_subdirectory(src/tools/lvr2_hdf5_mesh_builder)
add_subdirectory(src/tools/lvr2_slam2hdf5)
add_subdirectory(src/tools/lvr2_hdf5togeotiff)
add_subdirectory(src/tools/lvr2_slam6d_merger)
add_subdirectory(src/tools/lvr2_chunking)
add_subdirectory(src/tools/lvr2_registration)
add_subdirectory(src/tools/lvr2_chunking_server)
add_subdirectory(src/tools/lvr2_scanproject_parser)

if(CURSES_FOUND AND embree_FOUND)
add_subdirectory(src/tools/lvr2_ascii_viewer)
endif()

if (RiVLib_FOUND)
#add_subdirectory(src/tools/lvr2_riegl_project_converter)
endif()
if (RiVLib_FOUND)
#add_subdirectory(src/tools/lvr2_riegl_project_converter)
endif()

if(CUDA_FOUND)
# cuda_include_directories(ext/CTPL)
add_subdirectory(src/tools/lvr2_cuda_normals)
endif()
if(CUDA_FOUND)
# cuda_include_directories(ext/CTPL)
add_subdirectory(src/tools/lvr2_cuda_normals)
endif()

if(OPENCL_FOUND)
add_subdirectory(src/tools/lvr2_cl_normals)
add_subdirectory(src/tools/lvr2_cl_sor)
endif()
if(OPENCL_FOUND)
add_subdirectory(src/tools/lvr2_cl_normals)
add_subdirectory(src/tools/lvr2_cl_sor)
endif()

endif(BUILD_TOOLS_EXPERIMENTAL)

if(BUILD_EXAMPLES)
add_subdirectory(examples)
Expand All @@ -635,7 +657,7 @@ endif()

include(CMakePackageConfigHelpers)
set(INCLUDE_INSTALL_DIR include/)
set(LIB_INSTALL_DIR lib/)
set(LIB_INSTALL_DIR lib)
set(SYSCONFIG_INSTALL_DIR etc/lvr2/)

install(EXPORT lvr2Targets
Expand Down Expand Up @@ -664,7 +686,7 @@ install(FILES
CMakeModules/FindEigen3.cmake
CMakeModules/FindFLANN.cmake
CMakeModules/FindLz4.cmake
CMakeModules/FindNabo.cmake
CMakeModules/FindNABO.cmake
CMakeModules/FindOpenNI.cmake
CMakeModules/FindOpenNI2.cmake
CMakeModules/FindQVTK.cmake
Expand Down Expand Up @@ -695,3 +717,5 @@ if( DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND )
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM )
endif( DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND )


4 changes: 2 additions & 2 deletions CMakeModules/FindLz4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ find_path(LZ4_INCLUDE_DIR lz4.h PATHS
)

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})
set(LZ4_STATIC_LIB ${LZ4__LIB_PATH}/liblz4.a)

# mac os is using dylib instead of so for lz4
if (APPLE)
set(LZ4_LIBRARY liblz4.dylib)
else ()
set(LZ4_LIBRARY liblz4.so)
set(LZ4_LIBRARY ${LZ4_LIB_PATH})
endif ()
else ()
set(LZ4_FOUND FALSE)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion CMakeModules/FindQVTK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

find_package(VTK)

find_path (QVTK_INCLUDE_DIR QVTKWidget.h HINT ${VTK_INCLUDE_DIRS})
find_path (QVTK_INCLUDE_DIR QVTKOpenGLWidget.h HINT ${VTK_INCLUDE_DIRS})

if(VTK_MAJOR_VERSION VERSION_LESS "6")
find_library (QVTK_LIBRARY QVTK HINTS ${VTK_DIR} ${VTK_DIR}/bin
Expand Down
Loading

0 comments on commit c848c2e

Please sign in to comment.