From 1e0300f54f439cf052e4f1df0ae0a97f5f9dd065 Mon Sep 17 00:00:00 2001 From: Ernest Zaslavsky Date: Tue, 5 Mar 2019 01:12:28 +0200 Subject: [PATCH] Add isa-l package (#5491) Intel(R) Intelligent Storage Acceleration Library --- ports/isal/CMakeLists.txt | 51 +++++++++++++++++++++++++++++++++++++ ports/isal/CONTROL | 4 +++ ports/isal/isalConfig.cmake | 17 +++++++++++++ ports/isal/portfile.cmake | 50 ++++++++++++++++++++++++++++++++++++ ports/isal/usage | 5 ++++ 5 files changed, 127 insertions(+) create mode 100644 ports/isal/CMakeLists.txt create mode 100644 ports/isal/CONTROL create mode 100644 ports/isal/isalConfig.cmake create mode 100644 ports/isal/portfile.cmake create mode 100644 ports/isal/usage diff --git a/ports/isal/CMakeLists.txt b/ports/isal/CMakeLists.txt new file mode 100644 index 0000000000..b479e1522f --- /dev/null +++ b/ports/isal/CMakeLists.txt @@ -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}/) \ No newline at end of file diff --git a/ports/isal/CONTROL b/ports/isal/CONTROL new file mode 100644 index 0000000000..e478ee553c --- /dev/null +++ b/ports/isal/CONTROL @@ -0,0 +1,4 @@ +Source: isal +Version: 2.25.0 +Description: Intel(R) Intelligent Storage Acceleration Library + diff --git a/ports/isal/isalConfig.cmake b/ports/isal/isalConfig.cmake new file mode 100644 index 0000000000..3348ec434f --- /dev/null +++ b/ports/isal/isalConfig.cmake @@ -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") diff --git a/ports/isal/portfile.cmake b/ports/isal/portfile.cmake new file mode 100644 index 0000000000..0fbb6f6289 --- /dev/null +++ b/ports/isal/portfile.cmake @@ -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}) diff --git a/ports/isal/usage b/ports/isal/usage new file mode 100644 index 0000000000..23870b20f7 --- /dev/null +++ b/ports/isal/usage @@ -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