mirror of
https://github.com/ceph/ceph
synced 2026-08-01 22:45:39 +00:00
cmake/crypto: use ExternalProject to build isal crypto library
instead of building isa-l_crypto source files directly into the ceph_crypto_isal plugin, use a cmake ExternalProject to build the library with make and expose the static library as cmake target ISAL::Crypto Signed-off-by: Casey Bodley <cbodley@redhat.com>
This commit is contained in:
parent
5e51a6efe3
commit
3bfc1ae3d7
31
cmake/modules/BuildISALCrypto.cmake
Normal file
31
cmake/modules/BuildISALCrypto.cmake
Normal file
@ -0,0 +1,31 @@
|
||||
# use an ExternalProject to build isa-l_crypto using its makefile
|
||||
function(build_isal_crypto)
|
||||
set(ISAL_CRYPTO_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/crypto/isa-l/isa-l_crypto)
|
||||
set(ISAL_CRYPTO_INCLUDE_DIR "${ISAL_CRYPTO_SOURCE_DIR}/include")
|
||||
set(ISAL_CRYPTO_LIBRARY "${ISAL_CRYPTO_SOURCE_DIR}/bin/isa-l_crypto.a")
|
||||
|
||||
include(FindMake)
|
||||
find_make("MAKE_EXECUTABLE" "make_cmd")
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(isal_crypto_ext
|
||||
SOURCE_DIR ${ISAL_CRYPTO_SOURCE_DIR}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ${make_cmd} -f <SOURCE_DIR>/Makefile.unx
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_BYPRODUCTS ${ISAL_CRYPTO_LIBRARY}
|
||||
INSTALL_COMMAND ""
|
||||
UPDATE_COMMAND ""
|
||||
LOG_CONFIGURE ON
|
||||
LOG_BUILD ON
|
||||
LOG_MERGED_STDOUTERR ON
|
||||
LOG_OUTPUT_ON_FAILURE ON)
|
||||
|
||||
# add imported library target ISAL::Crypto
|
||||
add_library(ISAL::Crypto STATIC IMPORTED GLOBAL)
|
||||
add_dependencies(ISAL::Crypto isal_crypto_ext)
|
||||
set_target_properties(ISAL::Crypto PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${ISAL_CRYPTO_INCLUDE_DIR}
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
||||
IMPORTED_LOCATION ${ISAL_CRYPTO_LIBRARY})
|
||||
endfunction()
|
||||
@ -1,36 +1,17 @@
|
||||
set(isal_dir ${CMAKE_SOURCE_DIR}/src/crypto/isa-l/isa-l_crypto)
|
||||
set(CMAKE_ASM_FLAGS "-i ${isal_dir}/aes/ -i ${isal_dir}/include/ ${CMAKE_ASM_FLAGS}")
|
||||
# build isa-l_crypto from its makefile and expose as target ISAL::Crypto
|
||||
include(BuildISALCrypto)
|
||||
build_isal_crypto()
|
||||
|
||||
set(isal_crypto_plugin_srcs
|
||||
isal_crypto_accel.cc
|
||||
isal_crypto_plugin.cc
|
||||
${isal_dir}/aes/cbc_pre.c
|
||||
${isal_dir}/aes/cbc_multibinary.asm
|
||||
${isal_dir}/aes/keyexp_128.asm
|
||||
${isal_dir}/aes/keyexp_192.asm
|
||||
${isal_dir}/aes/keyexp_256.asm
|
||||
${isal_dir}/aes/keyexp_multibinary.asm
|
||||
${isal_dir}/aes/cbc_dec_128_x4_sse.asm
|
||||
${isal_dir}/aes/cbc_dec_128_x8_avx.asm
|
||||
${isal_dir}/aes/cbc_dec_192_x4_sse.asm
|
||||
${isal_dir}/aes/cbc_dec_192_x8_avx.asm
|
||||
${isal_dir}/aes/cbc_dec_256_x4_sse.asm
|
||||
${isal_dir}/aes/cbc_dec_256_x8_avx.asm
|
||||
${isal_dir}/aes/cbc_enc_128_x4_sb.asm
|
||||
${isal_dir}/aes/cbc_enc_128_x8_sb.asm
|
||||
${isal_dir}/aes/cbc_enc_192_x4_sb.asm
|
||||
${isal_dir}/aes/cbc_enc_192_x8_sb.asm
|
||||
${isal_dir}/aes/cbc_enc_256_x4_sb.asm
|
||||
${isal_dir}/aes/cbc_enc_256_x8_sb.asm)
|
||||
isal_crypto_plugin.cc)
|
||||
|
||||
if(HAVE_NASM_X64)
|
||||
add_dependencies(crypto_plugins ceph_crypto_isal)
|
||||
endif(HAVE_NASM_X64)
|
||||
|
||||
add_library(ceph_crypto_isal SHARED ${isal_crypto_plugin_srcs})
|
||||
target_include_directories(ceph_crypto_isal PRIVATE ${isal_dir}/include)
|
||||
|
||||
target_link_libraries(ceph_crypto_isal PRIVATE Boost::context)
|
||||
target_link_libraries(ceph_crypto_isal PRIVATE ISAL::Crypto Boost::context)
|
||||
|
||||
set_target_properties(ceph_crypto_isal PROPERTIES
|
||||
VERSION 1.0.0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user