From 2647956afde33f6a6a7c8fd74ed3ff30f5ca8c3e Mon Sep 17 00:00:00 2001 From: Park DongHa Date: Fri, 3 Dec 2021 12:49:25 +0900 Subject: [PATCH] [foxi] create a new port (#21786) * [foxi] create a new port * [foxi] update git-tree, version * [foxi] fix windows build * [foxi] disable UWP because of build failure * LOAD_LIBRARY_SEARCH_DEFAULT_DIRS undefined * Rename patch to better indicate the patch's purpose and to clarify that it need not be replicated upstream. Co-authored-by: Billy Robert O'Neal III --- ports/foxi/portfile.cmake | 20 ++++++++++ ports/foxi/remove-test-targets.patch | 60 ++++++++++++++++++++++++++++ ports/foxi/vcpkg.json | 14 +++++++ versions/baseline.json | 4 ++ versions/f-/foxi.json | 9 +++++ 5 files changed, 107 insertions(+) create mode 100644 ports/foxi/portfile.cmake create mode 100644 ports/foxi/remove-test-targets.patch create mode 100644 ports/foxi/vcpkg.json create mode 100644 versions/f-/foxi.json diff --git a/ports/foxi/portfile.cmake b/ports/foxi/portfile.cmake new file mode 100644 index 0000000000..5517378b89 --- /dev/null +++ b/ports/foxi/portfile.cmake @@ -0,0 +1,20 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO houseroad/foxi + REF c278588e34e535f0bb8f00df3880d26928038cad + SHA512 ad42cfd70e40ba0f0a9187b34ae9e3bd361c8c0038669f4c1591c4f7421d12ad93f76f42b33c2575eea1a3ddb3ff781da2895cdc636df5b60422598f450203c7 + PATCHES + remove-test-targets.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) +vcpkg_cmake_install() + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) diff --git a/ports/foxi/remove-test-targets.patch b/ports/foxi/remove-test-targets.patch new file mode 100644 index 0000000000..9e53390bad --- /dev/null +++ b/ports/foxi/remove-test-targets.patch @@ -0,0 +1,60 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b406d0f..c5d04d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -65,7 +65,7 @@ if(MSVC) + add_msvc_runtime_flag(foxi_loader) + endif() + +-if (NOT ANDROID AND NOT IOS) ++if (FALSE) + # ---[ FOXI wrapper + add_library(foxi_wrapper MODULE foxi/onnxifi_wrapper.c) + target_include_directories(foxi_wrapper PRIVATE +@@ -93,17 +93,6 @@ if (NOT ANDROID AND NOT IOS) + endif() + endif() + +-# ---[ FOXI dummy backend +-add_library(foxi_dummy SHARED foxi/onnxifi_dummy.c) +-target_include_directories(foxi_dummy PRIVATE +- $ +- $) +-target_link_libraries(foxi_dummy PUBLIC foxi ${CMAKE_DL_LIBS}) +-target_compile_definitions(foxi_dummy PRIVATE ONNXIFI_BUILD_LIBRARY=TRUE) +-if(MSVC) +- add_msvc_runtime_flag(foxi_dummy) +-endif() +- + install(DIRECTORY ${FOXI_ROOT}/foxi + DESTINATION include + FILES_MATCHING +@@ -114,10 +103,10 @@ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/foxi + PATTERN "*.h") + + install(TARGETS +- foxi foxi_dummy foxi_loader ++ foxi_loader + EXPORT ONNXTargets DESTINATION lib) + +-if(NOT ANDROID AND NOT IOS) ++if(FALSE) + install(TARGETS foxi_wrapper + EXPORT ONNXTargets DESTINATION lib) + endif() + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c5d04d5..cc7d18a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -61,9 +61,6 @@ set_target_properties(foxi_loader + C_EXTENSIONS + NO) + target_link_libraries(foxi_loader PUBLIC foxi ${CMAKE_DL_LIBS}) +-if(MSVC) +- add_msvc_runtime_flag(foxi_loader) +-endif() + + if (FALSE) + # ---[ FOXI wrapper + diff --git a/ports/foxi/vcpkg.json b/ports/foxi/vcpkg.json new file mode 100644 index 0000000000..4fbccecb48 --- /dev/null +++ b/ports/foxi/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "foxi", + "version-date": "2021-12-01", + "description": "ONNXIFI with Facebook Extension", + "homepage": "https://github.com/houseroad/foxi", + "license": "MIT", + "supports": "!uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index d10ba2ae04..17fa3f8d41 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2240,6 +2240,10 @@ "baseline": "1.0.8", "port-version": 0 }, + "foxi": { + "baseline": "2021-12-01", + "port-version": 0 + }, "fp16": { "baseline": "2021-02-21", "port-version": 0 diff --git a/versions/f-/foxi.json b/versions/f-/foxi.json new file mode 100644 index 0000000000..f1c10f5bf3 --- /dev/null +++ b/versions/f-/foxi.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "b01a376dbabc364856cd79e1099cd703e9d46053", + "version-date": "2021-12-01", + "port-version": 0 + } + ] +}