Clearer CMake messages for kernel driver builds

This commit is contained in:
Markus Rosenstihl 2018-04-03 14:37:21 +02:00
parent fc1701750e
commit b70d4e2127

View File

@ -24,21 +24,20 @@ add_custom_command(OUTPUT ${SPC_HEADERS}
message("\nIf you have signed the NDA from Spectrum and got a kernel driver tarball (i.e. drvsrc_all_V*.tgz), put it in:\n\n\t" ${CMAKE_CURRENT_SOURCE_DIR} "\n\nto get a kernel module built\n") message("\nIf you have signed the NDA from Spectrum and got a kernel driver tarball (i.e. drvsrc_all_V*.tgz), put it in:\n\n\t" ${CMAKE_CURRENT_SOURCE_DIR} "\n\nto get a kernel module built\n")
file(GLOB MILIST "drvsrc_all_V*.tgz" ) file(GLOB MILIST "drvsrc_all_V*.tgz" )
# sort and select last (alphabetic order) tarball driver # sort and select last (alphabetic order) tarball driver
list(SORT MILIST ) list(SORT MILIST)
list(GET MILIST -1 MITGZ ) list(GET MILIST -1 MITGZ )
message(STATUS ${MITGZ}) #message(STATUS ${MITGZ})
if(EXISTS ${MITGZ}) if(EXISTS ${MITGZ})
message(STATUS "Using spectrum driver source tarball: " ${MITGZ}) message(STATUS "Using spectrum driver source tarball: " ${MITGZ})
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv
COMMAND tar xfvz ${MITGZ} COMMAND tar xfvz ${MITGZ}
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv/makefile.kernel26 ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv/Makefile COMMAND cp -v ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv/makefile.kernel26 ${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv/Makefile
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Unpacking Spectrum driver tarball" COMMENT "Unpacking Spectrum driver tarball"
VERBATIM) VERBATIM)
set(SPC_SRC "${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv") set(SPC_SRC "${CMAKE_CURRENT_SOURCE_DIR}/linux/src_all/micx_drv")
add_custom_target(spc_smp ALL DEPENDS linux/src_all/micx_drv) add_custom_target(spc_smp ALL DEPENDS linux/src_all/micx_drv)
elseif(DEFINED ENV{SPC_SOURCE}) elseif(DEFINED ENV{SPC_SOURCE})
message(STATUS "SPC_SOURCE environment variable set:" $ENV{SPC_SOURCE}) message(STATUS "SPC_SOURCE environment variable set:" $ENV{SPC_SOURCE})
set(SPC_SRC $ENV{SPC_SOURCE}) set(SPC_SRC $ENV{SPC_SOURCE})
@ -60,18 +59,19 @@ foreach(KERNEL_DIR ${KERNEL_VERSIONS_DIR})
M=${SPC_SRC} modules) M=${SPC_SRC} modules)
add_custom_command(OUTPUT ${DRIVER_FILE} add_custom_command(OUTPUT ${DRIVER_FILE}
COMMAND ls -lr .
COMMAND ${KBUILD_CMD} COMMAND ${KBUILD_CMD}
COMMAND mkdir -p ${DRIVER_DIRECTORY}/${KERNEL_VERSION} COMMAND mkdir -p ${DRIVER_DIRECTORY}/${KERNEL_VERSION}
COMMAND mv -fv ${SPC_SRC}/spc_smp.ko ${DRIVER_DIRECTORY}/${KERNEL_VERSION}/spc_smp.ko COMMAND cp -fv ${SPC_SRC}/spc_smp.ko ${DRIVER_DIRECTORY}/${KERNEL_VERSION}/spc_smp.ko
COMMENT "Building spc_smp.ko for kernel version: " ${KERNEL_VERSION} COMMENT "Building spc_smp.ko for kernel version: " ${KERNEL_VERSION}
WORKING_DIRECTORY ${SPC_SRC} WORKING_DIRECTORY ${SPC_SRC}
VERBATIM) VERBATIM)
if(EXISTS ${SPC_SRC}) if(EXISTS ${SPC_SRC})
add_custom_target (micx_drv_${KERNEL_VERSION} ALL DEPENDS ${DRIVER_FILE} ) add_custom_target (micx_drv_${KERNEL_VERSION} ALL DEPENDS ${DRIVER_FILE} )
install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${KERNEL_VERSION}/kernel/damaris) install(FILES ${DRIVER_FILE} DESTINATION /lib/modules/${KERNEL_VERSION}/kernel/damaris)
else() else()
message(WARNING "Spectrum MI40xx kernel driver not found " ${SPC_SRC} " unpack and configure it (i.e. set SPC_SOURCE variable)") message(WARNING "Spectrum MI40xx kernel driver directory not found\n " ${SPC_SRC} "\nunpack and configure it (i.e. set SPC_SOURCE variable)")
endif() endif()
endforeach(KERNEL_DIR) endforeach(KERNEL_DIR)
add_library(Spectrum_MI40xxSeries STATIC Spectrum-MI40xxSeries.cpp GatedData.cpp ${SPC_HEADERS}) add_library(Spectrum_MI40xxSeries STATIC Spectrum-MI40xxSeries.cpp GatedData.cpp ${SPC_HEADERS})