2017-01-19 21:27:35 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
|
2017-01-20 09:58:42 +00:00
|
|
|
# unpack headers needed
|
2017-01-26 16:56:17 +00:00
|
|
|
set(SPC_DRV drv_header_v402b6844.zip)
|
2017-01-19 21:27:35 +00:00
|
|
|
set(SPC_HEADERS
|
|
|
|
include/spcerr.h
|
|
|
|
include/regs.h
|
|
|
|
include/dlltyp.h
|
|
|
|
include/spcioctl.inc)
|
|
|
|
|
|
|
|
add_custom_command(OUTPUT ${SPC_HEADERS}
|
2017-01-20 09:58:42 +00:00
|
|
|
COMMAND unzip -o -q -u ${SPC_DRV} "*.h" "*.txt" "*.inc" -d include/
|
2017-01-19 21:27:35 +00:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
COMMENT "Unpacking SPC headers"
|
|
|
|
VERBATIM)
|
|
|
|
|
2017-01-25 15:46:32 +00:00
|
|
|
# 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
|
2017-03-09 21:30:10 +00:00
|
|
|
# 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
|
2017-01-25 15:46:32 +00:00
|
|
|
|
2017-01-26 16:56:17 +00:00
|
|
|
if(DEFINED ENV{SPC_SOURCE})
|
2017-02-02 10:30:51 +00:00
|
|
|
message(STATUS "SPC_SOURCE environment variable set" $ENV{SPC_SOURCE})
|
2017-01-26 16:56:17 +00:00
|
|
|
set(SPC_SRC $ENV{SPC_SOURCE})
|
|
|
|
else()
|
|
|
|
set(SPC_SRC ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv)
|
2017-03-10 12:20:44 +00:00
|
|
|
message(WARNING "Spectrum driver source path not defined in envirnoment variable SPC_SOURCE, using default:" ${SPC_SOURCE})
|
2017-01-26 16:56:17 +00:00
|
|
|
endif()
|
2017-01-20 09:58:42 +00:00
|
|
|
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)
|
2017-01-26 16:57:53 +00:00
|
|
|
if(EXISTS ${SPC_SRC})
|
2017-01-25 15:46:32 +00:00
|
|
|
add_custom_target (micx_drv ALL DEPENDS ${DRIVER_FILE} )
|
|
|
|
install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${CMAKE_SYSTEM_VERSION}/kernel/damaris)
|
|
|
|
|
2017-01-20 09:58:42 +00:00
|
|
|
else()
|
2017-03-09 21:30:10 +00:00
|
|
|
message(WARNING "Spectrum MI40xx kernel driver not found " ${SPC_SRC} " unpack and configure it (i.e. set SPC_SOURCE variable")
|
2017-01-20 09:58:42 +00:00
|
|
|
endif()
|
2017-01-19 21:27:35 +00:00
|
|
|
add_library(Spectrum_MI40xxSeries STATIC Spectrum-MI40xxSeries.cpp GatedData.cpp ${SPC_HEADERS})
|
|
|
|
|
2017-03-09 21:30:10 +00:00
|
|
|
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})
|
|
|
|
|
2017-03-09 21:30:10 +00:00
|
|
|
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})
|