2022-01-14 05:40:11 +00:00
# - Find_QatDrv
# Find the qat driver library and includes
#
# QatDrv_INCLUDE_DIRS = where to find cap.h, qae_mem.h, etc
# QatDrv_LIBRARIES - List of libraries when using qat driver
# QatDrv_FOUND - True if qat driver found
set ( expected_version "v1.7.L.4.14.0-00031" )
set ( expected_version_url "https://www.intel.com/content/www/us/en/download/19081/intel-quickassist-technology-intel-qat-driver-for-linux-for-intel-server-boards-and-systems-based-on-intel-62x-chipset.html" )
function ( get_qatdrv_version versionfile )
file ( STRINGS "${versionfile}" QAT_VERSION_LINE
R E G E X " ^ P A C K A G E _ V E R S I O N _ M A J O R _ N U M B E R = [ 0 - 9 ] + $ " )
string ( REGEX REPLACE "^PACKAGE_VERSION_MAJOR_NUMBER=([0-9]+)$"
" \ \ 1 " Q A T _ V E R S I O N 1 " $ { Q A T _ V E R S I O N _ L I N E } " )
unset ( QAT_VERSION_LINE )
file ( STRINGS "${versionfile}" QAT_VERSION_LINE
R E G E X " ^ P A C K A G E _ V E R S I O N _ M I N O R _ N U M B E R = [ 0 - 9 ] + $ " )
string ( REGEX REPLACE "^PACKAGE_VERSION_MINOR_NUMBER=([0-9]+)$"
" \ \ 1 " Q A T _ V E R S I O N 2 " $ { Q A T _ V E R S I O N _ L I N E } " )
unset ( QAT_VERSION_LINE )
file ( STRINGS "${versionfile}" QAT_VERSION_LINE
R E G E X " ^ P A C K A G E _ V E R S I O N _ P A T C H _ N U M B E R = [ 0 - 9 ] + $ " )
string ( REGEX REPLACE "^PACKAGE_VERSION_PATCH_NUMBER=([0-9]+)$"
" \ \ 1 " Q A T _ V E R S I O N 3 " $ { Q A T _ V E R S I O N _ L I N E } " )
unset ( QAT_VERSION_LINE )
file ( STRINGS "${versionfile}" QAT_VERSION_LINE
R E G E X " ^ P A C K A G E _ V E R S I O N _ B U I L D _ N U M B E R = [ 0 - 9 ] + $ " )
string ( REGEX REPLACE "^PACKAGE_VERSION_BUILD_NUMBER=([0-9]+)$"
" \ \ 1 " Q A T _ V E R S I O N 4 " $ { Q A T _ V E R S I O N _ L I N E } " )
set ( QatDrv_VERSION_MAJOR ${ QAT_VERSION1 } PARENT_SCOPE )
set ( QatDrv_VERSION_MINOR ${ QAT_VERSION2 } PARENT_SCOPE )
set ( QatDrv_VERSION_PATCH ${ QAT_VERSION3 } PARENT_SCOPE )
set ( QatDrv_VERSION_TWEAK ${ QAT_VERSION4 } PARENT_SCOPE )
set ( QatDrv_VERSION_COUNT 4 PARENT_SCOPE )
set ( QatDrv_VERSION ${ QAT_VERSION1 } . ${ QAT_VERSION2 } . ${ QAT_VERSION3 } . ${ QAT_VERSION4 }
P A R E N T _ S C O P E )
endfunction ( )
find_path ( QATDRV_INCLUDE_DIR
n a m e q u i c k a s s i s t / i n c l u d e / c p a . h
H I N T S $ E N V { I C P _ R O O T } / o p t / A P P / d r i v e r / Q A T
N O _ D E F A U L T _ P A T H )
if ( QATDRV_INCLUDE_DIR )
get_qatdrv_version ( ${ QATDRV_INCLUDE_DIR } /versionfile )
set ( QatDrv_INCLUDE_DIRS
$ { Q A T D R V _ I N C L U D E _ D I R } / q u i c k a s s i s t / i n c l u d e
$ { Q A T D R V _ I N C L U D E _ D I R } / q u i c k a s s i s t / i n c l u d e / d c
$ { Q A T D R V _ I N C L U D E _ D I R } / q u i c k a s s i s t / l o o k a s i d e / a c c e s s _ l a y e r / i n c l u d e
$ { Q A T D R V _ I N C L U D E _ D I R } / q u i c k a s s i s t / i n c l u d e / l a c
$ { Q A T D R V _ I N C L U D E _ D I R } / q u i c k a s s i s t / u t i l i t i e s / l i b u s d m _ d r v
$ { Q A T D R V _ I N C L U D E _ D I R } / q u i c k a s s i s t / u t i l i t i e s / l i b u s d m _ d r v / i n c l u d e )
endif ( )
foreach ( component ${ QatDrv_FIND_COMPONENTS } )
find_library ( QatDrv_ ${ component } _LIBRARIES
N A M E S $ { c o m p o n e n t }
H I N T S $ { Q A T D R V _ I N C L U D E _ D I R } / b u i l d / )
mark_as_advanced ( QatDrv_INCLUDE_DIRS
Q a t D r v _ $ { c o m p o n e n t } _ L I B R A R I E S )
list ( APPEND QatDrv_LIBRARIES "${QatDrv_${component}_LIBRARIES}" )
endforeach ( )
set ( failure_message "Please ensure QAT driver has been installed with version no less than ${expected_version}. And set the environment variable \" ICP_ROOT\ " for the QAT driver package root directory, i.e. \" export ICP_ROOT=/the/directory/of/QAT\ ". Or download and install QAT driver ${expected_version} manually at the link ${expected_version_url}. Remember to set the environment variable \" ICP_ROOT\ " for the package root directory." )
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( QatDrv
R E Q U I R E D _ V A R S Q a t D r v _ L I B R A R I E S Q a t D r v _ I N C L U D E _ D I R S
V E R S I O N _ V A R Q a t D r v _ V E R S I O N
F A I L _ M E S S A G E $ { f a i l u r e _ m e s s a g e } )
foreach ( component ${ QatDrv_FIND_COMPONENTS } )
if ( NOT TARGET QatDrv:: ${ component } )
add_library ( QatDrv:: ${ component } STATIC IMPORTED GLOBAL )
set_target_properties ( QatDrv:: ${ component } PROPERTIES
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S " $ { Q a t D r v _ I N C L U D E _ D I R S } "
2023-11-24 17:23:57 +00:00
I N T E R F A C E _ C O M P I L E _ O P T I O N S " - D H A V E _ Q A T D R V "
2022-01-14 05:40:11 +00:00
I M P O R T E D _ L I N K _ I N T E R F A C E _ L A N G U A G E S " C "
I M P O R T E D _ L O C A T I O N " $ { Q a t D r v _ $ { c o m p o n e n t } _ L I B R A R I E S } " )
endif ( )
2023-11-24 17:23:57 +00:00
# add alias targets to match FindQAT.cmake
if ( component STREQUAL "qat_s" )
add_library ( QAT::qat ALIAS QatDrv::qat_s )
elseif ( component STREQUAL "usdm_drv_s" )
add_library ( QAT::usdm ALIAS QatDrv::usdm_drv_s )
endif ( )
2022-01-14 05:40:11 +00:00
endforeach ( )