11cmake_minimum_required (VERSION 3.16)
2- project (lvr2 VERSION 25.2.0 )
2+ project (lvr2 VERSION 25.2.1 )
33
44# OPTIONS
5- option (BUILD_EXAMPLES "Build the examples" OFF )
6- option (BUILD_VIEWER "Build lvr2_viewer" OFF )
7- option (BUILD_TOOLS "Build tools including lvr2_reconstruct" ON )
8- option (BUILD_TOOLS_EXPERIMENTAL "Build experimental tools" OFF )
9- option (WITH_KINFU "Compile LVR Kinfu" OFF )
10- option (WITH_3DTILES "Compile with 3DTiles support" OFF )
11-
5+ option (LVR2_BUILD_EXAMPLES "Build the examples" OFF )
6+ option (LVR2_BUILD_VIEWER "Build lvr2_viewer" OFF )
7+ option (LVR2_BUILD_TOOLS "Build tools including lvr2_reconstruct" ON )
8+ option (LVR2_BUILD_TOOLS_EXPERIMENTAL "Build experimental tools" OFF )
9+ option (LVR2_WITH_KINFU "Compile LVR Kinfu" OFF )
10+ option (LVR2_WITH_3DTILES "Compile with 3DTiles support" OFF )
11+ option (LVR2_WITH_CUDA "Compile with CUDA support, if available" ON )
12+ option (LVR2_WITH_OPENCL "Compile with OpenCL support, if available" ON )
13+ option (LVR2_WITH_PCL "Compile with PCL support" OFF )
14+ option (LVR2_WITH_FREENECT "Compile with libfreenect grabber" OFF )
15+ option (LVR2_WITH_CV_NONFREE "Use OpenCV non-free descriptors" OFF )
1216
1317## Compile as C++17
1418set (CMAKE_CXX_STANDARD 17)
@@ -114,8 +118,6 @@ else(MSVC)
114118 set (CMAKE_CXX_STANDARD 17)
115119endif (MSVC )
116120
117-
118-
119121find_package (MPI)
120122if (MPI_FOUND)
121123 message (STATUS "Found MPI" )
@@ -161,12 +163,10 @@ else()
161163endif ()
162164include_directories ( ${OpenCV_INCLUDE_DIRS} )
163165
164- option (WITH_CV_NONFREE "Use OpenCV non-free descriptors" OFF )
165- if (WITH_CV_NONFREE)
166+ if (LVR2_WITH_CV_NONFREE)
166167 message (STATUS "Using OpenCV non-free module" )
167168 list (APPEND LVR2_DEFINITIONS -DLVR2_USE_CV_NONFREE)
168- endif (WITH_CV_NONFREE)
169-
169+ endif (LVR2_WITH_CV_NONFREE)
170170#------------------------------------------------------------------------------
171171# Searching for FLANN
172172#------------------------------------------------------------------------------
@@ -267,20 +267,18 @@ endif(GLUT_FOUND)
267267#------------------------------------------------------------------------------
268268# Searching for CUDA
269269#------------------------------------------------------------------------------
270- if (MSVC )
271- option (WITH_CUDA "Compile with CUDA support" FALSE )
272- else ()
273- option (WITH_CUDA "Compile with CUDA support" TRUE )
274- endif ()
275- if (NOT APPLE AND WITH_CUDA)
270+ if (MSVC OR APPLE )
271+ set (LVR2_WITH_CUDA OFF CACHE BOOL "" FORCE)
272+ endif (MSVC OR APPLE )
273+
274+ if (LVR2_WITH_CUDA)
276275 find_package (CUDA)
277276 if (CUDA_FOUND)
278277 message (STATUS "Found CUDA" )
279278 include_directories (${CUDA_INCLUDE_DIRS} )
280279 list (APPEND LVR2_DEFINITIONS -DLVR2_USE_CUDA)
281280 endif (CUDA_FOUND)
282- endif (NOT APPLE AND WITH_CUDA)
283-
281+ endif (LVR2_WITH_CUDA)
284282
285283#------------------------------------------------------------------------------
286284# Searching for RDB
@@ -302,19 +300,21 @@ endif(RDB_FOUND)
302300#------------------------------------------------------------------------------
303301# Searching for OpenCl
304302#------------------------------------------------------------------------------
305- find_package (OpenCL2)
306- if (OPENCL_FOUND)
307- message (STATUS "Found OpenCL" )
308- include_directories (OPENCL_INCLUDE_DIR)
309- list (APPEND LVR2_DEFINITIONS -DLVR2_USE_OPENCL)
310- if (OpenCL_NEW_API)
311- list (APPEND LVR2_DEFINITIONS -DLVR2_USE_OPENCL_NEW_API)
312- endif (OpenCL_NEW_API)
313- endif (OPENCL_FOUND)
303+ if (LVR2_WITH_OPENCL)
304+ find_package (OpenCL2)
305+ if (OPENCL_FOUND)
306+ message (STATUS "Found OpenCL" )
307+ include_directories (${OPENCL_INCLUDE_DIR} )
308+ list (APPEND LVR2_DEFINITIONS -DLVR2_USE_OPENCL)
309+ if (OpenCL_NEW_API)
310+ list (APPEND LVR2_DEFINITIONS -DLVR2_USE_OPENCL_NEW_API)
311+ endif (OpenCL_NEW_API)
312+ endif (OPENCL_FOUND)
313+ endif (LVR2_WITH_OPENCL)
314314
315315# TODO: I cannot move this section down to the 'add_subdirectory' part.
316316# There must be some side effects on the way there
317- if (BUILD_VIEWER )
317+ if (LVR2_BUILD_VIEWER )
318318 #------------------------------------------------------------------------------
319319 # Searching for VTK
320320 #------------------------------------------------------------------------------
@@ -363,13 +363,12 @@ if(BUILD_VIEWER)
363363 message (STATUS "Found VTK compoment QVTK" )
364364 endif ()
365365 endif ()
366- endif (BUILD_VIEWER )
366+ endif (LVR2_BUILD_VIEWER )
367367
368368#------------------------------------------------------------------------------
369369## Searching for PCL
370370#------------------------------------------------------------------------------
371- option (WITH_PCL "Compile with PCL support" OFF )
372- if (WITH_PCL)
371+ if (LVR2_WITH_PCL)
373372 find_package (PCL)
374373 if (PCL_FOUND)
375374 # PCL only results in linker error due to internal mpi dependency
@@ -388,7 +387,7 @@ if(WITH_PCL)
388387 message (STATUS "-- No PCL found." )
389388 message (STATUS "-- PCL related stuff will be disabled." )
390389 endif (PCL_FOUND)
391- endif (WITH_PCL )
390+ endif (LVR2_WITH_PCL )
392391
393392#------------------------------------------------------------------------------
394393# Searching for OpenMP
@@ -411,17 +410,14 @@ endif(OPENMP_FOUND)
411410#------------------------------------------------------------------------------
412411## Searching for libfreenect
413412#------------------------------------------------------------------------------
414- option (WITH_FREENECT "Compile with libfreenect grabber" OFF )
415-
416413find_package (PkgConfig REQUIRED)
417- if (WITH_FREENECT )
414+ if (LVR2_WITH_FREENECT )
418415 pkg_check_modules(LIBFREENECT libfreenect)
419416 if (LIBFREENECT_FOUND)
420417 message (STATUS "Found Freenect" )
421418 include_directories (${LIBFREENECT_INCLUDE_DIRS} )
422419 endif ()
423- endif ()
424-
420+ endif (LVR2_WITH_FREENECT)
425421
426422###############################################################################
427423# USED THIRD PARTY STUFF
@@ -480,11 +476,11 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/${RiVLib_DIR})
480476 include_directories (${RiVLib_INCLUDE_DIRS} )
481477 list (APPEND LVR2_DEFINITIONS -DLVR2_USE_RIVLIB)
482478 message (STATUS "Found RiVLib" )
483- endif ()
479+ endif (RiVLib_FOUND )
484480endif ()
485481
486482# Cesium-native
487- if (WITH_3DTILES )
483+ if (LVR2_WITH_3DTILES )
488484 include (ExternalProject)
489485 ExternalProject_Add(cesium-native
490486 PREFIX cesium-native
@@ -517,7 +513,7 @@ if(WITH_3DTILES)
517513
518514 set (3DTILES_LIBRARIES Cesium3DTiles Cesium3DTilesWriter CesiumGltf CesiumGltfWriter CesiumJsonWriter)
519515
520- else (WITH_3DTILES )
516+ else (LVR2_WITH_3DTILES )
521517 #------------------------------------------------------------------------------
522518 # Searching for Draco
523519 #------------------------------------------------------------------------------
@@ -527,7 +523,7 @@ else(WITH_3DTILES)
527523 include_directories (${draco_INCLUDE_DIRS} )
528524 list (APPEND LVR2_DEFINITIONS -DLVR2_USE_DRACO)
529525 endif (draco_FOUND)
530- endif (WITH_3DTILES )
526+ endif (LVR2_WITH_3DTILES )
531527
532528###############################################################################
533529# ADD LVR DEFINITIONS
@@ -544,19 +540,18 @@ add_definitions(${LVR2_DEFINITIONS})
544540# # Check and set CUDA host compiler flags.
545541# ###############################################################################
546542if (CUDA_FOUND)
547-
548- include (max_cuda_gcc_version)
549- max_cuda_gcc_version(CUDA_VERSION MAX_CUDA_GCC_VERSION)
550- message (STATUS "Highest supported GCC version for CUDA: ${MAX_CUDA_GCC_VERSION} " )
551- if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER ${MAX_CUDA_GCC_VERSION} )
552- message (STATUS "******************************************************************" )
553- message (STATUS "* Your gcc version needs to be lower than or equal ${MAX_CUDA_GCC_VERSION} to compile *" )
554- message (STATUS "* the CUDA library and apps. Setting CUDA_HOST_COMPILER to *" )
555- message (STATUS "* g++-${MAX_CUDA_GCC_VERSION} . Please ensure that g++-${MAX_CUDA_GCC_VERSION} is installed on your system. *" )
556- message (STATUS "******************************************************************" )
557- set (CUDA_HOST_COMPILER "g++-${MAX_CUDA_GCC_VERSION} " CACHE STRING "" FORCE)
558- endif ()
559- endif ()
543+ include (max_cuda_gcc_version)
544+ max_cuda_gcc_version(CUDA_VERSION MAX_CUDA_GCC_VERSION)
545+ message (STATUS "Highest supported GCC version for CUDA: ${MAX_CUDA_GCC_VERSION} " )
546+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER ${MAX_CUDA_GCC_VERSION} )
547+ message (STATUS "******************************************************************" )
548+ message (STATUS "* Your gcc version needs to be lower than or equal ${MAX_CUDA_GCC_VERSION} to compile *" )
549+ message (STATUS "* the CUDA library and apps. Setting CUDA_HOST_COMPILER to *" )
550+ message (STATUS "* g++-${MAX_CUDA_GCC_VERSION} . Please ensure that g++-${MAX_CUDA_GCC_VERSION} is installed on your system. *" )
551+ message (STATUS "******************************************************************" )
552+ set (CUDA_HOST_COMPILER "g++-${MAX_CUDA_GCC_VERSION} " CACHE STRING "" FORCE)
553+ endif ()
554+ endif (CUDA_FOUND)
560555
561556
562557###############################################################################
@@ -570,9 +565,9 @@ if(APPLE AND (NOT OPENMP_FOUND))
570565 message (STATUS "* configure with 'cmake -DWITH_CLANG_OMP ..' *" )
571566 message (STATUS "******************************************************************" )
572567
573- option (WITH_CLANG_OMP "Compile with clang-omp" )
568+ option (LVR2_WITH_CLANG_OMP "Compile with clang-omp" )
574569
575- if (WITH_CLANG_OMP )
570+ if (LVR2_WITH_CLANG_OMP )
576571 set (CMAKE_C_COMPILER /usr/local/bin/clang-omp CACHE STRING "C compiler" FORCE)
577572 set (CMAKE_CXX_COMPILER /usr/local/bin/clang-omp++ CACHE STRING "C++ compiler" FORCE)
578573 list (APPEND LVR2_DEFINITIONS -DLVR2_USE_OPEN_MP)
@@ -589,8 +584,6 @@ endif()
589584install (DIRECTORY include /lvr2 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
590585list (APPEND LVR2_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX} /${CMAKE_INSTALL_INCLUDEDIR} )
591586
592-
593-
594587###############################################################################
595588# VTK use file include. Has to be called after all CUDA code
596589# was generated and compiled. The VTK definitions corrupt the
@@ -657,47 +650,48 @@ endif()
657650#####################################################################################
658651
659652if (UNIX )
660- list (APPEND LVR2_LIB_DEPENDENCIES ${LVR2_LIB_DEPENDENCIES} pthread)
653+ list (APPEND LVR2_LIB_DEPENDENCIES ${LVR2_LIB_DEPENDENCIES} pthread)
661654endif (UNIX )
662655
663656if (PCL_FOUND)
664- list (APPEND LVR2_LIB_DEPENDENCIES ${PCL_LIBRARIES} ${MPI_CXX_LIBRARIES} )
657+ list (APPEND LVR2_LIB_DEPENDENCIES ${PCL_LIBRARIES} ${MPI_CXX_LIBRARIES} )
665658endif (PCL_FOUND)
666659
667- if (WITH_FREENECT AND LIBFREENECT_FOUND)
668- list (APPEND LVR2_LIB_DEPENDENCIES ${LIBFREENECT_LIBRARIES} )
669- endif ()
660+ if (LIBFREENECT_FOUND)
661+ list (APPEND LVR2_LIB_DEPENDENCIES ${LIBFREENECT_LIBRARIES} )
662+ endif (LIBFREENECT_FOUND )
670663
671664if (draco_FOUND)
672- list (APPEND LVR2_LIB_DEPENDENCIES ${draco_LIBRARIES} )
665+ list (APPEND LVR2_LIB_DEPENDENCIES ${draco_LIBRARIES} )
673666endif (draco_FOUND)
674667
675668if (RiVLib_FOUND)
676- list (APPEND LVR2_LIB_DEPENDENCIES ${RiVLib_SCANIFC_LIBRARY} )
677- endif ()
669+ list (APPEND LVR2_LIB_DEPENDENCIES ${RiVLib_SCANIFC_LIBRARY} )
670+ endif (RiVLib_FOUND )
678671
679672if (OPENCL_FOUND)
680- list (APPEND LVR2_LIB_DEPENDENCIES ${OpenCL_LIBRARIES} )
681- endif ()
673+ list (APPEND LVR2_LIB_DEPENDENCIES ${OpenCL_LIBRARIES} )
674+ endif (OPENCL_FOUND )
682675
683676if (MPI_FOUND)
684677 set (LVR2_LIB_DEPENDENCIES ${LVR2_LIB_DEPENDENCIES} ${MPI_LIBRARIES} )
685- endif ()
678+ endif (MPI_FOUND )
686679
687680if (MSVC )
688- list (APPEND LVR2_LIB_DEPENDENCIES yaml-cpp)
689- endif ()
681+ list (APPEND LVR2_LIB_DEPENDENCIES yaml-cpp)
682+ endif (MSVC )
683+
690684if (YAML_CPP_LIBRARIES)
691- list (APPEND LVR2_LIB_DEPENDENCIES ${YAML_CPP_LIBRARIES} )
692- endif ()
685+ list (APPEND LVR2_LIB_DEPENDENCIES ${YAML_CPP_LIBRARIES} )
686+ endif (YAML_CPP_LIBRARIES )
693687
694688if (embree_FOUND)
695- list (APPEND LVR2_LIB_DEPENDENCIES ${EMBREE_LIBRARY} )
696- endif ()
689+ list (APPEND LVR2_LIB_DEPENDENCIES ${EMBREE_LIBRARY} )
690+ endif (embree_FOUND )
697691
698- if (WITH_3DTILES )
699- list (APPEND LVR2_LIB_DEPENDENCIES ${3DTILES_LIBRARIES} )
700- endif (WITH_3DTILES )
692+ if (3DTILES_FOUND )
693+ list (APPEND LVR2_LIB_DEPENDENCIES ${3DTILES_LIBRARIES} )
694+ endif (3DTILES_FOUND )
701695
702696###############################################################################
703697# LIBRARIES
@@ -713,13 +707,13 @@ if(NOT MSVC)
713707# add_subdirectory(src/tools/lvr2_largescale_reconstruct)
714708endif (NOT MSVC )
715709
716- if (BUILD_TOOLS )
710+ if (LVR2_BUILD_TOOLS )
717711 add_subdirectory (src/tools/lvr2_reconstruct)
718712 add_subdirectory (src/tools/lvr2_mesh_reducer)
719713 add_subdirectory (src/tools/lvr2_hdf5_mesh_tool)
720- endif (BUILD_TOOLS )
714+ endif (LVR2_BUILD_TOOLS )
721715
722- if (BUILD_TOOLS_EXPERIMENTAL )
716+ if (LVR2_BUILD_TOOLS_EXPERIMENTAL )
723717
724718 add_subdirectory (src/tools/lvr2_dmc_reconstruction)
725719 add_subdirectory (src/tools/lvr2_gs_reconstruction)
@@ -747,7 +741,7 @@ if(BUILD_TOOLS_EXPERIMENTAL)
747741 #add_subdirectory(src/tools/lvr2_riegl_project_converter)
748742 endif ()
749743
750- if (CUDA_FOUND)
744+ if (LVR2_WITH_CUDA AND CUDA_FOUND)
751745 # cuda_include_directories(ext/CTPL)
752746 add_subdirectory (src/tools/lvr2_cuda_normals)
753747 endif ()
@@ -757,19 +751,19 @@ if(BUILD_TOOLS_EXPERIMENTAL)
757751 add_subdirectory (src/tools/lvr2_cl_sor)
758752 endif ()
759753
760- endif (BUILD_TOOLS_EXPERIMENTAL )
754+ endif (LVR2_BUILD_TOOLS_EXPERIMENTAL )
761755
762756###############################################################################
763757# LVR2 EXAMPLES
764758###############################################################################
765- if (BUILD_EXAMPLES )
759+ if (LVR2_BUILD_EXAMPLES )
766760 add_subdirectory (examples)
767761endif ()
768762
769763###############################################################################
770764# LVR2 VIEWER + LVR2 ASCII VIEWER
771765###############################################################################
772- if (BUILD_VIEWER )
766+ if (LVR2_BUILD_VIEWER )
773767
774768 if (DEFINED VTK_USE_FILE)
775769 include (${VTK_USE_FILE} )
@@ -796,7 +790,7 @@ if(BUILD_VIEWER)
796790 if (CURSES_FOUND AND embree_FOUND)
797791 add_subdirectory (src/tools/lvr2_ascii_viewer)
798792 endif ()
799- endif (BUILD_VIEWER )
793+ endif (LVR2_BUILD_VIEWER )
800794
801795###############################################################################
802796# CMAKE FILES
0 commit comments