From 36661740df0cd1a8a020c2a4842e047b677b56a5 Mon Sep 17 00:00:00 2001 From: fbdtemme Date: Fri, 19 Feb 2021 21:56:53 +0100 Subject: [PATCH] Add isa-l as direct dependency to fix deb package recipe --- external/external.cmake | 5 +++ external/isa-l_crypto.cmake | 67 +++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 external/isa-l_crypto.cmake diff --git a/external/external.cmake b/external/external.cmake index c68947d..419ce16 100644 --- a/external/external.cmake +++ b/external/external.cmake @@ -39,3 +39,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/termcontrol.cmake) include(${CMAKE_CURRENT_LIST_DIR}/cliprogress.cmake) include(${CMAKE_CURRENT_LIST_DIR}/dottorrent.cmake) +if (DOTTORRENT_CRYPTO_MULTIBUFFER) + include(${CMAKE_CURRENT_LIST_DIR}/isa-l_crypto.cmake) +endif() + + diff --git a/external/isa-l_crypto.cmake b/external/isa-l_crypto.cmake new file mode 100644 index 0000000..0215ffd --- /dev/null +++ b/external/isa-l_crypto.cmake @@ -0,0 +1,67 @@ +if (TARGET ISAL::Crypto) + log_target_found(ISAL::Crypto) + return() +endif() + +find_package(ISALCrypto QUIET) +if (ISALCrypto_FOUND) + log_module_found(ISALCrypto) + return() +endif() + +include(ExternalProject) +include(GNUInstallDirs) +find_program(MAKE_EXECUTABLE NAMES make nmake) + +set(isal_crypto_install_dir "${CMAKE_CURRENT_BINARY_DIR}/_deps/isa-l_crypto-install") +set(isal_crypto_install_libdir "${isal_crypto_install_dir}/${CMAKE_INSTALL_LIBDIR}") + + +if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/isa-l_crypto) + log_dir_found(isa-l_crypto) + set(isal_source_dir "${CMAKE_CURRENT_LIST_DIR}/isa-l_crypto") + + ExternalProject_Add(build-isa-l_crypto + SOURCE_DIR ${isal_source_dir} + BUILD_IN_SOURCE ON + CONFIGURE_COMMAND "./autogen.sh" + COMMAND ./configure --prefix=${isal_crypto_install_dir} --libdir=${isal_crypto_install_libdir} + BUILD_COMMAND ${MAKE_EXECUTABLE} . + INSTALL_COMMAND ${MAKE_EXECUTABLE} install + TEST_COMMAND "" + USES_TERMINAL_DOWNLOAD YES + USES_TERMINAL_UPDATE YES + ) +else() + log_fetch("isa-l_crypto") + set(isal_source_dir "${CMAKE_CURRENT_BINARY_DIR}/_deps/isa-l_crypto-src") + # Create include directory at configure time to make sure the INTERFACE_INCLUDE_DIRECTORY exists + file(MAKE_DIRECTORY ${isal_source_dir}/include) + + ExternalProject_Add(build-isa-l_crypto + GIT_REPOSITORY "https://www.github.com/intel/isa-l_crypto.git" + GIT_TAG "master" + SOURCE_DIR ${isal_source_dir} + BUILD_IN_SOURCE ON + CONFIGURE_COMMAND "./autogen.sh" + COMMAND ./configure --prefix=${isal_crypto_install_dir} --libdir=${isal_crypto_install_libdir} + BUILD_COMMAND ${MAKE_EXECUTABLE} . + INSTALL_COMMAND ${MAKE_EXECUTABLE} install + TEST_COMMAND "" + USES_TERMINAL_DOWNLOAD YES + USES_TERMINAL_UPDATE YES + ) +endif() + +add_library(ISAL::Crypto STATIC IMPORTED GLOBAL) +set_property( + TARGET ISAL::Crypto + PROPERTY IMPORTED_LOCATION ${isal_crypto_install_libdir}/libisal_crypto.a +) +set_property( + TARGET ISAL::Crypto + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${isal_source_dir}/include" +) + +add_dependencies(ISAL::Crypto build-isa-l_crypto) +add_dependencies(dottorrent ISAL::Crypto) \ No newline at end of file