Skip to content
Snippets Groups Projects
Commit 3a54568f authored by Houssem ROUIS's avatar Houssem ROUIS
Browse files

only load backend_cuda when available

parent 00f41885
No related branches found
No related tags found
2 merge requests!17version 0.2.0,!15Learning backend cuda
......@@ -6,8 +6,14 @@ file(STRINGS "${CMAKE_SOURCE_DIR}/version.txt" version)
project(aidge_learning
VERSION ${version}
DESCRIPTION "Functions and alogrithms to train models in the AIDGE framework"
LANGUAGES CXX CUDA)
LANGUAGES CXX)
# Try to find CUDA
find_package(CUDAToolkit)
if(CUDAToolkit_FOUND)
enable_language(CUDA)
endif()
message(STATUS "Project name: ${CMAKE_PROJECT_NAME}")
message(STATUS "Project version: ${version}")
......
......@@ -22,25 +22,32 @@ if(NOT DEFINED CMAKE_CUDA_STANDARD)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)
endif()
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
target_link_libraries( _aidge_backend_cuda
INTERFACE
cudart # Ensure CUDA dependencies are included
cublas # Include other CUDA components if needed
cudnn
target_link_libraries(tests_exe
PUBLIC ${module_name} _aidge_backend_cpu
PRIVATE Catch2::Catch2WithMain
)
target_include_directories(_aidge_backend_cuda INTERFACE ${CUDAToolkit_INCLUDE_DIRS})
if(aidge_backend_cuda_FOUND)
enable_language(CUDA)
find_package(CUDAToolkit REQUIRED)
target_link_libraries(tests_exe
PUBLIC ${module_name} _aidge_backend_cpu _aidge_backend_cuda
PRIVATE Catch2::Catch2WithMain
)
target_link_libraries( _aidge_backend_cuda
INTERFACE
cudart # Ensure CUDA dependencies are included
cublas # Include other CUDA components if needed
cudnn
)
target_include_directories(_aidge_backend_cuda INTERFACE ${CUDAToolkit_INCLUDE_DIRS})
target_link_libraries(tests_exe
PUBLIC ${module_name} _aidge_backend_cuda
)
# Define a preprocessor macro if aidge_backend_cuda is linked
target_compile_definitions(tests_exe PUBLIC USE_AIDGE_BACKEND_CUDA)
endif()
# Define a preprocessor macro if aidge_backend_cuda is linked
target_compile_definitions(tests_exe PUBLIC USE_AIDGE_BACKEND_CUDA)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
include(CTest)
......
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