Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CUDA optional for app too #49

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ if (CMAKE_CUDA_COMPILER)
else()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS}")
endif()
else()
message(FATAL_ERROR "CMake does not find the CUDA SDK, which is required to build this application (even in case CUDA itself will not or cannot be used).")
endif()

# Cross-platform threading. See:
Expand Down Expand Up @@ -354,7 +352,7 @@ if(Qt5Widgets_FOUND)
endif()

if (CMAKE_CUDA_COMPILER)
target_compile_options(libvis PUBLIC -DLIBVIS_HAVE_CUDA) # TODO: is this used anywhere?
target_compile_options(libvis PUBLIC -DLIBVIS_HAVE_CUDA)
endif()

target_include_directories(libvis
Expand Down Expand Up @@ -398,6 +396,12 @@ target_link_libraries(libvis
png #_static
Threads::Threads
)
if(CMAKE_CUDA_COMPILER)
target_link_libraries(libvis
PUBLIC
${CUDA_cusolver_LIBRARY}
)
endif()
if(VULKAN_FOUND)
target_link_libraries(libvis PRIVATE
vulkan
Expand Down Expand Up @@ -473,6 +477,7 @@ if (CMAKE_CUDA_COMPILER)
)
target_link_libraries(libvis_cuda PUBLIC
libvis
CUDA::cublas
)
target_compile_options(libvis_cuda PRIVATE
$<$<COMPILE_LANGUAGE:CUDA>:-use_fast_math>
Expand All @@ -493,14 +498,12 @@ if (CMAKE_CUDA_COMPILER)
gtest_main
Threads::Threads
libvis_cuda
CUDA::cublas # TODO: currently required because of lm_optimizer.h. That should not be necessary.
)
target_include_directories(libvis_cuda_test PRIVATE
${gtest_SOURCE_DIR}/include
#${gtest_SOURCE_DIR}
${OpenCV_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} # TODO: currently required because of lm_optimizer.h. That should not be necessary.
)
add_test(libvis_cuda_test
libvis_cuda_test
Expand Down Expand Up @@ -533,15 +536,13 @@ set_property(TARGET libvis_test PROPERTY FOLDER "libvis")
target_link_libraries(libvis_test PRIVATE
gtest
Threads::Threads
libvis
CUDA::cublas # TODO: currently required because of lm_optimizer.h. That should not be necessary.
libvis
)
target_include_directories(libvis_test PRIVATE
${gtest_SOURCE_DIR}/include
#${gtest_SOURCE_DIR}
${OpenCV_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES} # TODO: currently required because of lm_optimizer.h. That should not be necessary.
)
add_test(libvis_test
libvis_test
Expand Down
Loading