damaris-backends/drivers/SpinCore-PulseBlaster/CMakeLists.txt
Markus Rosenstihl a05667a7c7 Fix T92: kernel modules are build for all kernel headers
general.cpp now compiles on stretch
debian/compat bumped from 7 to 9
2018-03-26 15:21:11 +02:00

30 lines
1.3 KiB
CMake

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}"
M=${CMAKE_CURRENT_SOURCE_DIR} modules)
add_custom_command(OUTPUT ${DRIVER_FILE}
COMMAND ${KBUILD_CMD}
COMMAND mkdir -p ${KERNEL_VERSION}
COMMAND mv -fv pulseblaster.ko ${DRIVER_FILE}
COMMENT "Building pulseblaster.ko for kernel version: " ${KERNEL_VERSION}
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)
#include_directories(..)
add_library(SpinCore-PulseBlaster SpinCore-PulseBlaster.cpp)
add_library(PulseBlasterProgram PulseBlasterProgram.cpp)