damaris-backends/drivers/Spectrum-MI40xxSeries/CMakeLists.txt

56 lines
2.2 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.0)
# unpack headers needed
set(SPC_DRV drv_header_v402b6844.zip)
set(SPC_HEADERS
include/spcerr.h
include/regs.h
include/dlltyp.h
include/spcioctl.inc)
add_custom_command(OUTPUT ${SPC_HEADERS}
COMMAND unzip -o -q -u ${SPC_DRV} "*.h" "*.txt" "*.inc" -d include/
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Unpacking SPC headers"
VERBATIM)
# Kernelmodule is build from NDA source code.
# just go to the current directory and tar xfz drvsrc_all_V*.tgz
# this will usually create a "linux" folder
# the actual kernel source file is in the src_all/micx_drv subfolder.
# If the "linux" folder exists the driver will be build.
# Alternatively you can set the SPC_SOURCE environment variable to the micx_drv folder
if(DEFINED ENV{SPC_SOURCE})
message(STATUS "SPC_SOURCE environment variable set" $ENV{SPC_SOURCE})
set(SPC_SRC $ENV{SPC_SOURCE})
else()
set(SPC_SRC ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv)
message(WARNING "Spectrum driver source path not defined in envirnoment variable SPC_SOURCE, using default:" ${SPC_SOURCE})
endif()
set(DRIVER_FILE ${SPC_SRC}/spc_smp.ko )
set(KERNEL_DIR "/lib/modules/${CMAKE_SYSTEM_VERSION}/build" )
set(KBUILD_CMD ${CMAKE_MAKE_PROGRAM}
-C ${KERNEL_DIR}
M=${SPC_SRC} modules)
add_custom_command(OUTPUT ${DRIVER_FILE}
COMMAND ${KBUILD_CMD}
COMMENT "Building spc_smp.ko"
WORKING_DIRECTORY ${SPC_SRC}
VERBATIM)
if(EXISTS ${SPC_SRC})
add_custom_target (micx_drv ALL DEPENDS ${DRIVER_FILE} )
install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${CMAKE_SYSTEM_VERSION}/kernel/damaris)
else()
message(WARNING "Spectrum MI40xx kernel driver not found " ${SPC_SRC} " unpack and configure it (i.e. set SPC_SOURCE variable")
endif()
add_library(Spectrum_MI40xxSeries STATIC Spectrum-MI40xxSeries.cpp GatedData.cpp ${SPC_HEADERS})
add_executable(hw_test_ext hw_test_extclock.cpp GatedData.cpp ${SPC_HEADERS})
2017-02-06 21:31:58 +00:00
#target_sources(hw_test_ext PRIVATE ${SPC_HEADERS})
add_executable(hw_test_int hw_test_intclock.cpp GatedData.cpp ${SPC_HEADERS})
2017-02-06 21:31:58 +00:00
#target_include_directories(hw_test_int ${SPC_HEADERS})