Skip to content

Commit

Permalink
CUDA support via LANGUAGES definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrauch committed Jan 3, 2024
1 parent c2473b4 commit 023a7ad
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ project(multimotionfusion)
set(CMAKE_CXX_STANDARD 17)

# Warnings / Errors
add_compile_options(-Wall -Werror -Wno-write-strings -Wno-deprecated-declarations)
add_compile_options(
$<$<COMPILE_LANGUAGE:CXX>:-Wall>
$<$<COMPILE_LANGUAGE:CXX>:-Werror>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-write-strings>
$<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-declarations>
)

# Don't follow symlinks when FILE GLOB_RECURSE (and don't warn)
cmake_policy(SET CMP0009 NEW)
Expand Down
13 changes: 6 additions & 7 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0.2)

project(multimotionfusion)
project(multimotionfusion LANGUAGES CXX CUDA)

message(STATUS "Evaluating Core/CMAKE")

Expand All @@ -9,7 +9,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
include(GNUInstallDirs)

## External packages
find_package(CUDA REQUIRED)
find_package(SuiteSparse REQUIRED)
find_package(OpenCV REQUIRED)
find_package(OpenMP)
Expand Down Expand Up @@ -65,7 +64,7 @@ message(STATUS "MULTIMOTIONFUSION_SHADER_DIR: ${MULTIMOTIONFUSION_SHADER_DIR}")

## Includes
include_directories(${Pangolin_INCLUDE_DIRS})
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
include_directories(${SUITESPARSE_INCLUDE_DIRS})
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
Expand Down Expand Up @@ -98,8 +97,6 @@ endif(CMAKE_BUILD_TYPE MATCHES Debug)
# disable to use standard 'glTransformFeedbackVaryings' in palce of 'glTransformFeedbackVaryingsNV'
add_definitions(-DNVIDIA_VARYINGS)

CUDA_COMPILE(cuda_objs ${cuda})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse -msse2 -msse3 -DSHADER_DIR=${MULTIMOTIONFUSION_SHADER_DIR}")

if(CMAKE_BUILD_TYPE MATCHES Debug)
Expand All @@ -117,7 +114,6 @@ add_library(${PROJECT_NAME} SHARED
${utils_srcs}
${shader_srcs}
${cuda}
${cuda_objs}
${containers}
${segmentation}
)
Expand All @@ -126,7 +122,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${ZLIB_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
${OPENNI2_INCLUDE_DIR}
${OpenCV_INCLUDE_DIRS}
${BOOST_INCLUDE_DIRS}
Expand All @@ -142,6 +138,9 @@ target_link_libraries(${PROJECT_NAME}
super_point_inference
)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
set_target_properties(${PROJECT_NAME} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

add_library(ransac STATIC "Utils/RigidRANSAC.cpp")
target_link_libraries(ransac Eigen3::Eigen)

Expand Down
9 changes: 4 additions & 5 deletions GUI/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)

project(multimotionfusion-gui)
project(multimotionfusion-gui LANGUAGES CXX CUDA)

set(CMAKE_CXX_STANDARD 17)

Expand All @@ -23,7 +23,6 @@ option(ROSNODE "read images live as ROS node" ${HASROS})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
find_package(ZLIB REQUIRED)
find_package(CUDA REQUIRED)
find_package(OpenNI2 REQUIRED)
find_package(OpenCV REQUIRED )
find_package(Boost REQUIRED filesystem)
Expand Down Expand Up @@ -57,7 +56,7 @@ if(ROSBAG OR ROSNODE)
endif()

include_directories(${ZLIB_INCLUDE_DIR})
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Core)
include_directories(${OPENNI2_INCLUDE_DIR})
include_directories(${Pangolin_INCLUDE_DIRS})
Expand All @@ -66,7 +65,7 @@ include_directories(${OpenCV_INCLUDE_DIRS})

message(STATUS "Include-directories: ")
message(STATUS "ZLIB_INCLUDE_DIR: ${ZLIB_INCLUDE_DIR}")
message(STATUS "CUDA_INCLUDE_DIRS: ${CUDA_INCLUDE_DIRS}")
message(STATUS "CUDA_INCLUDE_DIRS: ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}")
message(STATUS "OPENNI2_INCLUDE_DIR: ${OPENNI2_INCLUDE_DIR}")
message(STATUS "CMAKE_CURRENT_SOURCE_DIR/../Core: ${${CMAKE_CURRENT_SOURCE_DIR}/../Core}")

Expand Down Expand Up @@ -112,7 +111,7 @@ target_include_directories(MultiMotionFusionTools PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${ZLIB_INCLUDE_DIR}
${Pangolin_INCLUDE_DIRS}
${CUDA_INCLUDE_DIRS}
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
${OPENNI2_INCLUDE_DIR}
${OpenCV_INCLUDE_DIRS}
${BOOST_INCLUDE_DIRS}
Expand Down

0 comments on commit 023a7ad

Please sign in to comment.