2024-12-12 09:19:48 -08:00

36 lines
1.1 KiB
CMake

# Include directories and libraries
include_directories(../../../Common)
# Source file
set(SRC_FILES
threadMigration.cpp
)
# Add target for threadMigration
add_executable(threadMigration ${SRC_FILES})
set_target_properties(threadMigration PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_include_directories(threadMigration PUBLIC
${CUDAToolkit_INCLUDE_DIRS}
)
target_link_libraries(threadMigration PUBLIC
CUDA::cuda_driver
)
set(CUDA_FATBIN_FILE "${CMAKE_CURRENT_BINARY_DIR}/threadMigration_kernel64.fatbin")
set(CUDA_KERNEL_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/threadMigration_kernel.cu")
add_custom_command(
OUTPUT ${CUDA_FATBIN_FILE}
COMMAND ${CMAKE_CUDA_COMPILER} ${INCLUDES} ${ALL_CCFLAGS} ${GENCODE_FLAGS} -o ${CUDA_FATBIN_FILE} -fatbin ${CUDA_KERNEL_SOURCE}
DEPENDS ${CUDA_KERNEL_SOURCE}
COMMENT "Building CUDA fatbin: ${CUDA_FATBIN_FILE}"
)
# Create a dummy target for fatbin generation
add_custom_target(generate_fatbin_threadMigration ALL DEPENDS ${CUDA_FATBIN_FILE})
# Ensure matrixMulDrv depends on the fatbin
add_dependencies(threadMigration generate_fatbin_threadMigration)