Skip to content

Commit

Permalink
I still have to compile twice
Browse files Browse the repository at this point in the history
  • Loading branch information
amock committed Dec 9, 2024
1 parent 2a78b79 commit d96c7ce
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 20 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ if(OPENCL_FOUND)
endif(OpenCL_NEW_API)
endif(OPENCL_FOUND)

# TODO: I cannot move this section down to the 'add_subdirectory' part.
# There must be some side effects on the way there
if(BUILD_VIEWER)
#------------------------------------------------------------------------------
# Searching for VTK
Expand Down
45 changes: 25 additions & 20 deletions src/liblvr2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,39 +319,44 @@ if(CUDA_FOUND)
endforeach()
endif(VTK_FOUND)


# find NVRTC - runtime compilation library for CUDA C++
if (NOT DEFINED CUDA_NVRTC_LIBRARY)
string(REGEX REPLACE cudart nvrtc CUDA_NVRTC_LIBRARY ${CUDA_CUDART_LIBRARY})
endif()
MESSAGE(STATUS "CUDA NVRTC: " ${CUDA_NVRTC_LIBRARY})

if(NOT CUDA_NVRTC_LIBRARY)
message(FATAL_ERROR "Required library 'nvrtc' not found.")
endif(NOT CUDA_NVRTC_LIBRARY)


message(STATUS "Building static LVR CUDA library")
cuda_add_library(lvr2cuda_static STATIC ${LVR2_CUDA_SRC})
target_link_libraries(lvr2cuda_static lvr2_static)

# Add dependency to avoid that both targets
# are build concurrently in parallel builds
add_dependencies(lvr2cuda_static lvr2_static)
add_dependencies(lvr2cuda_static
lvr2_static)

target_link_libraries(lvr2cuda_static
lvr2_static
${CUDA_LIBRARIES}
${CUDA_CUDA_LIBRARY}
${CUDA_NVRTC_LIBRARY}
)

message(STATUS "Building shared LVR CUDA library")
cuda_add_library(lvr2cuda SHARED ${LVR2_CUDA_CPP_SRC} ${LVR2_CUDA_SRC})

target_link_libraries(lvr2cuda lvr2)

# /usr/local/cuda/lib64/libnvrtc.so
find_library(NVRTC_LIBRARY REQUIRED
NAMES nvrtc libnvrtc
HINTS "/usr/local/cuda/lib64"
)

if(NOT NVRTC_LIBRARY)
message(FATAL_ERROR "Required library 'nvrtc' not found.")
endif()
add_dependencies(lvr2cuda
lvr2)

target_link_libraries(lvr2cuda
lvr2
${CUDA_LIBRARIES}
${NVRTC_LIBRARY}
${CUDA_CUDA_LIBRARY}
)

target_link_libraries(lvr2cuda_static
${CUDA_LIBRARIES}
${NVRTC_LIBRARY}
${CUDA_CUDA_LIBRARY}
${CUDA_NVRTC_LIBRARY}
)

install(
Expand Down

0 comments on commit d96c7ce

Please sign in to comment.