From 3029a0e0adfbcf5f87b331c6217519fe58f3ac15 Mon Sep 17 00:00:00 2001 From: Leonid Pospelov Date: Thu, 2 Feb 2023 01:12:27 +0600 Subject: [PATCH] [WasmEdge] Add new port (#28668) --- ports/wasmedge/portfile.cmake | 67 +++++++++++++++++++++++++++++++++++ ports/wasmedge/vcpkg.json | 52 +++++++++++++++++++++++++++ versions/baseline.json | 4 +++ versions/w-/wasmedge.json | 9 +++++ 4 files changed, 132 insertions(+) create mode 100644 ports/wasmedge/portfile.cmake create mode 100644 ports/wasmedge/vcpkg.json create mode 100644 versions/w-/wasmedge.json diff --git a/ports/wasmedge/portfile.cmake b/ports/wasmedge/portfile.cmake new file mode 100644 index 0000000000..b685638a2d --- /dev/null +++ b/ports/wasmedge/portfile.cmake @@ -0,0 +1,67 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO WasmEdge/WasmEdge + REF 0.12.0-alpha.1 + SHA512 4218ecb6fba34b4ae94fc8c63b7da03c37f9dd2e404a9a6008be972a799b981929ada0ef213d8fababa25d10e27b777df66d22e1e61c92ff8e60b5e1caf97562 + HEAD_REF master +) + +set(WASMEDGE_CMAKE_OPTIONS "") + +list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_BUILD_AOT_RUNTIME=OFF") + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_BUILD_STATIC_LIB=OFF") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_BUILD_SHARED_LIB=ON") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_LINK_LLVM_STATIC=OFF") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_LINK_TOOLS_STATIC=OFF") +else() + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_BUILD_STATIC_LIB=ON") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_BUILD_SHARED_LIB=OFF") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_LINK_LLVM_STATIC=ON") + list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_LINK_TOOLS_STATIC=ON") +endif() + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + tools WASMEDGE_BUILD_TOOLS + aot WASMEDGE_BUILD_AOT_RUNTIME + plugins WASMEDGE_BUILD_PLUGINS +) + +# disabled due to build failure +list(APPEND WASMEDGE_CMAKE_OPTIONS "-DWASMEDGE_BUILD_EXAMPLE=OFF") + +set(WASMEDGE_PLUGIN_WASI_NN_BACKEND "") + +if("plugin-wasi-nn-backend-openvino" IN_LIST FEATURES) + list(APPEND WASMEDGE_PLUGIN_WASI_NN_BACKEND "OpenVINO") +endif() +if("plugin-wasi-nn-backend-pytorch" IN_LIST FEATURES) + list(APPEND WASMEDGE_PLUGIN_WASI_NN_BACKEND "PyTorch") +endif() +if("plugin-wasi-nn-backend-tensorflow-lite" IN_LIST FEATURES) + list(APPEND WASMEDGE_PLUGIN_WASI_NN_BACKEND "TensorflowLite") +endif() + +if(NOT WASMEDGE_PLUGIN_WASI_NN_BACKEND STREQUAL "") + list(JOIN WASMEDGE_PLUGIN_WASI_NN_BACKEND "," WASMEDGE_PLUGIN_WASI_NN_BACKEND) + list(APPEND WASMEDGE_CMAKE_OPTIONS "-WASMEDGE_PLUGIN_WASI_NN_BACKEND=${WASMEDGE_PLUGIN_WASI_NN_BACKEND}") +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${WASMEDGE_CMAKE_OPTIONS} + ${FEATURE_OPTIONS} + OPTIONS_RELEASE + -DCMAKE_INSTALL_BINDIR=${CURRENT_PACKAGES_DIR}/tools + OPTIONS_DEBUG + -DCMAKE_INSTALL_BINDIR=${CURRENT_PACKAGES_DIR}/debug/tools +) + +vcpkg_cmake_install() + +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/wasmedge/vcpkg.json b/ports/wasmedge/vcpkg.json new file mode 100644 index 0000000000..09b98d65b9 --- /dev/null +++ b/ports/wasmedge/vcpkg.json @@ -0,0 +1,52 @@ +{ + "name": "wasmedge", + "version-semver": "0.12.0-alpha.1", + "description": "WasmEdge is a high-performance WebAssembly runtime for edge computing.", + "homepage": "https://WasmEdge.org", + "license": "Apache-2.0", + "supports": "!windows", + "dependencies": [ + "boost-algorithm", + "boost-align", + "boost-predef", + "spdlog", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "tools" + ], + "features": { + "aot": { + "description": "Build with the Ahead-of-Time compiler supporting", + "dependencies": [ + "llvm" + ] + }, + "plugin-wasi-nn-backend-openvino": { + "description": "Build the OpenVINO backend plugin for the WasmEdge WASI-NN extension", + "supports": "linux & !static" + }, + "plugin-wasi-nn-backend-pytorch": { + "description": "Build the PyTorch backend plugin for the WasmEdge WASI-NN extension", + "supports": "linux & !static" + }, + "plugin-wasi-nn-backend-tensorflowlite": { + "description": "Build the TensorFlow Lite backend plugin for the WasmEdge WASI-NN extension", + "supports": "linux & !static" + }, + "plugins": { + "description": "Build plugins", + "supports": "!static" + }, + "tools": { + "description": "Build tools" + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index ab321059a8..741cc0f615 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -8112,6 +8112,10 @@ "baseline": "2022.03.21.00", "port-version": 0 }, + "wasmedge": { + "baseline": "0.12.0-alpha.1", + "port-version": 0 + }, "wavelib": { "baseline": "2021-11-26", "port-version": 0 diff --git a/versions/w-/wasmedge.json b/versions/w-/wasmedge.json new file mode 100644 index 0000000000..1e369422a1 --- /dev/null +++ b/versions/w-/wasmedge.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "8f45668b8b49bb5ac4cefd31ee7e41abddc15107", + "version-semver": "0.12.0-alpha.1", + "port-version": 0 + } + ] +}