damaris-backends/drivers/SpinCore-PulseBlaster/CMakeLists.txt

30 lines
1.3 KiB
CMake
Raw Normal View History

2017-01-19 08:09:51 +00:00
cmake_minimum_required(VERSION 3.0)
set(DRIVER_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB KERNEL_VERSIONS_DIR RELATIVE "/lib/modules" "/lib/modules/*/build")
foreach(KERNEL_DIR ${KERNEL_VERSIONS_DIR})
string(REPLACE "/build" "" KERNEL_VERSION ${KERNEL_DIR})
message(STATUS "Compiling pulseblaster.ko for kernel: " ${KERNEL_VERSION})
# Creating pulseblaster kernel module
set(DRIVER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${KERNEL_VERSION}/pulseblaster.ko )
set(KBUILD_CMD ${CMAKE_MAKE_PROGRAM}
-C "/lib/modules/${KERNEL_DIR}"
2017-01-19 08:09:51 +00:00
M=${CMAKE_CURRENT_SOURCE_DIR} modules)
add_custom_command(OUTPUT ${DRIVER_FILE}
2017-01-19 08:09:51 +00:00
COMMAND ${KBUILD_CMD}
COMMAND mkdir -p ${KERNEL_VERSION}
COMMAND mv -fv pulseblaster.ko ${DRIVER_FILE}
COMMENT "Building pulseblaster.ko for kernel version: " ${KERNEL_VERSION}
2017-01-19 08:09:51 +00:00
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM)
add_custom_target(pulseblaster_driver_${KERNEL_VERSION} ALL DEPENDS ${DRIVER_FILE} )
install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${KERNEL_VERSION}/kernel/damaris)
endforeach(KERNEL_DIR)
2017-01-19 08:09:51 +00:00
#include_directories(..)
add_library(SpinCore-PulseBlaster SpinCore-PulseBlaster.cpp)
add_library(PulseBlasterProgram PulseBlasterProgram.cpp)