Add isa-l package (#5491)

Intel(R) Intelligent Storage Acceleration Library
This commit is contained in:
Ernest Zaslavsky 2019-03-05 01:12:28 +02:00 committed by Phil Christensen
parent 660ba9e990
commit 1e0300f54f
5 changed files with 127 additions and 0 deletions

51
ports/isal/CMakeLists.txt Normal file
View File

@ -0,0 +1,51 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(isal C)
IF (SOURCE_PATH)
SET(CMAKE_SOURCE_DIR ${SOURCE_PATH})
ENDIF ()
INCLUDE(ProcessorCount)
PROCESSORCOUNT(PROCS)
FIND_PROGRAM(NASM nasm)
IF (NOT NASM)
MESSAGE(FATAL_ERROR "NASM not found")
ENDIF ()
IF (EXEC_ENV STREQUAL "Windows")
FIND_PROGRAM(MAKE nmake)
IF (NOT MAKE)
MESSAGE(FATAL_ERROR "nmake not found")
ENDIF ()
ELSEIF(EXEC_ENV STREQUAL "Linux")
FIND_PROGRAM(MAKE make)
IF (NOT MAKE)
MESSAGE(FATAL_ERROR "MAKE not found")
ENDIF ()
ENDIF()
SET(MAKE_FLAGS "-f")
IF (EXEC_ENV STREQUAL Windows)
STRING(APPEND MAKE_FLAGS " Makefile.nmake /E CC=cl AS=nasm")
ELSEIF (EXEC_ENV STREQUAL Linux)
STRING(APPEND MAKE_FLAGS "Makefile.unx")
ENDIF ()
ADD_CUSTOM_TARGET(isal ALL
COMMAND ${MAKE} ${MAKE_FLAGS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/
)
SET(LIB_PATH ${CMAKE_SOURCE_DIR}/bin/)
IF (LIBRARY_LINKAGE STREQUAL "dynamic")
STRING(APPEND LIB_PATH isal.so)
ELSEIF (LIBRARY_LINKAGE STREQUAL "static")
STRING(APPEND LIB_PATH isa-l.a)
ELSE ()
MESSAGE(FATAL_ERROR "Unknown linkage type ${LIBRARY_LINKAGE}")
ENDIF ()
INSTALL(FILES ${LIB_PATH}
DESTINATION ${CMAKE_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/lib/)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include DESTINATION ${CMAKE_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/)

4
ports/isal/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: isal
Version: 2.25.0
Description: Intel(R) Intelligent Storage Acceleration Library

View File

@ -0,0 +1,17 @@
FUNCTION(SET_LIBRARY_TARGET NAMESPACE LIB_NAME DEBUG_LIB_FILE_NAME RELEASE_LIB_FILE_NAME INCLUDE_DIR)
ADD_LIBRARY(${NAMESPACE}::${LIB_NAME} STATIC IMPORTED)
SET_TARGET_PROPERTIES(${NAMESPACE}::${LIB_NAME} PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${RELEASE_LIB_FILE_NAME}"
IMPORTED_LOCATION_DEBUG "${DEBUG_LIB_FILE_NAME}"
INTERFACE_INCLUDE_DIRECTORIES "${INCLUDE_DIR}"
)
SET(${NAMESPACE}_${LIB_NAME}_FOUND 1)
ENDFUNCTION()
GET_FILENAME_COMPONENT(ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(ROOT "${ROOT}" PATH)
GET_FILENAME_COMPONENT(ROOT "${ROOT}" PATH)
SET_LIBRARY_TARGET("ISAL" "isal" "${ROOT}/debug/lib/isa-l.a" "${ROOT}/lib/isa-l.a" "${ROOT}/include/isal")

50
ports/isal/portfile.cmake Normal file
View File

@ -0,0 +1,50 @@
INCLUDE(vcpkg_common_functions)
IF (NOT VCPKG_CMAKE_SYSTEM_NAME)
SET(EXEC_ENV "Windows")
ELSE ()
SET(EXEC_ENV "${VCPKG_CMAKE_SYSTEM_NAME}")
ENDIF ()
IF (NOT EXEC_ENV STREQUAL "Linux")
MESSAGE(FATAL_ERROR "Intel(R) Intelligent Storage Acceleration Library currently only supports Linux platforms")
MESSAGE(STATUS "Well, it is not true, but I didnt manage to get it working on Windows")
ENDIF ()
IF (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
MESSAGE(FATAL_ERROR "Intel(R) Intelligent Storage Acceleration Library currently only supports x64 architecture")
ELSEIF (NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
MESSAGE(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
ENDIF ()
VCPKG_FROM_GITHUB(
OUT_SOURCE_PATH SOURCE_PATH
REPO 01org/isa-l
REF v2.25.0
SHA512 aa556c8ba26b4637493b3de50a23636668bcfd71249029c52fe6983d0bcf120d1b91f39aaa259cb58e59448d401366f3bfaaee24609db7e6a1cd3fdf1a953efe
HEAD_REF master
)
VCPKG_FIND_ACQUIRE_PROGRAM(NASM)
GET_FILENAME_COMPONENT(NASM_PATH ${NASM} DIRECTORY)
SET(ENV{PATH} "$ENV{PATH};${NASM_PATH}")
VCPKG_CONFIGURE_CMAKE(
SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}
PREFER_NINJA
OPTIONS
-DSOURCE_PATH=${SOURCE_PATH}
-DEXEC_ENV:STRING=${EXEC_ENV}
-DLIBRARY_LINKAGE:STRING=${VCPKG_LIBRARY_LINKAGE}
)
VCPKG_INSTALL_CMAKE()
FILE(INSTALL ${SOURCE_PATH}/Release/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
FILE(INSTALL ${SOURCE_PATH}/Debug/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
FILE(INSTALL ${SOURCE_PATH}/Release/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT})
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/isalConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
FILE(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
#VCPKG_TEST_CMAKE(PACKAGE_NAME ${PORT})

5
ports/isal/usage Normal file
View File

@ -0,0 +1,5 @@
The package isal is compatible with built-in CMake targets:
FIND_PACKAGE(isal REQUIRED)
TARGET_LINK_LIBRARIES(main PRIVATE ISAL::isa-l) for static linkage or
TARGET_LINK_LIBRARIES(main PRIVATE ISAL::isal) for dynamic linkage