Implement more wasm-c-apis and enable Envoy integration (#622)

Implement more wasm-c-api APIs to support Envoy integration:
- sync up with latest c-api definition
- change CMakeLists to export necessary headers and install the static library of iwasm
- enable to export tables and memories
- support memorytype and tabletype APIs
- update wasm-c-api sampels
- enable to export importtype APIs

And refine bazel scripts for sample XNNPACK workload, add license headers for sample simple.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-04-27 17:05:40 +08:00
committed by GitHub
parent a332a49a0d
commit eb29385963
36 changed files with 3190 additions and 1939 deletions

View File

@ -17,7 +17,6 @@ ARG WASI_SDK_VER=12
ARG WABT_VER=1.0.20
ARG CMAKE_VER=3.16.2
ARG BINARYEN_VER=version_97
ARG BAZEL_VER=3.7.0
#
# install wasi-sdk
@ -66,13 +65,13 @@ RUN cd /opt \
&& rm ${BINARYEN_FILE} \
&& ln -sf /opt/binaryen-${BINARYEN_VER} /opt/binaryen
# #
# # install bazel
# ARG BAZEL_FILE=bazel-${BAZEL_VER}-installer-linux-x86_64.sh
# COPY ${BAZEL_FILE} /tmp
# RUN cd /tmp \
# && chmod a+x ${BAZEL_FILE} \
# && ./${BAZEL_FILE}
#
# install bazelisk
ARG BAZEL_FILE="bazelisk-linux-amd64"
COPY ${BAZEL_FILE} /opt/bazelisk/bin/bazelisk
RUN cd /opt/bazelisk/bin/ \
&& chmod a+x bazelisk \
&& ln -sf /opt/bazelisk/bin/bazelisk /usr/local/bin/bazel
#
# Clean up

View File

@ -13,7 +13,7 @@ readonly WASI_SDK_VER=12
readonly WABT_VER=1.0.20
readonly CMAKE_VER=3.16.2
readonly BINARYEN_VER=version_97
readonly BAZEL_VER=3.7.0
readonly BAZELISK_VER=1.7.5
cd ${BUILD_CONTENT} || exit
if [[ ! -f wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz ]]; then
@ -36,24 +36,22 @@ if [[ ! -f binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz ]]; then
wget https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VER}/binaryen-${BINARYEN_VER}-x86_64-linux.tar.gz
fi
if [[ ! -f bazel-${BAZEL_VER}-installer-linux-x86_64.sh ]]; then
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/bazel-${BAZEL_VER}-installer-linux-x86_64.sh
if [[ ! -f bazelisk-linux-amd64.sh ]]; then
wget https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64
fi
cd - > /dev/null || exit
DOCKERFILE_PATH=$(dirname "$(realpath "$0")")
docker build \
--build-arg WASI_SDK_VER=${WASI_SDK_VER} \
--build-arg WABT_VER=${WABT_VER} \
--build-arg CMAKE_VER=${CMAKE_VER} \
--build-arg BINARYEN_VER=${BINARYEN_VER} \
--build-arg BAZEL_VER=${BAZEL_VER} \
-t clang_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT}
docker run --rm -it \
--name workload_w_clang \
--mount type=bind,source="$(pwd)",target=/data/project \
-w /data/project \
clang_env:0.1 \
/bin/bash -c /build.sh
--build-arg WASI_SDK_VER=${WASI_SDK_VER} \
--build-arg WABT_VER=${WABT_VER} \
--build-arg CMAKE_VER=${CMAKE_VER} \
--build-arg BINARYEN_VER=${BINARYEN_VER} \
-t clang_env:0.1 -f "${DOCKERFILE_PATH}"/Dockerfile ${BUILD_CONTENT} \
&& docker run --rm \
--name workload_w_clang \
--mount type=bind,source="$(pwd)",target=/data/project \
-w /data/project \
clang_env:0.1 \
/bin/bash -c /build.sh