Cmake - 添加所有CUDA库

时间:2017-03-25 00:14:57

标签: cuda cmake

我正在尝试使用CMAKE在我的VS 2015解决方案中添加所有已安装的CUDA 8.0库。但是,使用下面的当前CMakeLists.txt文件,我的输入库(项目属性 - >链接器 - >输入 - >其他依赖项)下的cudart_static.libOpenCL.lib结尾只有cusparse 。而不是手动添加cusolvercufftC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64等库,有没有办法在CUDA库文件夹cmake_minimum_required(VERSION 2.8) project( layerSeg ) # ========================================================================== # find Boost set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) set(Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.63.0 REQUIRED filesystem regex) if(Boost_FOUND) message("Boost found") include_directories(${BOOST_INCLUDEDIR}) link_directories(${BOOST_LIBRARYDIR}) endif() # ========================================================================== # find CUDA find_package( CUDA 8.0 EXACT REQUIRED) if (CUDA_FOUND) message("CUDA found") SET(CUDA_INCLUDE_DIRS "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/include" ${CUDA_INCLUDE_DIRS}) #include(FindCUDA) INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) else() message("CUDA not found") endif() # ========================================================================== # find openCV FIND_PACKAGE(OpenCV REQUIRED) if (OpenCV_FOUND) message("OpenCV found") INCLUDE_DIRECTORIES( ${OPENCV_INCLUDE_DIR} ) set(CUDA_USE_STATIC_CUDA_RUNTIME ON) else() message("OpenCV not found") endif() # ========================================================================== # Find ITK. find_package(ITK REQUIRED) if (ITK_FOUND) message("ITK found") include(${ITK_USE_FILE}) else() message("ITK not found") endif() # ========================================================================== # find VTK find_package(VTK REQUIRED) if (VTK_FOUND) message("VTK found") #message(${VTK_DIR}) #message(${VTK_USE_FILE}) include(${VTK_USE_FILE}) else() message("VTK not found") endif() # ========================================================================== # ========================================================================== add_executable( layerSeg main.cpp mainGPU.cu kernels.cu lsh.h lshGPU.h) target_link_libraries( layerSeg ${OpenCV_LIBS} ${CUDA_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES} ${Boost_LIBRARIES}) 中包含所有可用的库,使用一个CMAKE命令?

--require spec_helper

1 个答案:

答案 0 :(得分:1)

要在function myMerge($arr1, $arr2) { // create associative array keyed by class foreach (array_merge($arr1, $arr2) as $pair) { $class[$pair['Class']][] = $pair['Student'][0]; } // convert that associative array to indexed array with concatenated students string. foreach($class as $name => $students) { $result[] = ['Class' => $name, 'Student' => [implode(', ', $students)]]; } return $result; } 文件夹中添加所有库,可以添加将以下库附加到lib\x64

target_link_libraries

有关这些CMAKE命令的其他详细信息,请参阅FindCUDA CMAKE docs