Open Pradur241 opened 1 year ago
l have the same problem!!
Did you overcome it?
no, I gave it up @yaoluoge
maybe l should looking for other ways @Pradur241
l got it! maybe you can try it with my cmakelists.`cmake_minimum_required(VERSION 3.16) project(ceres_test_0) add_compile_options(-std=c++14) find_package(Ceres REQUIRED) option(USE_CUDA "Enable use of CUDA linear algebra solvers." ON) if (USE_CUDA) if (CMAKE_VERSION VERSION_LESS 3.17)
# not available, but FindCUDA was deprecated. To avoid special-case handling
# elsewhere, emulate the effects of FindCUDAToolkit locally in terms of the
# expected CMake imported targets and defined variables. This can be removed
# from as soon as the min CMake version is >= 3.17.
find_package(CUDA QUIET)
if (CUDA_FOUND)
message("-- Found CUDA version ${CUDA_VERSION} installed in: "
"${CUDA_TOOLKIT_ROOT_DIR} via legacy (< 3.17) CMake module. "
"Using the legacy CMake module means that any installation of "
"Ceres will require that the CUDA libraries be installed in a "
"location included in the LD_LIBRARY_PATH.")
enable_language(CUDA)
macro(DECLARE_IMPORTED_CUDA_TARGET COMPONENT)
add_library(CUDA::${COMPONENT} INTERFACE IMPORTED)
target_include_directories(
CUDA::${COMPONENT} INTERFACE ${CUDA_INCLUDE_DIRS})
target_link_libraries(
CUDA::${COMPONENT} INTERFACE ${CUDA_${COMPONENT}_LIBRARY} ${ARGN})
endmacro()
declare_imported_cuda_target(cublas)
declare_imported_cuda_target(cusolver)
declare_imported_cuda_target(cusparse)
declare_imported_cuda_target(cudart ${CUDA_LIBRARIES})
set(CERES_CUDA_TARGET_SUFFIX "")
set(CUDAToolkit_BIN_DIR ${CUDA_TOOLKIT_ROOT_DIR}/bin)
else (CUDA_FOUND)
message("-- Did not find CUDA, disabling CUDA support.")
update_cache_variable(USE_CUDA OFF)
endif (CUDA_FOUND)
else (CMAKE_VERSION VERSION_LESS 3.17) find_package(CUDAToolkit QUIET) if (CUDAToolkit_FOUND) message("-- Found CUDA version ${CUDAToolkit_VERSION} installed in: " "${CUDAToolkit_TARGET_DIR}") set(CUDAToolkit_DEPENDENCY "find_dependency(CUDAToolkit ${CUDAToolkit_VERSION})") enable_language(CUDA) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
set(CMAKE_CUDA_ARCHITECTURES "50;60;70;80")
message("-- Setting CUDA Architecture to ${CMAKE_CUDA_ARCHITECTURES}")
endif()
if (USE_CUDA STREQUAL "static")
set(CERES_CUDA_TARGET_SUFFIX "_static")
else (USE_CUDA STREQUAL "static")
set(CERES_CUDA_TARGET_SUFFIX "")
endif (USE_CUDA STREQUAL "static")
else (CUDAToolkit_FOUND)
message("-- Did not find CUDA, disabling CUDA support.")
update_cache_variable(USE_CUDA OFF)
endif (CUDAToolkit_FOUND)
endif (CMAKE_VERSION VERSION_LESS 3.17) endif (USE_CUDA)
if (USE_CUDA) list(APPEND CERES_CUDA_LIBRARIES CUDA::cublas${CERES_CUDA_TARGET_SUFFIX} CUDA::cudart${CERES_CUDA_TARGET_SUFFIX} CUDA::cusolver${CERES_CUDA_TARGET_SUFFIX} CUDA::cusparse${CERES_CUDA_TARGET_SUFFIX}) unset (CERES_CUDA_TARGET_SUFFIX) set(CMAKE_CUDA_RUNTIME_LIBRARY NONE) else (USE_CUDA) message("-- Building without CUDA.") list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUDA) endif (USE_CUDA) add_executable(ceres_test_0 ceres_test.cpp) target_link_libraries(ceres_test_0 Ceres::ceres)` @Pradur241
@yaoluoge Thanks a lot!! Nice job!
请问我在编译的时候提示了这些错误,有什么解决办法吗?