SPDK - Storage performance development kit (#5877)

This commit is contained in:
Ernest Zaslavsky 2019-05-01 22:59:11 +03:00 committed by Phil Christensen
parent 1e0b106d15
commit 3468013fcd
25 changed files with 750 additions and 0 deletions

View File

@ -0,0 +1,63 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(dpdk C)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}")
INCLUDE(ProcessorCount)
PROCESSORCOUNT(PROCS)
#ARCH can be: i686, x86_64, ppc_64, arm64
#MACHINE can be: native, power8, armv8a
#EXECENV can be: linuxapp, bsdapp
#TOOLCHAIN can be: gcc, icc
SET(ARCH x86_64)
SET(MACHINE native)
SET(EXECENV linuxapp)
SET(TOOLCHAIN gcc)
IF (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
SET(ARCH "i686")
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
SET(MACHINE arm8a)
ELSEIF (CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
SET(MACHINE power8)
SET(ARCH ppc_64)
ENDIF ()
IF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
SET(EXECENV bsdapp)
ENDIF ()
FIND_PACKAGE(Numa REQUIRED)
FIND_PROGRAM(MAKE make)
SET(DPDK_CFLAGS "-fPIC")
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
STRING(APPEND ${DPDK_CFLAGS} "-O0 -g")
ENDIF ()
SET(DPDK_TARGET ${ARCH}-${MACHINE}-${EXECENV}-${TOOLCHAIN})
#SET(DPDK_CONFIG O=${CMAKE_BUILD_TYPE}/build T=${DPDK_TARGET})
SET(DPDK_CONFIG "T=${DPDK_TARGET}")
IF (SOURCE_PATH)
SET(CMAKE_SOURCE_DIR ${SOURCE_PATH})
ENDIF ()
ADD_CUSTOM_TARGET(dpdk-configure
COMMAND ${MAKE} config ${DPDK_CONFIG}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/
VERBATIM
)
ADD_CUSTOM_TARGET(dpdk ALL
COMMAND ${MAKE} EXTRA_CFLAGS=\"${DPDK_CFLAGS}\" MAKEFLAGS=\"${DPDK_CONFIG} -j ${PROCS}\"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/
)
ADD_DEPENDENCIES(dpdk dpdk-configure)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/build/lib
DESTINATION ${CMAKE_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/)

4
ports/spdk-dpdk/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: spdk-dpdk
Version: 20181124
Description: SPDK mirror of DPDK. A set of libraries and drivers for fast packet processing

View File

@ -0,0 +1,26 @@
INCLUDE(FindPackageHandleStandardArgs)
FIND_PATH(NUMA_ROOT_DIR
NAMES include/numa.h
PATHS ENV NUMA_ROOT
DOC "NUMA library root directory")
FIND_PATH(NUMA_INCLUDE_DIR
NAMES numa.h
HINTS ${NUMA_ROOT_DIR}
PATH_SUFFIXES include
DOC "NUMA include directory")
FIND_LIBRARY(NUMA_LIBRARY
NAMES numa
HINTS ${NUMA_ROOT_DIR}
DOC "NUMA library file")
IF (NUMA_LIBRARY)
GET_FILENAME_COMPONENT(NUMA_LIBRARY_DIR ${NUMA_LIBRARY} PATH)
MARK_AS_ADVANCED(NUMA_INCLUDE_DIR NUMA_LIBRARY_DIR NUMA_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NUMA REQUIRED_VARS NUMA_ROOT_DIR NUMA_INCLUDE_DIR NUMA_LIBRARY)
ELSE ()
SET(NUMA_FOUND FALSE)
MESSAGE(FATAL_ERROR "Numa library not found.\nTry: 'sudo yum install numactl numactl-devel' (or sudo apt-get install libnuma1 libnuma-dev)")
ENDIF ()

View File

@ -0,0 +1,47 @@
INCLUDE(vcpkg_common_functions)
IF (NOT VCPKG_CMAKE_SYSTEM_NAME OR NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
MESSAGE(FATAL_ERROR "Intel dpdk currently only supports Linux/BSD platforms")
ENDIF ()
VCPKG_FROM_GITHUB(
OUT_SOURCE_PATH SOURCE_PATH
REPO spdk/dpdk
REF spdk-18.11
SHA512 9c069bb0e445f8287ee056452fa32263746f78e27377e8fd75809b9ebf7f25c2395ee13ae4804d8c464e5bc7db7335692759ab3202748dd0c82243aad35e5e7c
HEAD_REF master
)
FIND_PATH(NUMA_INCLUDE_DIR NAME numa.h
PATHS ENV NUMA_ROOT
HINTS $ENV{HOME}/local/include /opt/local/include /usr/local/include /usr/include
)
IF (NOT NUMA_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Numa library not found.\nTry: 'sudo yum install numactl numactl-devel' (or sudo apt-get install libnuma1 libnuma-dev)")
ENDIF ()
VCPKG_CONFIGURE_CMAKE(
SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}
PREFER_NINJA
OPTIONS
-DSOURCE_PATH=${SOURCE_PATH}
)
VCPKG_INSTALL_CMAKE()
# Headers are symbolic links here, gather all, resolve and copy real files
FILE(GLOB_RECURSE HEADERS FOLLOW_SYMLINKS "${SOURCE_PATH}/build/include/*")
SET(REAL_FILES "")
FOREACH (HEADER ${HEADERS})
GET_FILENAME_COMPONENT(REAL_FILE "${HEADER}" REALPATH)
LIST(APPEND REAL_FILES "${REAL_FILE}")
ENDFOREACH ()
FILE(INSTALL ${SOURCE_PATH}/Release/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib/spdk)
FILE(INSTALL ${SOURCE_PATH}/Debug/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/spdk)
FILE(INSTALL ${REAL_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT})
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/spdk-dpdkConfig.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/README DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
VCPKG_TEST_CMAKE(PACKAGE_NAME ${PORT})

View File

@ -0,0 +1,31 @@
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(DPDK_ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(DPDK_ROOT "${DPDK_ROOT}" PATH)
GET_FILENAME_COMPONENT(DPDK_ROOT "${DPDK_ROOT}" PATH)
SET_LIBRARY_TARGET("SPDK" "dpdk" "${DPDK_ROOT}/debug/lib/spdk/libdpdk.a" "${DPDK_ROOT}/lib/spdk/libdpdk.a" "${DPDK_ROOT}/include/spdk-dpdk")
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
LINK_DIRECTORIES(${DPDK_ROOT}/debug/lib/spdk)
ELSE ()
LINK_DIRECTORIES(${DPDK_ROOT}/lib/spdk)
ENDIF ()
FILE(GLOB DPDK_LIBS ${DPDK_ROOT}/lib/spdk/librte*.*)
FOREACH (LIB_FILE_NAME ${DPDK_LIBS})
GET_FILENAME_COMPONENT(LIB_NAME ${LIB_FILE_NAME} NAME_WE)
GET_FILENAME_COMPONENT(FULL_LIB_NAME ${LIB_FILE_NAME} NAME)
STRING(REPLACE "lib" "" LIB_NAME "${LIB_NAME}")
SET_LIBRARY_TARGET("SPDK" "${LIB_NAME}" "${DPDK_ROOT}/debug/lib/spdk/${FULL_LIB_NAME}" "${DPDK_ROOT}/lib/spdk/${FULL_LIB_NAME}" "${DPDK_ROOT}/include/spdk-dpdk")
ENDFOREACH ()

1
ports/spdk-dpdk/usage Normal file
View File

@ -0,0 +1 @@
This package is a dependency of SPDK port. It is not intended for direct consumption by end-user.

View File

@ -0,0 +1,59 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(ipsec 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 ()
FIND_PROGRAM(MAKE make)
IF (NOT MAKE)
MESSAGE(FATAL_ERROR "MAKE not found")
ENDIF ()
IF (EXEC_ENV STREQUAL "Windows")
FIND_PROGRAM(MAKE nmake)
IF (NOT MAKE)
MESSAGE(FATAL_ERROR "nmake not found")
ENDIF ()
ENDIF ()
SET(MAKE_FLAGS)
IF (EXEC_ENV STREQUAL Windows)
LIST(APPEND MAKE_FLAGS /f win_x64.mak)
ENDIF ()
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
LIST(APPEND MAKE_FLAGS DEBUG=y)
ENDIF ()
IF (LIBRARY_LINKAGE STREQUAL "static")
LIST(APPEND MAKE_FLAGS SHARED=n)
ENDIF ()
MESSAGE(STATUS "${MAKE_FLAGS}")
ADD_CUSTOM_TARGET(ipsec-mb ALL
COMMAND ${MAKE} -j ${MAKE_FLAGS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/
# VERBATIM
)
SET(LIB_PATH ${CMAKE_SOURCE_DIR}/)
IF (LIBRARY_LINKAGE STREQUAL "dynamic")
STRING(APPEND LIB_PATH libIPSec_MB.so)
ELSEIF (LIBRARY_LINKAGE STREQUAL "static")
STRING(APPEND LIB_PATH libIPSec_MB.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/spdk-ipsec/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: spdk-ipsec
Version: 20180711
Description: SPDK mirror of ipsec. Intel(R) Multi-Buffer Crypto for IPsec Library

View File

@ -0,0 +1,62 @@
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) Multi-Buffer Crypto for IPsec Library currently only supports Linux/Windows 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) Multi-Buffer Crypto for IPsec 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 spdk/intel-ipsec-mb
REF spdk
SHA512 037fc382d9aa87b6645309f29cb761a584ed855c583638c9e27b5b7200ceb2ae21ad5adcc7c92b2b1d1387186a7fd2b5ae22f337a8f52dea3f6c35d8f90b42bd
HEAD_REF master
)
VCPKG_FIND_ACQUIRE_PROGRAM(NASM)
EXEC_PROGRAM(${NASM}
ARGS -v
OUTPUT_VARIABLE NASM_OUTPUT
)
STRING(REGEX REPLACE "NASM version ([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1"
NASM_VERSION
${NASM_OUTPUT})
IF (NASM_VERSION VERSION_LESS 2.13.03)
MESSAGE(FATAL_ERROR "NASM version 2.13.03 (or newer) is required to build this package")
ENDIF ()
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=${VCPKG_CMAKE_SYSTEM_NAME}
-DLIBRARY_LINKAGE=${VCPKG_LIBRARY_LINKAGE}
)
VCPKG_INSTALL_CMAKE()
FILE(INSTALL ${SOURCE_PATH}/Release/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/lib/spdk)
FILE(INSTALL ${SOURCE_PATH}/Debug/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/spdk)
FILE(INSTALL ${SOURCE_PATH}/Release/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT})
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/spdk-ipsecConfig.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})

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("SPDK" "ipsec" "${ROOT}/debug/lib/spdk/libIPSec_MB.a" "${ROOT}/lib/spdk/libIPSec_MB.a" "${ROOT}/include/spdk-ipsec")

1
ports/spdk-ipsec/usage Normal file
View File

@ -0,0 +1 @@
This package is a dependency of SPDK port. It is not intended for direct consumption by end-user.

View File

@ -0,0 +1,56 @@
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 ()
FIND_PROGRAM(YASM yasm)
IF (NOT YASM)
MESSAGE(FATAL_ERROR "YASM 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/spdk-isal/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: spdk-isal
Version: 20181006
Description: SPDK mirror of isa-l. Intel(R) Intelligent Storage Acceleration Library

View File

@ -0,0 +1,52 @@
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 spdk/isa-l
REF spdk
SHA512 1d170ed050fb612816c77b3586f1cdce9129eedc559e3fcefc983ede05b6c8e13a52e400ee6935f5da6ab045a899c97f6ed6be3a79691284e211ea8a6d697f7c
HEAD_REF master
)
VCPKG_FIND_ACQUIRE_PROGRAM(NASM)
GET_FILENAME_COMPONENT(NASM_PATH ${NASM} DIRECTORY)
SET(ENV{PATH} "$ENV{PATH};${NASM_PATH}")
VCPKG_FIND_ACQUIRE_PROGRAM(YASM)
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/spdk)
FILE(INSTALL ${SOURCE_PATH}/Debug/lib/ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/spdk)
FILE(INSTALL ${SOURCE_PATH}/Release/include/ DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT})
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/spdk-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})

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("SPDK" "isal" "${ROOT}/debug/lib/spdk/isa-l.a" "${ROOT}/lib/spdk/isa-l.a" "${ROOT}/include/spdk-isal")

1
ports/spdk-isal/usage Normal file
View File

@ -0,0 +1 @@
This package is a dependency of SPDK port. It is not intended for direct consumption by end-user.

45
ports/spdk/CMakeLists.txt Normal file
View File

@ -0,0 +1,45 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
PROJECT(spdk C)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}")
FIND_PACKAGE(Numa REQUIRED)
FIND_PACKAGE(uuid REQUIRED)
FIND_PACKAGE(ibverbs REQUIRED)
FIND_PACKAGE(RDMA REQUIRED)
FIND_PACKAGE(OpenSSL REQUIRED)
FIND_PACKAGE(Python COMPONENTS Interpreter REQUIRED)
FIND_PROGRAM(MAKE make)
IF (SOURCE_PATH)
SET(CMAKE_SOURCE_DIR ${SOURCE_PATH})
ENDIF ()
SET(SPDK_CONFIG --disable-tests --with-rdma --without-isal --with-dpdk=${CMAKE_SOURCE_DIR}/../../../spdk-dpdk/src/spdk-18.11-411c51fb97/build)
# No option to define path for isa-l (--with-isal=${CMAKE_SOURCE_DIR}/../../../spdk-isal/src/spdk-d34ebb51cd)
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
LIST(APPEND ${SPDK_CONFIG} --enable-debug)
ENDIF ()
SET(DPDK_CONFIG "-fPIC")
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
STRING(APPEND ${DPDK_CONFIG} "-O0 -g")
ENDIF ()
ADD_CUSTOM_TARGET(spdk-configure
COMMAND ./configure ${SPDK_CONFIG}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/
VERBATIM
)
ADD_CUSTOM_TARGET(spdk ALL
COMMAND ${MAKE} -j DPDK_CFLAGS=${DPDK_CONFIG}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/
)
ADD_DEPENDENCIES(spdk spdk-configure)
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/build/lib
DESTINATION ${CMAKE_SOURCE_DIR}/${CMAKE_BUILD_TYPE}/)

4
ports/spdk/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: spdk
Version: 19.01.1
Description: Storage Performance Development Kit
Build-Depends: spdk-dpdk, spdk-ipsec, spdk-isal

26
ports/spdk/FindNuma.cmake Normal file
View File

@ -0,0 +1,26 @@
INCLUDE(FindPackageHandleStandardArgs)
FIND_PATH(NUMA_ROOT_DIR
NAMES include/numa.h
PATHS ENV NUMA_ROOT
DOC "NUMA library root directory")
FIND_PATH(NUMA_INCLUDE_DIR
NAMES numa.h
HINTS ${NUMA_ROOT_DIR}
PATH_SUFFIXES include
DOC "NUMA include directory")
FIND_LIBRARY(NUMA_LIBRARY
NAMES numa
HINTS ${NUMA_ROOT_DIR}
DOC "NUMA library file")
IF (NUMA_LIBRARY)
GET_FILENAME_COMPONENT(NUMA_LIBRARY_DIR ${NUMA_LIBRARY} PATH)
MARK_AS_ADVANCED(NUMA_INCLUDE_DIR NUMA_LIBRARY_DIR NUMA_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(NUMA REQUIRED_VARS NUMA_ROOT_DIR NUMA_INCLUDE_DIR NUMA_LIBRARY)
ELSE ()
SET(NUMA_FOUND FALSE)
MESSAGE(FATAL_ERROR "Numa library not found.\nTry: 'sudo yum install numactl numactl-devel' (or sudo apt-get install libnuma1 libnuma-dev)")
ENDIF ()

32
ports/spdk/FindRDMA.cmake Normal file
View File

@ -0,0 +1,32 @@
FIND_PATH(RDMA_INCLUDE_DIR rdma/rdma_cma.h
/usr/include
/usr/include/linux
/usr/local/include
)
FIND_LIBRARY(RDMA_LIBRARY NAMES rdmacm
PATHS
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
/lib/i386-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
)
INCLUDE(FindPackageHandleStandardArgs)
IF (APPLE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RDMA DEFAULT_MSG
RDMA_INCLUDE_DIR)
ELSE ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RDMA DEFAULT_MSG
RDMA_LIBRARY RDMA_INCLUDE_DIR)
ENDIF ()
MARK_AS_ADVANCED(RDMA_INCLUDE_DIR RDMA_LIBRARY)
IF (NOT RDMA_LIBRARY)
SET(RDMA_FOUND FALSE)
MESSAGE(FATAL_ERROR "RDMA library not found.\nTry: 'sudo yum install librdmacm-devel librdmacm' (or sudo apt-get install librdmacm-dev librdmacm1)")
ENDIF ()

View File

@ -0,0 +1,34 @@
# Find the ibverbs libraries
#
# The following variables are optionally searched for defaults
# IBVERBS_ROOT_DIR: Base directory where all ibverbs components are found
# IBVERBS_INCLUDE_DIR: Directory where ibverbs headers are found
# IBVERBS_LIB_DIR: Directory where ibverbs libraries are found
# The following are set after configuration is done:
# IBVERBS_FOUND
# IBVERBS_INCLUDE_DIRS
# IBVERBS_LIBRARIES
FIND_PATH(IBVERBS_INCLUDE_DIRS
NAMES infiniband/verbs.h
HINTS
${IBVERBS_INCLUDE_DIR}
${IBVERBS_ROOT_DIR}
${IBVERBS_ROOT_DIR}/include)
FIND_LIBRARY(IBVERBS_LIBRARIES
NAMES ibverbs
HINTS
${IBVERBS_LIB_DIR}
${IBVERBS_ROOT_DIR}
${IBVERBS_ROOT_DIR}/lib)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ibverbs DEFAULT_MSG IBVERBS_INCLUDE_DIRS IBVERBS_LIBRARIES)
MARK_AS_ADVANCED(IBVERBS_INCLUDE_DIR IBVERBS_LIBRARIES)
IF (NOT IBVERBS_LIBRARIES)
SET(IBVERBS_FOUND FALSE)
MESSAGE(FATAL_ERROR "ibverbs library not found.\nTry: 'sudo yum install libibverbs-devel libibverbs' (or sudo apt-get install libibverbs-dev libibverbs1)")
ENDIF ()

49
ports/spdk/Finduuid.cmake Normal file
View File

@ -0,0 +1,49 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h
/usr/include
/usr/include/linux
/usr/local/include
)
FIND_LIBRARY(UUID_LIBRARY NAMES uuid
PATHS
/usr/lib
/usr/local/lib
/usr/lib64
/usr/local/lib64
/lib/i386-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
)
INCLUDE(FindPackageHandleStandardArgs)
IF (APPLE)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(UUID DEFAULT_MSG
UUID_INCLUDE_DIR)
ELSE ()
FIND_PACKAGE_HANDLE_STANDARD_ARGS(UUID DEFAULT_MSG
UUID_LIBRARY UUID_INCLUDE_DIR)
ENDIF ()
MARK_AS_ADVANCED(UUID_INCLUDE_DIR UUID_LIBRARY)
IF (NOT UUID_LIBRARY)
SET(UUID_FOUND FALSE)
MESSAGE(FATAL_ERROR "UUID library not found.\nTry: 'sudo yum install libuuid uuid-devel' (or sudo apt-get install libuuid1 uuid-dev)")
ENDIF ()

42
ports/spdk/portfile.cmake Normal file
View File

@ -0,0 +1,42 @@
INCLUDE(vcpkg_common_functions)
IF (NOT VCPKG_CMAKE_SYSTEM_NAME OR NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
MESSAGE(FATAL_ERROR "Intel spdk currently only supports Linux/BSD platforms")
ENDIF ()
VCPKG_FROM_GITHUB(
OUT_SOURCE_PATH SOURCE_PATH
REPO spdk/spdk
REF v19.01.1
SHA512 cb2c085e1a5d370df60599aaeb6302f8252626342a9e0644018df8c769f406304591680f905572848390c3139e640496f96e3b4fc67469c56eb9a5329aee4b24
HEAD_REF master
)
FIND_PATH(NUMA_INCLUDE_DIR NAME numa.h
PATHS ENV NUMA_ROOT
HINTS $ENV{HOME}/local/include /opt/local/include /usr/local/include /usr/include
)
IF (NOT NUMA_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Numa library not found.\nTry: 'sudo yum install numactl numactl-devel' (or sudo apt-get install libnuma1 libnuma-dev)")
ENDIF ()
VCPKG_CONFIGURE_CMAKE(
SOURCE_PATH ${CMAKE_CURRENT_LIST_DIR}
PREFER_NINJA
OPTIONS
-DSOURCE_PATH=${SOURCE_PATH}
)
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}/include/spdk DESTINATION ${CURRENT_PACKAGES_DIR}/include/${PORT})
FILE(INSTALL ${SOURCE_PATH}/scripts/setup.sh DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}/scripts)
FILE(INSTALL ${SOURCE_PATH}/scripts/common.sh DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}/scripts)
FILE(INSTALL ${SOURCE_PATH}/include/spdk/pci_ids.h DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}/include/spdk)
FILE(INSTALL ${CMAKE_CURRENT_LIST_DIR}/spdkConfig.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})

View File

@ -0,0 +1,29 @@
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(SPDK_ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
GET_FILENAME_COMPONENT(SPDK_ROOT "${SPDK_ROOT}" PATH)
GET_FILENAME_COMPONENT(SPDK_ROOT "${SPDK_ROOT}" PATH)
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
LINK_DIRECTORIES(${SPDK_ROOT}/debug/lib/)
ELSE ()
LINK_DIRECTORIES(${SPDK_ROOT}/lib/)
ENDIF ()
FILE(GLOB SPDK_LIBS ${SPDK_ROOT}/lib/libspdk*.*)
FOREACH (LIB_FILE_NAME ${SPDK_LIBS})
GET_FILENAME_COMPONENT(LIB_NAME ${LIB_FILE_NAME} NAME_WE)
GET_FILENAME_COMPONENT(FULL_LIB_NAME ${LIB_FILE_NAME} NAME)
STRING(REPLACE "lib" "" LIB_NAME "${LIB_NAME}")
SET_LIBRARY_TARGET("SPDK" "${LIB_NAME}" "${SPDK_ROOT}/debug/lib/${FULL_LIB_NAME}" "${SPDK_ROOT}/lib/${FULL_LIB_NAME}" "${SPDK_ROOT}/include/spdk")
ENDFOREACH ()

44
ports/spdk/usage Normal file
View File

@ -0,0 +1,44 @@
The package spdk is compatible with built-in CMake targets:
Add following to build examples/nvme/perf/perf.c
FIND_PACKAGE(spdk CONFIG REQUIRED)
FIND_PACKAGE(spdk-dpdk CONFIG REQUIRED)
ADD_EXECUTABLE(SPDKTest perf.c)
TARGET_LINK_DIRECTORIES(SPDKTest PRIVATE ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/spdk)
TARGET_LINK_LIBRARIES(SPDKTest PRIVATE
SPDK::spdk_app_rpc
SPDK::spdk_bdev
SPDK::spdk_bdev_null
SPDK::spdk_bdev_rpc
SPDK::spdk_conf
SPDK::spdk_copy
SPDK::spdk_thread
SPDK::spdk_event
SPDK::spdk_event_bdev
SPDK::spdk_event_copy
SPDK::spdk_event_net
SPDK::spdk_net
SPDK::spdk_nvmf
SPDK::spdk_nvme
SPDK::spdk_sock_posix
SPDK::spdk_sock
SPDK::spdk_rpc
SPDK::spdk_jsonrpc
SPDK::spdk_json
SPDK::spdk_trace
SPDK::spdk_util
SPDK::spdk_log
SPDK::spdk_env_dpdk
SPDK::dpdk
numa
rdmacm
uuid
ibverbs
pthread
dl
)
Configuration script can be found at: ${CURRENT_PACKAGES_DIR}/share/${PORT}/scripts