Skip to content

Commit 3d10b7a

Browse files
committed
Fixed CUDA linking issue on Xenial and CUDA 8+
1 parent fdf7fba commit 3d10b7a

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

CMakeLists.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ option(DBOT_BUILD_GPU "Compile CUDA enabled trackers" ON)
1010
# Flags #
1111
############################
1212
# Enable c++11 GCC 4.7 or greater required
13-
add_definitions(-std=c++11 -fno-omit-frame-pointer)
14-
add_definitions(-DPROFILING_ON=1 -fPIC) #print profiling output
13+
add_definitions(-std=c++11 -fno-omit-frame-pointer -fPIC)
14+
add_definitions(-DPROFILING_ON=1) #print profiling output
1515

1616
#add_definitions(-Wall)
1717
#add_definitions(-Wno-unused-local-typedefs)
@@ -43,14 +43,13 @@ set(dbot_LIBRARIES ${dbot_LIBRARY})
4343
# Dependencies #
4444
############################
4545

46-
find_package(Eigen REQUIRED)
47-
find_package(Boost REQUIRED COMPONENTS system filesystem)
46+
find_package(Eigen3 3.2 EXACT REQUIRED)
47+
include_directories(${EIGEN3_INCLUDE_DIR})
48+
# add_definitions(${EIGEN3_DEFINITIONS})
4849

49-
include_directories(${Eigen_INCLUDE_DIRS})
50+
find_package(Boost REQUIRED COMPONENTS system filesystem)
5051
include_directories(${Boost_INCLUDE_DIRS})
5152

52-
add_definitions(${Eigen_DEFINITIONS})
53-
5453
# GPU libs
5554
set(GLEW_DIR ${CMAKE_MODULE_PATH})
5655
find_package(CUDA QUIET)
@@ -60,7 +59,6 @@ find_package(OpenGL QUIET)
6059
if(DBOT_BUILD_GPU AND CUDA_FOUND AND GLEW_FOUND AND OPENGL_FOUND)
6160
include_directories(${GLEW_INCLUDE_DIRS})
6261
include_directories(${OpenGL_INCLUDE_DIRS})
63-
cuda_include_directories(${CUDA_CUT_INCLUDE_DIRS})
6462

6563
link_directories(${OpenGL_LIBRARY_DIRS})
6664
link_directories(${GLEW_LIBRARY_DIRS})
@@ -71,8 +69,8 @@ if(DBOT_BUILD_GPU AND CUDA_FOUND AND GLEW_FOUND AND OPENGL_FOUND)
7169
# enable cuda debug information with -g -G -O0, to use with cuda-dbg use
7270
# --ptxas-options=-v to see number of registers, local, shared and constant
7371
# memory used in kernels
74-
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -O2 -arch=sm_20)
75-
list(APPEND dbot_LIBRARIES ${dbot_LIBRARY_GPU})
72+
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -O2 -arch=sm_30)
73+
list(APPEND dbot_LIBRARIES ${dbot_LIBRARY_GPU} ${CUDA_CUDART_LIBRARY})
7674

7775
# activate gpu implementations
7876
add_definitions(-DDBOT_BUILD_GPU=1)
@@ -127,7 +125,9 @@ if(catkin_FOUND)
127125
CATKIN_DEPENDS
128126
fl
129127
DEPENDS
130-
Eigen)
128+
Boost
129+
# CUDA
130+
)
131131
list(APPEND dbot_INCLUDE_DIRS ${catkin_INCLUDE_DIRS})
132132
else(catkin_FOUND)
133133
find_package(fl REQUIRED)
@@ -190,6 +190,7 @@ if(DBOT_BUILD_GPU)
190190
${OPENGL_LIBRARIES}
191191
${GLFW_LIBRARY}
192192
${GLEW_LIBRARIES})
193+
# ${CUDA_CUDART_LIBRARY})
193194
endif(DBOT_BUILD_GPU)
194195

195196
############################

0 commit comments

Comments
 (0)