2021-09-14 00:13:48 +02:00
|
|
|
cmake_minimum_required(VERSION 3.18)
|
2018-10-28 12:09:07 +01:00
|
|
|
project (ObjectLibrary CUDA CXX)
|
2017-04-14 19:02:05 +02:00
|
|
|
#Goal for this example:
|
2018-04-23 21:13:27 +02:00
|
|
|
#
|
|
|
|
#Build C++ and CUDA object files and than use them to make an executable
|
|
|
|
#Make sure that CMake logic to handle object output when multiple files
|
|
|
|
#with the same name works
|
|
|
|
add_subdirectory(Conflicts)
|
2017-04-14 19:02:05 +02:00
|
|
|
|
|
|
|
add_library(CudaMixedObjectLib OBJECT static.cu static.cpp)
|
|
|
|
|
|
|
|
add_executable(CudaObjectLibrary
|
|
|
|
main.cpp
|
2018-04-23 21:13:27 +02:00
|
|
|
$<TARGET_OBJECTS:CudaMixedObjectLib>
|
|
|
|
$<TARGET_OBJECTS:CudaConflicts>)
|
2018-01-26 17:06:56 +01:00
|
|
|
|
2017-07-20 19:35:53 +02:00
|
|
|
if(APPLE)
|
2018-01-26 17:06:56 +01:00
|
|
|
# Help the static cuda runtime find the driver (libcuda.dyllib) at runtime.
|
|
|
|
set_property(TARGET CudaObjectLibrary PROPERTY BUILD_RPATH ${CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES})
|
2017-07-20 19:35:53 +02:00
|
|
|
endif()
|