aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPark DongHa <luncliff@gmail.com>2021-04-08 06:18:02 +0900
committerGitHub <noreply@github.com>2021-04-07 14:18:02 -0700
commite1f1938cb8fc646749a900c2cf82b8cc42ba0541 (patch)
treec1c488fbaa7df3a8cfc272e3a783699adab0652a
parentb466bd598e561aeff6e869104ddb03705f9f2fc1 (diff)
downloadvcpkg-e1f1938cb8fc646749a900c2cf82b8cc42ba0541.tar.gz
vcpkg-e1f1938cb8fc646749a900c2cf82b8cc42ba0541.zip
[nnpack] create a new port (#16344)
* [psimd] create a new port * [psimd] update baseline and port SHA * [fp16] create a new port * [fp16] update baseline and port SHA * [fxdiv] create a new port * [fxdiv] update baseline and port SHA * [pthreadpool] create a new port * [pthreadpool] update baseline and port SHA * [nnpack] create a new port * [nnpack] update baseline and port SHA * [nnpack] use version-date * [nnpack] disable windows * there are no config for windows * [nnpack] enforce psimd backend There is a 'neon' backend, but it won't be considered for now * [nnpack] update supports * use more correct expression
-rw-r--r--ports/nnpack/fix-cmakelists.patch98
-rw-r--r--ports/nnpack/portfile.cmake24
-rw-r--r--ports/nnpack/vcpkg.json14
-rw-r--r--versions/baseline.json4
-rw-r--r--versions/n-/nnpack.json9
5 files changed, 149 insertions, 0 deletions
diff --git a/ports/nnpack/fix-cmakelists.patch b/ports/nnpack/fix-cmakelists.patch
new file mode 100644
index 000000000..bd80f1000
--- /dev/null
+++ b/ports/nnpack/fix-cmakelists.patch
@@ -0,0 +1,98 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 5ecd2df..8565044 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,8 +12,6 @@ SET_PROPERTY(CACHE NNPACK_BACKEND PROPERTY STRINGS auto psimd scalar)
+ OPTION(NNPACK_CONVOLUTION_ONLY "Build only NNPACK functions for convolutional layer" OFF)
+ OPTION(NNPACK_INFERENCE_ONLY "Build only NNPACK functions for inference" OFF)
+ OPTION(NNPACK_CUSTOM_THREADPOOL "Build NNPACK for custom thread pool" OFF)
+-SET(NNPACK_LIBRARY_TYPE "default" CACHE STRING "Type of library (shared, static, or default) to build")
+-SET_PROPERTY(CACHE NNPACK_LIBRARY_TYPE PROPERTY STRINGS default static shared)
+ OPTION(NNPACK_BUILD_TESTS "Build NNPACK unit tests" ON)
+
+ # ---[ CMake options
+@@ -442,15 +440,7 @@ ELSE()
+ SET(NNPACK_BACKEND_C_SRCS ${NNPACK_BACKEND_SRCS})
+ ENDIF()
+
+-IF(NNPACK_LIBRARY_TYPE STREQUAL "default")
+- ADD_LIBRARY(nnpack ${NNPACK_INIT_SRCS} ${NNPACK_LAYER_SRCS} ${NNPACK_BACKEND_C_SRCS} ${NNPACK_BACKEND_PEACHPY_OBJS})
+-ELSEIF(NNPACK_LIBRARY_TYPE STREQUAL "shared")
+- ADD_LIBRARY(nnpack SHARED ${NNPACK_INIT_SRCS} ${NNPACK_LAYER_SRCS} ${NNPACK_BACKEND_C_SRCS} ${NNPACK_BACKEND_PEACHPY_OBJS})
+-ELSEIF(NNPACK_LIBRARY_TYPE STREQUAL "static")
+- ADD_LIBRARY(nnpack STATIC ${NNPACK_INIT_SRCS} ${NNPACK_LAYER_SRCS} ${NNPACK_BACKEND_C_SRCS} ${NNPACK_BACKEND_PEACHPY_OBJS})
+-ELSE()
+- MESSAGE(FATAL_ERROR "Unsupported NNPACK library type \"${NNPACK_LIBRARY_TYPE}\". Must be \"static\", \"shared\", or \"default\"")
+-ENDIF()
++ADD_LIBRARY(nnpack ${NNPACK_INIT_SRCS} ${NNPACK_LAYER_SRCS} ${NNPACK_BACKEND_C_SRCS} ${NNPACK_BACKEND_PEACHPY_OBJS})
+ NNPACK_TARGET_ENABLE_C99(nnpack)
+ IF(IOS OR CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv5te|armv7-a|armv7l)$")
+ IF(IOS AND NNPACK_BACKEND STREQUAL "neon")
+@@ -496,7 +486,7 @@ NNPACK_TARGET_ENABLE_C99(nnpack_reference_layers)
+ TARGET_INCLUDE_DIRECTORIES(nnpack_reference_layers PUBLIC include)
+
+ # ---[ Configure cpuinfo
+-IF(NOT TARGET cpuinfo)
++IF(FALSE)
+ SET(CPUINFO_BUILD_TOOLS OFF CACHE BOOL "")
+ SET(CPUINFO_BUILD_UNIT_TESTS OFF CACHE BOOL "")
+ SET(CPUINFO_BUILD_MOCK_TESTS OFF CACHE BOOL "")
+@@ -505,10 +495,11 @@ IF(NOT TARGET cpuinfo)
+ "${CPUINFO_SOURCE_DIR}"
+ "${CONFU_DEPENDENCIES_BINARY_DIR}/cpuinfo")
+ ENDIF()
+-TARGET_LINK_LIBRARIES(nnpack PRIVATE cpuinfo)
++find_package(cpuinfo CONFIG REQUIRED)
++target_link_libraries(nnpack PUBLIC cpuinfo::cpuinfo)
+
+ # ---[ Configure pthreadpool
+-IF(NOT TARGET pthreadpool)
++IF(FALSE)
+ SET(PTHREADPOOL_BUILD_TESTS OFF CACHE BOOL "")
+ SET(PTHREADPOOL_BUILD_BENCHMARKS OFF CACHE BOOL "")
+ ADD_SUBDIRECTORY(
+@@ -525,33 +516,37 @@ ENDIF()
+ TARGET_LINK_LIBRARIES(nnpack_reference_layers PUBLIC pthreadpool)
+
+ # ---[ Configure FXdiv
+-IF(NOT TARGET fxdiv)
++IF(FALSE)
+ SET(FXDIV_BUILD_TESTS OFF CACHE BOOL "")
+ SET(FXDIV_BUILD_BENCHMARKS OFF CACHE BOOL "")
+ ADD_SUBDIRECTORY(
+ "${FXDIV_SOURCE_DIR}"
+ "${CONFU_DEPENDENCIES_BINARY_DIR}/fxdiv")
+ ENDIF()
+-TARGET_LINK_LIBRARIES(nnpack PRIVATE fxdiv)
++find_path(FXDIV_INCLUDE_DIRS "fxdiv.h")
++target_include_directories(nnpack PRIVATE ${FXDIV_INCLUDE_DIRS})
++
+
+ # ---[ Configure psimd
+-IF(NOT TARGET psimd)
++IF(FALSE)
+ ADD_SUBDIRECTORY(
+ "${PSIMD_SOURCE_DIR}"
+ "${CONFU_DEPENDENCIES_BINARY_DIR}/psimd")
+ ENDIF()
+-TARGET_LINK_LIBRARIES(nnpack PRIVATE psimd)
++find_path(PSIMD_INCLUDE_DIRS "psimd.h")
++target_include_directories(nnpack PRIVATE ${PSIMD_INCLUDE_DIRS})
+
+ # ---[ Configure FP16
+-IF(NOT TARGET fp16)
++IF(FALSE)
+ SET(FP16_BUILD_TESTS OFF CACHE BOOL "")
+ SET(FP16_BUILD_BENCHMARKS OFF CACHE BOOL "")
+ ADD_SUBDIRECTORY(
+ "${FP16_SOURCE_DIR}"
+ "${CONFU_DEPENDENCIES_BINARY_DIR}/fp16")
+ ENDIF()
+-TARGET_LINK_LIBRARIES(nnpack PRIVATE fp16)
+-TARGET_LINK_LIBRARIES(nnpack_reference_layers PUBLIC fp16)
++find_path(FP16_INCLUDE_DIRS "fp16.h")
++target_include_directories(nnpack PRIVATE ${FP16_INCLUDE_DIRS})
++target_include_directories(nnpack_reference_layers PUBLIC ${FP16_INCLUDE_DIRS})
+
+ INSTALL(TARGETS nnpack
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
diff --git a/ports/nnpack/portfile.cmake b/ports/nnpack/portfile.cmake
new file mode 100644
index 000000000..51432669a
--- /dev/null
+++ b/ports/nnpack/portfile.cmake
@@ -0,0 +1,24 @@
+vcpkg_fail_port_install(ON_TARGET "Windows")
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Maratyszcza/nnpack
+ REF c07e3a0400713d546e0dea2d5466dd22ea389c73
+ SHA512 f0b261e8698b412d12dd739e5d0cf71c284965ae28da735ae22814a004358ba3ecaea6cd26fa17b594c0245966b7dd2561c1e05c6cbf0592fd7b85ea0f21eb37
+ PATCHES
+ fix-cmakelists.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DNNPACK_BACKEND=psimd
+ -DNNPACK_BUILD_TESTS=OFF
+ -DNNPACK_BUILD_BENCHMARKS=OFF
+ -DNNPACK_CUSTOM_THREADPOOL=OFF
+)
+vcpkg_install_cmake()
+vcpkg_copy_pdbs()
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/nnpack/vcpkg.json b/ports/nnpack/vcpkg.json
new file mode 100644
index 000000000..774e5ee77
--- /dev/null
+++ b/ports/nnpack/vcpkg.json
@@ -0,0 +1,14 @@
+{
+ "name": "nnpack",
+ "version-date": "2021-02-21",
+ "description": "Acceleration package for neural networks on multi-core CPUs",
+ "homepage": "https://github.com/Maratyszcza/NNPACK",
+ "supports": "linux & osx",
+ "dependencies": [
+ "cpuinfo",
+ "fp16",
+ "fxdiv",
+ "psimd",
+ "pthreadpool"
+ ]
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index be96904f6..b094f0062 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -4240,6 +4240,10 @@
"baseline": "1.3.0",
"port-version": 0
},
+ "nnpack": {
+ "baseline": "2021-02-21",
+ "port-version": 0
+ },
"nonius": {
"baseline": "2019-04-20-1",
"port-version": 0
diff --git a/versions/n-/nnpack.json b/versions/n-/nnpack.json
new file mode 100644
index 000000000..69bbc2196
--- /dev/null
+++ b/versions/n-/nnpack.json
@@ -0,0 +1,9 @@
+{
+ "versions": [
+ {
+ "git-tree": "bea4835350da5cce1c030ee7d9590fdae88860ae",
+ "version-date": "2021-02-21",
+ "port-version": 0
+ }
+ ]
+}