Skip to content
Snippets Groups Projects
Commit ce4a2111 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Minor cmake cuda refactor

parent 2bc2f63c
No related branches found
No related tags found
No related merge requests found
*/build */build
*/node_modules **/node_modules
**/include/ftl/config.h **/include/ftl/config.h
**/src/config.cpp **/src/config.cpp
**/*.blend1 **/*.blend1
......
...@@ -19,14 +19,20 @@ find_package( URIParser REQUIRED ) ...@@ -19,14 +19,20 @@ find_package( URIParser REQUIRED )
find_package( MsgPack REQUIRED ) find_package( MsgPack REQUIRED )
find_package( LibSGM ) find_package( LibSGM )
# Why is this problematic on some machines?
check_language(CUDA) check_language(CUDA)
if (CUDA_TOOLKIT_ROOT_DIR) if (CUDA_TOOLKIT_ROOT_DIR)
enable_language(CUDA) enable_language(CUDA)
set(CMAKE_CUDA_FLAGS "") set(CMAKE_CUDA_FLAGS "")
set(CMAKE_CUDA_FLAGS_DEBUG "-g -DDEBUG -D_DEBUG -Wall") set(CMAKE_CUDA_FLAGS_DEBUG "-g -DDEBUG -D_DEBUG -Wall")
set(CMAKE_CUDA_FLAGS_RELEASE "") set(CMAKE_CUDA_FLAGS_RELEASE "")
add_definitions(-DHAVE_CUDA) set(HAVE_CUDA TRUE)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
set_property(TARGET Threads::Threads
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -pthread>
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-pthread>")
endif () endif ()
if (NOT MsgPack_FOUND) if (NOT MsgPack_FOUND)
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#cmakedefine HAVE_VIZ #cmakedefine HAVE_VIZ
#cmakedefine HAVE_OPENCVCUDA #cmakedefine HAVE_OPENCVCUDA
#cmakedefine HAVE_URIPARSESINGLE #cmakedefine HAVE_URIPARSESINGLE
#cmakedefine HAVE_CUDA
extern const char *FTL_VERSION_LONG; extern const char *FTL_VERSION_LONG;
extern const char *FTL_VERSION; extern const char *FTL_VERSION;
......
...@@ -43,14 +43,10 @@ add_executable(cv-node ${CVNODESRC}) ...@@ -43,14 +43,10 @@ add_executable(cv-node ${CVNODESRC})
add_dependencies(cv-node net) add_dependencies(cv-node net)
if (CUDA_FOUND) if (CUDA_FOUND)
set_property(TARGET Threads::Threads
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler -pthread>
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-pthread>")
set_property(TARGET cv-node PROPERTY CUDA_SEPARABLE_COMPILATION ON) set_property(TARGET cv-node PROPERTY CUDA_SEPARABLE_COMPILATION ON)
endif (CUDA_FOUND) endif()
target_include_directories(cv-node PUBLIC ${PROJECT_SOURCE_DIR}/include) #target_include_directories(cv-node PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(cv-node Threads::Threads ${OpenCV_LIBS} ${LIBSGM_LIBRARIES} ${CUDA_LIBRARIES} ${GLOG_LIBRARIES}) target_link_libraries(cv-node net Threads::Threads ${OpenCV_LIBS} ${LIBSGM_LIBRARIES} ${CUDA_LIBRARIES} ${GLOG_LIBRARIES})
#ifndef _FTL_CUDA_COMMON_HPP_ #ifndef _FTL_CUDA_COMMON_HPP_
#define _FTL_CUDA_COMMON_HPP_ #define _FTL_CUDA_COMMON_HPP_
#include <ftl/config.h>
#if defined HAVE_CUDA #if defined HAVE_CUDA
#include <opencv2/core/cuda.hpp> #include <opencv2/core/cuda.hpp>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment