mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
cmake: only build GPU library if CUDA is present
This commit is contained in:
parent
13fd3f3c2a
commit
d2384abb9d
2 changed files with 14 additions and 3 deletions
|
@ -1,5 +1,4 @@
|
|||
add_subdirectory(common)
|
||||
add_subdirectory(gpu)
|
||||
|
||||
set(SOURCES
|
||||
vlnv.cpp
|
||||
|
@ -36,7 +35,16 @@ find_package(Threads)
|
|||
add_library(villas-fpga SHARED ${SOURCES})
|
||||
|
||||
target_link_libraries(villas-fpga PUBLIC villas-common)
|
||||
target_link_libraries(villas-fpga PUBLIC villas-gpu)
|
||||
|
||||
# GPU library is optional, check for CUDA presence
|
||||
include(CheckLanguage)
|
||||
check_language(CUDA)
|
||||
if(CMAKE_CUDA_COMPILER)
|
||||
add_subdirectory(gpu)
|
||||
target_link_libraries(villas-fpga PUBLIC villas-gpu)
|
||||
else()
|
||||
message("No CUDA support, not building GPU library")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(villas-fpga PRIVATE
|
||||
BUILDID=\"abc\"
|
||||
|
|
|
@ -4,7 +4,6 @@ set(SOURCES
|
|||
logging.cpp
|
||||
dma.cpp
|
||||
fifo.cpp
|
||||
gpu.cpp
|
||||
# hls.c
|
||||
# intc.c
|
||||
# rtds_rtt.c
|
||||
|
@ -13,6 +12,10 @@ set(SOURCES
|
|||
graph.cpp
|
||||
)
|
||||
|
||||
if(CMAKE_CUDA_COMPILER)
|
||||
list(APPEND SOURCES gpu.cpp)
|
||||
endif()
|
||||
|
||||
add_executable(unit-tests ${SOURCES})
|
||||
|
||||
find_package(Criterion REQUIRED)
|
||||
|
|
Loading…
Add table
Reference in a new issue