mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-18 02:59:21 +00:00
Compare commits
No commits in common. "main" and "01-12-2020" have entirely different histories.
main
...
01-12-2020
|
@ -1,61 +0,0 @@
|
|||
# using [clang-formt-12 options](https://releases.llvm.org/12.0.0/tools/clang/docs/ClangFormatStyleOptions.html)
|
||||
RawStringFormats:
|
||||
- Language: Cpp
|
||||
Delimiters:
|
||||
- c
|
||||
- C
|
||||
- cc
|
||||
- CC
|
||||
- cpp
|
||||
- Cpp
|
||||
- CPP
|
||||
- 'c++'
|
||||
- 'C++'
|
||||
- h
|
||||
- hpp
|
||||
CanonicalDelimiter: ''
|
||||
BasedOnStyle: Mozilla
|
||||
|
||||
Language: Cpp
|
||||
BasedOnStyle: Mozilla
|
||||
# 6.1
|
||||
IndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
# 6.2
|
||||
TabWidth: 4
|
||||
UseTab: Never
|
||||
# 6.3
|
||||
ColumnLimit: 80
|
||||
# 6.9
|
||||
AlignAfterOpenBracket: Align
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
# 6.10
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: true
|
||||
# 6.27
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
|
||||
# additional
|
||||
AlignEscapedNewlines: Left
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
PointerAlignment: Right
|
||||
SpaceAroundPointerQualifiers: After
|
||||
SortIncludes: false
|
16
.clang-tidy
16
.clang-tidy
|
@ -1,16 +0,0 @@
|
|||
# refer to https://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
Checks: '-*, readability-identifier-naming, clang-analyzer-core.*,'
|
||||
WarningsAsErrors: '-*'
|
||||
HeaderFilterRegex: ''
|
||||
FormatStyle: file
|
||||
InheritParentConfig: false
|
||||
AnalyzeTemporaryDtors: false
|
||||
User: wamr
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.VariableCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.ParameterCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.MacroDefinitionCase
|
||||
value: UPPER_CASE
|
|
@ -1,150 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp/.devcontainer/base.Dockerfile
|
||||
# [Choice] Debian / Ubuntu version (use Debian 12/11/9, Ubuntu 18.04/21.04 on local arm64/Apple Silicon): debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
|
||||
ARG VARIANT=debian-12
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/cpp:${VARIANT}
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
ENV TZ=Asian/Shanghai
|
||||
|
||||
# hadolint ignore=DL3008
|
||||
RUN apt-get update \
|
||||
&& apt-get upgrade -y \
|
||||
&& apt-get install -y apt-transport-https apt-utils build-essential \
|
||||
ca-certificates ccache cmake curl g++-multilib git gnupg \
|
||||
libgcc-12-dev lib32gcc-12-dev lsb-release \
|
||||
ninja-build ocaml ocamlbuild \
|
||||
software-properties-common tree tzdata \
|
||||
unzip valgrind vim wget zip --no-install-recommends \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#
|
||||
# binaryen
|
||||
ARG BINARYEN_VER=114
|
||||
WORKDIR /opt
|
||||
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VER}/binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
|
||||
&& tar xf binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz \
|
||||
&& ln -sf /opt/binaryen-version_${BINARYEN_VER} /opt/binaryen \
|
||||
&& rm binaryen-version_${BINARYEN_VER}-x86_64-linux.tar.gz
|
||||
|
||||
#
|
||||
# CMAKE (https://apt.kitware.com/)
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
# hadolint ignore=DL3008
|
||||
ARG CMAKE_VER=3.27.0
|
||||
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh \
|
||||
-q -O /tmp/cmake-install.sh \
|
||||
&& chmod u+x /tmp/cmake-install.sh \
|
||||
&& mkdir /opt/cmake-${CMAKE_VER} \
|
||||
&& /tmp/cmake-install.sh --skip-license --prefix=/opt/cmake-${CMAKE_VER} \
|
||||
&& rm /tmp/cmake-install.sh \
|
||||
&& ln -s /opt/cmake-${CMAKE_VER}/bin/* /usr/local/bin
|
||||
|
||||
#
|
||||
# install emsdk
|
||||
WORKDIR /opt
|
||||
RUN git clone https://github.com/emscripten-core/emsdk.git
|
||||
|
||||
ARG EMSDK_VER=3.1.43
|
||||
WORKDIR /opt/emsdk
|
||||
RUN git pull \
|
||||
&& ./emsdk install ${EMSDK_VER} \
|
||||
&& ./emsdk activate ${EMSDK_VER} \
|
||||
&& echo "source /opt/emsdk/emsdk_env.sh" >> /root/.bashrc
|
||||
|
||||
#
|
||||
# install wasi-sdk
|
||||
ARG WASI_SDK_VER=20
|
||||
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_SDK_VER}/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -P /opt \
|
||||
&& tar xf /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz -C /opt \
|
||||
&& ln -sf /opt/wasi-sdk-${WASI_SDK_VER}.0 /opt/wasi-sdk \
|
||||
&& rm /opt/wasi-sdk-${WASI_SDK_VER}.0-linux.tar.gz
|
||||
|
||||
#
|
||||
#install wabt
|
||||
ARG WABT_VER=1.0.33
|
||||
RUN wget -c --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/${WABT_VER}/wabt-${WABT_VER}-ubuntu.tar.gz -P /opt \
|
||||
&& tar xf /opt/wabt-${WABT_VER}-ubuntu.tar.gz -C /opt \
|
||||
&& ln -sf /opt/wabt-${WABT_VER} /opt/wabt \
|
||||
&& rm /opt/wabt-${WABT_VER}-ubuntu.tar.gz
|
||||
|
||||
#
|
||||
# install bazelisk
|
||||
ARG BAZELISK_VER=1.17.0
|
||||
RUN mkdir /opt/bazelisk \
|
||||
&& wget -c --progress=dot:giga https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VER}/bazelisk-linux-amd64 -P /opt/bazelisk \
|
||||
&& chmod a+x /opt/bazelisk/bazelisk-linux-amd64 \
|
||||
&& ln -fs /opt/bazelisk/bazelisk-linux-amd64 /opt/bazelisk/bazel
|
||||
|
||||
#
|
||||
# install clang+llvm
|
||||
ARG LLVM_VER=16
|
||||
RUN apt-get purge -y clang-14 llvm-14 && apt-get autoremove -y
|
||||
WORKDIR /etc/apt/apt.conf.d
|
||||
RUN touch 99verfiy-peer.conf \
|
||||
&& echo "Acquire { https::Verify-Peer false }" > 99verfiy-peer.conf
|
||||
|
||||
WORKDIR /tmp
|
||||
#RUN wget --progress=dot:giga https://apt.llvm.org/llvm.sh \
|
||||
# && chmod a+x ./llvm.sh \
|
||||
# && ./llvm.sh ${LLVM_VER} all
|
||||
|
||||
# Workaround due to https://github.com/llvm/llvm-project/issues/62475
|
||||
# hadolint ignore=DL3008
|
||||
RUN set -ex \
|
||||
&& echo "deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-${LLVM_VER} main" > /etc/apt/sources.list.d/apt.llvm.org.list \
|
||||
&& wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y \
|
||||
clang-${LLVM_VER} lldb-${LLVM_VER} lld-${LLVM_VER} clangd-${LLVM_VER} clang-tidy-${LLVM_VER} clang-format-${LLVM_VER} clang-tools-${LLVM_VER} \
|
||||
llvm-${LLVM_VER}-dev lld-${LLVM_VER} lldb-${LLVM_VER} llvm-${LLVM_VER}-tools libomp-${LLVM_VER}-dev libc++-${LLVM_VER}-dev libc++abi-${LLVM_VER}-dev \
|
||||
libclang-common-${LLVM_VER}-dev libclang-${LLVM_VER}-dev libclang-cpp${LLVM_VER}-dev libunwind-${LLVM_VER}-dev \
|
||||
libclang-rt-${LLVM_VER}-dev libpolly-${LLVM_VER}-dev --no-install-recommends \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#
|
||||
# [Optional]
|
||||
|
||||
#
|
||||
# Install pip
|
||||
# hadolint ignore=DL3008
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --reinstall python3-venv python3-pip --no-install-recommends \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
#
|
||||
# Install required python packages
|
||||
# hadolint ignore=DL3013
|
||||
RUN python3 -m pip install --no-cache-dir --break-system-packages --upgrade pip \
|
||||
&& pip3 install --no-cache-dir --break-system-packages black nose pycparser pylint
|
||||
|
||||
#
|
||||
# Install github-cli. It doens't work as a feature of devcontainer.json
|
||||
ARG GH_CLI_VER=2.32.0
|
||||
WORKDIR /tmp
|
||||
RUN wget -q https://github.com/cli/cli/releases/download/v${GH_CLI_VER}/gh_${GH_CLI_VER}_linux_amd64.deb \
|
||||
&& dpkg -i gh_${GH_CLI_VER}_linux_amd64.deb
|
||||
|
||||
#
|
||||
# Install NodeJS
|
||||
RUN wget -qO- https://deb.nodesource.com/setup_20.x | bash -
|
||||
# hadolint ignore=DL3008
|
||||
RUN apt-get install -y nodejs --no-install-recommends
|
||||
|
||||
# set path
|
||||
ENV PATH="/opt/bazelisk:/usr/lib/llvm-${LLVM_VER}/bin:${PATH}"
|
||||
ENV CC=/usr/lib/llvm-${LLVM_VER}/bin/clang CXX=/usr/lib/llvm-${LLVM_VER}/bin/clang++
|
||||
RUN printf "%s\n" "PS1='\n[ \u@wamr-dev-docker \W ]\n$ '" >> /root/.bashrc \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
# set workdir when container run
|
||||
VOLUME /workspaces
|
||||
WORKDIR /workspaces
|
|
@ -1,50 +0,0 @@
|
|||
// Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/cpp
|
||||
{
|
||||
"name": "WAMR-Dev",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
// Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-12, debian-11, debian-10, debian-9, ubuntu-21.04, ubuntu-20.04, ubuntu-18.04
|
||||
// Use Debian 12, Debian 11, Debian 9, Ubuntu 18.04 or Ubuntu 21.04 on local arm64/Apple Silicon
|
||||
"args": {
|
||||
"BINARYEN_VER": "114",
|
||||
"BAZELISK_VER": "1.17.0",
|
||||
"CMAKE_VER": "3.27.0",
|
||||
"EMSDK_VER": "3.1.43",
|
||||
"GH_CLI_VER": "2.32.0",
|
||||
"LLVM_VER": "16",
|
||||
"VARIANT": "debian-12",
|
||||
"WASI_SDK_VER": "20",
|
||||
"WABT_VER": "1.0.33"
|
||||
}
|
||||
},
|
||||
"runArgs": [
|
||||
"--cap-add=SYS_PTRACE",
|
||||
"--security-opt",
|
||||
"seccomp=unconfined"
|
||||
],
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
// Configure properties specific to VS Code.
|
||||
"vscode": {
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {},
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": [
|
||||
"dtsvet.vscode-wasm",
|
||||
"llvm-vs-code-extensions.vscode-clangd",
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance",
|
||||
"ms-vscode.cmake-tools"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// "forwardPorts": [],
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "curl https://sh.rustup.rs -sSf | bash -s -- -y",
|
||||
// Comment out this line to run as root instead.
|
||||
"remoteUser": "vscode"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
# for now, it is used to speed up wasi-nn tests only.
|
||||
# you shall adapt below rules to incoming requirements
|
||||
|
||||
**/build
|
||||
**/tmp.*
|
||||
.*
|
||||
**/*.gguf
|
||||
|
||||
/core/deps/
|
||||
!/core/deps/tensorflow-src
|
||||
/samples
|
||||
/tests
|
5
.github/ISSUE_TEMPLATE/blank_issue.md
vendored
5
.github/ISSUE_TEMPLATE/blank_issue.md
vendored
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
name: Blank Issue
|
||||
about: Create a blank issue.
|
||||
title: ''
|
||||
---
|
28
.github/ISSUE_TEMPLATE/improvement.md
vendored
28
.github/ISSUE_TEMPLATE/improvement.md
vendored
|
@ -1,28 +0,0 @@
|
|||
---
|
||||
name: Improvement
|
||||
about: A feature request or code improvement.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
Thanks for filing a feature request! Please fill out the TODOs below.
|
||||
|
||||
#### Feature
|
||||
|
||||
TODO: Brief description of the feature/improvement you'd like to see in WAMR
|
||||
|
||||
#### Benefit
|
||||
|
||||
TODO: What is the value of adding this in WAMR? What problems does it solve?
|
||||
|
||||
#### Implementation
|
||||
|
||||
TODO: Do you have an implementation plan, and/or ideas for data structures or
|
||||
algorithms to use?
|
||||
|
||||
#### Alternatives
|
||||
|
||||
TODO: What are the alternative implementation approaches or alternative ways to
|
||||
solve the problem that this feature would solve? How do these alternatives
|
||||
compare to this proposal?
|
36
.github/ISSUE_TEMPLATE/report_bug.md
vendored
36
.github/ISSUE_TEMPLATE/report_bug.md
vendored
|
@ -1,36 +0,0 @@
|
|||
---
|
||||
name: WAMR bug or defect report
|
||||
about: Report a bug or defect in WAMR
|
||||
title: ''
|
||||
---
|
||||
|
||||
Thanks for filing a bug or defect report! Please fill out the TODOs below.
|
||||
|
||||
### Subject of the issue
|
||||
|
||||
Describe the bug or defect here.
|
||||
|
||||
### Test case
|
||||
|
||||
Upload the related wasm file, wast file or the source files if you can.
|
||||
|
||||
### Your environment
|
||||
|
||||
* Host OS
|
||||
* WAMR version, platform, cpu architecture, running mode, etc.
|
||||
|
||||
### Steps to reproduce
|
||||
|
||||
Tell us how to reproduce this bug or defect.
|
||||
|
||||
### Expected behavior
|
||||
|
||||
Tell us what should happen
|
||||
|
||||
### Actual behavior
|
||||
|
||||
Tell us what happens instead
|
||||
|
||||
### Extra Info
|
||||
|
||||
Anything else you'd like to add?
|
47
.github/actions/install-linux-sgx/action.yml
vendored
47
.github/actions/install-linux-sgx/action.yml
vendored
|
@ -1,47 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# Always follow https://download.01.org/intel-sgx/latest/linux-latest/docs/
|
||||
|
||||
name: "Install Intel SGX SDK"
|
||||
description: "Installs the Intel SGX SDK and necessary libraries for Ubuntu."
|
||||
author: "Intel Corporation"
|
||||
inputs:
|
||||
os:
|
||||
description: "Operating system to install on (ubuntu-22.04)"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Check Runner OS
|
||||
if: ${{ inputs.os != 'ubuntu-22.04' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error title=⛔ error hint::Only support ubuntu-22.04 for now"
|
||||
exit 1
|
||||
|
||||
- name: Create installation directory
|
||||
shell: bash
|
||||
run: sudo mkdir -p /opt/intel
|
||||
|
||||
- name: Download and install SGX SDK on ubuntu-22.04
|
||||
if: ${{ inputs.os == 'ubuntu-22.04' }}
|
||||
shell: bash
|
||||
run: |
|
||||
sudo wget -O sgx_linux_x64_sdk.bin https://download.01.org/intel-sgx/sgx-linux/2.25/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.25.100.3.bin
|
||||
sudo chmod +x sgx_linux_x64_sdk.bin
|
||||
echo 'yes' | sudo ./sgx_linux_x64_sdk.bin
|
||||
working-directory: /opt/intel
|
||||
|
||||
- name: Add SGX repository and install libraries
|
||||
shell: bash
|
||||
run: |
|
||||
echo "deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list
|
||||
wget -qO - https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | sudo apt-key add -
|
||||
sudo apt update
|
||||
sudo apt install -y libsgx-launch libsgx-urts
|
||||
|
||||
- name: Source SGX SDK environment
|
||||
shell: bash
|
||||
run: source /opt/intel/sgxsdk/environment
|
125
.github/actions/install-wasi-sdk-wabt/action.yml
vendored
125
.github/actions/install-wasi-sdk-wabt/action.yml
vendored
|
@ -1,125 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# Get URLs from:
|
||||
# - https://github.com/WebAssembly/wasi-sdk/releases
|
||||
# - https://github.com/WebAssembly/wabt/releases
|
||||
|
||||
# Install WASI-SDK and WABT at /opt
|
||||
# /opt is the assumed location widely used in the project
|
||||
name: Install WASI-SDK and WABT
|
||||
|
||||
description: A composite action to download and install wasi-sdk and wabt on Ubuntu, macOS.
|
||||
|
||||
inputs:
|
||||
os:
|
||||
description: "Operating system to install on (ubuntu, macos)"
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Check Runner OS
|
||||
if: ${{ !startsWith(inputs.os, 'ubuntu') && !startsWith(inputs.os, 'windows') && !startsWith(inputs.os, 'macos') }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::error title=⛔ error hint::Support Ubuntu, Windows, and macOS Only"
|
||||
exit 1
|
||||
|
||||
- name: Set up wasi-sdk and wabt on Ubuntu
|
||||
if: ${{ startsWith(inputs.os, 'ubuntu') }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Downloading wasi-sdk for Ubuntu..."
|
||||
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
|
||||
|
||||
echo "Extracting wasi-sdk..."
|
||||
sudo tar -xf wasi-sdk.tar.gz
|
||||
sudo ln -sf wasi-sdk-25.0-x86_64-linux/ wasi-sdk
|
||||
|
||||
echo "Downloading wabt for Ubuntu..."
|
||||
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-ubuntu-20.04.tar.gz
|
||||
|
||||
echo "Extracting wabt..."
|
||||
sudo tar -xf wabt.tar.gz
|
||||
sudo ln -sf wabt-1.0.37 wabt
|
||||
|
||||
/opt/wasi-sdk/bin/clang --version
|
||||
/opt/wabt/bin/wasm-interp --version
|
||||
|
||||
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on ubuntu"
|
||||
working-directory: /opt
|
||||
|
||||
- name: Set up wasi-sdk and wabt on macOS-13 (intel)
|
||||
if: ${{ inputs.os == 'macos-13' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Downloading wasi-sdk for macOS-13..."
|
||||
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-macos.tar.gz
|
||||
|
||||
echo "Extracting wasi-sdk..."
|
||||
sudo tar -xf wasi-sdk.tar.gz
|
||||
sudo ln -sf wasi-sdk-25.0-x86_64-macos wasi-sdk
|
||||
|
||||
echo "Downloading wabt for macOS-13..."
|
||||
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.36/wabt-1.0.36-macos-12.tar.gz
|
||||
|
||||
echo "Extracting wabt..."
|
||||
sudo tar -xf wabt.tar.gz
|
||||
sudo ln -sf wabt-1.0.36 wabt
|
||||
|
||||
/opt/wasi-sdk/bin/clang --version
|
||||
/opt/wabt/bin/wasm-interp --version
|
||||
|
||||
echo "::notice::wasi-sdk-25 and wabt-1.0.36 installed on macos-13"
|
||||
working-directory: /opt
|
||||
|
||||
- name: Set up wasi-sdk and wabt on macOS-14 (arm64)
|
||||
if: ${{ inputs.os == 'macos-14' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Downloading wasi-sdk for macOS-14..."
|
||||
sudo wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-arm64-macos.tar.gz
|
||||
|
||||
echo "Extracting wasi-sdk..."
|
||||
sudo tar -xf wasi-sdk.tar.gz
|
||||
sudo ln -sf wasi-sdk-25.0-arm64-macos wasi-sdk
|
||||
|
||||
echo "Downloading wabt for macOS-14..."
|
||||
sudo wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-macos-14.tar.gz
|
||||
|
||||
echo "Extracting wabt..."
|
||||
sudo tar -xf wabt.tar.gz
|
||||
sudo ln -sf wabt-1.0.37 wabt
|
||||
|
||||
/opt/wasi-sdk/bin/clang --version
|
||||
/opt/wabt/bin/wasm-interp --version
|
||||
|
||||
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on macos-14"
|
||||
working-directory: /opt
|
||||
|
||||
- name: Set up wasi-sdk and wabt on Windows
|
||||
if: ${{ startsWith(inputs.os, 'windows') }}
|
||||
shell: bash
|
||||
run: |
|
||||
choco install -y wget
|
||||
|
||||
mkdir -p /opt/wasi-sdk
|
||||
mkdir -p /opt/wabt
|
||||
|
||||
echo "Downloading wasi-sdk for Windows..."
|
||||
wget -O wasi-sdk.tar.gz --progress=dot:giga https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-windows.tar.gz
|
||||
|
||||
echo "Extracting wasi-sdk..."
|
||||
tar --strip-components=1 -xf wasi-sdk.tar.gz -C /opt/wasi-sdk
|
||||
|
||||
echo "Downloading wabt for Windows..."
|
||||
wget -O wabt.tar.gz --progress=dot:giga https://github.com/WebAssembly/wabt/releases/download/1.0.37/wabt-1.0.37-windows.tar.gz
|
||||
|
||||
echo "Extracting wabt..."
|
||||
tar --strip-components=1 -xf wabt.tar.gz -C /opt/wabt
|
||||
|
||||
/opt/wasi-sdk/bin/clang --version
|
||||
/opt/wabt/bin/wasm-interp --version
|
||||
|
||||
echo "::notice::wasi-sdk-25 and wabt-1.0.37 installed on Windows"
|
35
.github/dependabot.yml
vendored
35
.github/dependabot.yml
vendored
|
@ -1,35 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "docker"
|
||||
directory: "/.devcontainer"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "devcontainers"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/build-scripts"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/language-bindings/python/wasm-c-api"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/language-bindings/python/wamr-api"
|
||||
schedule:
|
||||
interval: "weekly"
|
312
.github/scripts/codeql_buildscript.sh
vendored
312
.github/scripts/codeql_buildscript.sh
vendored
|
@ -1,312 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
sudo apt update
|
||||
|
||||
sudo apt install -y build-essential cmake g++-multilib libgcc-12-dev lib32gcc-12-dev ccache ninja-build
|
||||
|
||||
WAMR_DIR=${PWD}
|
||||
|
||||
# TODO: use pre-built llvm binary to build wamrc to
|
||||
# avoid static code analysing for llvm
|
||||
: '
|
||||
# build wamrc
|
||||
cd ${WAMR_DIR}/wamr-compiler
|
||||
./build_llvm.sh
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake ..
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build wamrc!"
|
||||
exit 1;
|
||||
fi
|
||||
'
|
||||
|
||||
# build iwasm with default features enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake ..
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with default features enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with default features enabled on x86_32
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake .. -DWAMR_BUILD_TARGET=X86_32
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with default features enabled on x86_32!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with classic interpreter enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_INTERP=0
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with classic interpreter enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with extra features enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DWAMR_BUILD_LIB_PTHREAD=1 -DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
|
||||
-DWAMR_BUILD_MULTI_MODULE=1 -DWAMR_BUILD_SIMD=1 \
|
||||
-DWAMR_BUILD_TAIL_CALL=1 -DWAMR_BUILD_REF_TYPES=1 \
|
||||
-DWAMR_BUILD_CUSTOM_NAME_SECTION=1 -DWAMR_BUILD_MEMORY_PROFILING=1 \
|
||||
-DWAMR_BUILD_PERF_PROFILING=1 -DWAMR_BUILD_DUMP_CALL_STACK=1 \
|
||||
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build wamrc iwasm with extra features enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with global heap pool enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug \
|
||||
-DWAMR_BUILD_ALLOC_WITH_USER_DATA=1 \
|
||||
-DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1 \
|
||||
-DWAMR_BUILD_GLOBAL_HEAP_POOL=1 \
|
||||
-DWAMR_BUILD_GLOBAL_HEAP_SIZE=131072
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with global heap pool enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with wasi-threads enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LIB_WASI_THREADS=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with wasi-threads enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with GC enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_GC=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with GC enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with exception handling enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_EXCE_HANDLING=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with exception handling enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with memory64 enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MEMORY64=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with memory64 enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with multi-memory enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MULTI_MEMORY=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with multi-memory enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with hardware boundary check disabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_DISABLE_HW_BOUND_CHECK=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with hardware boundary check disabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with quick AOT entry disabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_QUICK_AOT_ENTRY=0
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with quick AOT entry disabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with wakeup of blocking operations disabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_DISABLE_WAKEUP_BLOCKING_OP=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with wakeup of blocking operations disabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with module instance context disabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MODULE_INST_CONTEXT=0 \
|
||||
-DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_LIBC_WASI=0
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with module instance context disabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with libc-uvwasi enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -fr build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LIBC_UVWASI=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with libc-uvwasi enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with fast jit lazy mode enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with fast jit lazy mode enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with fast jit eager mode enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_FAST_JIT_DUMP=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with fast jit eager mode enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# TODO: use pre-built llvm binary to build llvm-jit and multi-tier-jit
|
||||
: '
|
||||
# build iwasm with llvm jit lazy mode enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_JIT=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build llvm jit lazy mode enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with llvm jit eager mode enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build llvm jit eager mode enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with multi-tier jit enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
|
||||
-DWAMR_BUILD_FAST_JIT_DUMP=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with multi-tier jit enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
'
|
||||
|
||||
# build iwasm with wasm mini-loader enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_MINI_LOADER=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build with wasm mini-loader enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with source debugging enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_DEBUG_INTERP=1 -DWAMR_BUILD_DEBUG_AOT=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with source debugging enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with AOT static PGO enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_STATIC_PGO=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with AOT static PGO enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with configurable bounds checks enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_CONFIGURABLE_BOUNDS_CHECKS=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with configurable bounds checks enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with linux perf support enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux/
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_LINUX_PERF=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with linux perf support enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with shared heap enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_SHARED_HEAP=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm with shared heap enabled!"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# build iwasm with dynamic aot debug enabled
|
||||
cd ${WAMR_DIR}/product-mini/platforms/linux
|
||||
rm -rf build && mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Debug -DWAMR_BUILD_DYNAMIC_AOT_DEBUG=1
|
||||
make -j
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Failed to build iwasm dynamic aot debug enabled!"
|
||||
exit 1;
|
||||
fi
|
124
.github/scripts/codeql_fail_on_error.py
vendored
124
.github/scripts/codeql_fail_on_error.py
vendored
|
@ -1,124 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
import requests
|
||||
|
||||
|
||||
def fetch_dismissed_alerts(repo_name, github_token):
|
||||
headers = {
|
||||
"Authorization": f"token {github_token}",
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
}
|
||||
url = (
|
||||
f"https://api.github.com/repos/{repo_name}/code-scanning/alerts?state=dismissed"
|
||||
)
|
||||
response = requests.get(url, headers=headers)
|
||||
return response.json() # This assumes a successful API call
|
||||
|
||||
|
||||
def parse_location(location):
|
||||
path = location.get("physicalLocation", {}).get("artifactLocation", {}).get("uri")
|
||||
start_line = location.get("physicalLocation", {}).get("region", {}).get("startLine")
|
||||
column_range = (
|
||||
location.get("physicalLocation", {}).get("region", {}).get("startColumn"),
|
||||
location.get("physicalLocation", {}).get("region", {}).get("endColumn"),
|
||||
)
|
||||
return (path, start_line, column_range)
|
||||
|
||||
|
||||
def is_dismissed(rule_id, path, start_line, column_range, dismissed_alerts):
|
||||
for alert in dismissed_alerts:
|
||||
alert_rule_id = alert.get("rule", {}).get("id")
|
||||
alert_path = alert.get("location", {}).get("path")
|
||||
alert_start_line = alert.get("location", {}).get("start_line")
|
||||
alert_column_range = (
|
||||
alert.get("location", {}).get("start_column"),
|
||||
alert.get("location", {}).get("end_column"),
|
||||
)
|
||||
|
||||
if (
|
||||
rule_id == alert_rule_id
|
||||
and path == alert_path
|
||||
and start_line == alert_start_line
|
||||
and column_range == alert_column_range
|
||||
):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
# Return whether SARIF file contains error-level results
|
||||
def codeql_sarif_contain_error(filename, dismissed_alerts):
|
||||
has_error = False
|
||||
|
||||
with open(filename, "r") as f:
|
||||
s = json.load(f)
|
||||
|
||||
for run in s.get("runs", []):
|
||||
rules_metadata = run["tool"]["driver"]["rules"]
|
||||
if not rules_metadata:
|
||||
rules_metadata = run["tool"]["extensions"][0]["rules"]
|
||||
|
||||
for res in run.get("results", []):
|
||||
if "ruleIndex" in res:
|
||||
rule_index = res["ruleIndex"]
|
||||
elif "rule" in res and "index" in res["rule"]:
|
||||
rule_index = res["rule"]["index"]
|
||||
else:
|
||||
continue
|
||||
|
||||
# check whether it's dismissed before
|
||||
rule_id = res["ruleId"]
|
||||
path, start_line, column_range = parse_location(res["locations"][0])
|
||||
# the source code is from dependencies
|
||||
if "_deps" in path:
|
||||
continue
|
||||
if is_dismissed(rule_id, path, start_line, column_range, dismissed_alerts):
|
||||
print(
|
||||
f"====== Finding a dismissed entry: {rule_id} at {path}:{start_line} is dismissed.======"
|
||||
)
|
||||
print(res)
|
||||
continue
|
||||
|
||||
try:
|
||||
rule_level = rules_metadata[rule_index]["defaultConfiguration"]["level"]
|
||||
except IndexError as e:
|
||||
print(e, rule_index, len(rules_metadata))
|
||||
else:
|
||||
if rule_level == "error":
|
||||
# very likely to be an actual error
|
||||
if rules_metadata[rule_index]["properties"].get("precision") in [
|
||||
"high",
|
||||
"very-high",
|
||||
]:
|
||||
# the security severity is above medium(Common Vulnerability Scoring System (CVSS) >= 4.0)
|
||||
if "security-severity" in rules_metadata[rule_index][
|
||||
"properties"
|
||||
] and (
|
||||
float(
|
||||
rules_metadata[rule_index]["properties"][
|
||||
"security-severity"
|
||||
]
|
||||
)
|
||||
> 4.0
|
||||
):
|
||||
print("====== Finding a likely error. ======")
|
||||
print(res)
|
||||
has_error = True
|
||||
|
||||
return has_error
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
|
||||
GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY")
|
||||
dismissed_alerts = fetch_dismissed_alerts(GITHUB_REPOSITORY, GITHUB_TOKEN)
|
||||
|
||||
if codeql_sarif_contain_error(sys.argv[1], dismissed_alerts):
|
||||
sys.exit(1)
|
60
.github/scripts/extract_from_release_notes.py
vendored
60
.github/scripts/extract_from_release_notes.py
vendored
|
@ -1,60 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
"""
|
||||
Extract the latest release notes content from RELEASE_NOTES.md
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
def latest_content(release_notes_path):
|
||||
"""
|
||||
can't change the format of the original content
|
||||
"""
|
||||
content = ""
|
||||
start_extract = False
|
||||
with open(release_notes_path, encoding="utf-8") as f:
|
||||
for line in f:
|
||||
if line.startswith("## "):
|
||||
if start_extract:
|
||||
break
|
||||
|
||||
start_extract = True
|
||||
continue
|
||||
|
||||
# hit a separated line
|
||||
if line.startswith("---"):
|
||||
break
|
||||
|
||||
content += line
|
||||
|
||||
content += os.linesep
|
||||
return content
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
GO!GO!!GO!!!
|
||||
"""
|
||||
parser = argparse.ArgumentParser(description="run the sample and examine outputs")
|
||||
parser.add_argument("release_notes_path", type=str)
|
||||
args = parser.parse_args()
|
||||
|
||||
ret = 1
|
||||
try:
|
||||
print(latest_content(args.release_notes_path))
|
||||
ret = 0
|
||||
except AssertionError:
|
||||
traceback.print_exc()
|
||||
return ret
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
126
.github/scripts/fetch_and_compare_version.py
vendored
126
.github/scripts/fetch_and_compare_version.py
vendored
|
@ -1,126 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def fetch_version_from_code():
|
||||
"""
|
||||
search the semantic version definition in core/version.h
|
||||
"""
|
||||
major, minor, patch = "", "", ""
|
||||
with open("core/version.h", encoding="utf-8") as f:
|
||||
for line in f:
|
||||
if "WAMR_VERSION" not in line:
|
||||
continue
|
||||
|
||||
major_match = re.search(r"WAMR_VERSION_MAJOR (\d+)", line)
|
||||
if major_match is not None:
|
||||
major = major_match.groups()[0]
|
||||
continue
|
||||
|
||||
minor_match = re.search(r"WAMR_VERSION_MINOR (\d+)", line)
|
||||
if minor_match is not None:
|
||||
minor = minor_match.groups()[0]
|
||||
continue
|
||||
|
||||
patch_match = re.search(r"WAMR_VERSION_PATCH (\d+)", line)
|
||||
if patch_match is not None:
|
||||
patch = patch_match.groups()[0]
|
||||
|
||||
if len(major) == 0 or len(minor) == 0 or len(patch) == 0:
|
||||
raise Exception(
|
||||
"can't find the semantic version definition likes WAMR_VERSION_*"
|
||||
)
|
||||
return f"WAMR-{major}.{minor}.{patch}"
|
||||
|
||||
|
||||
def fetch_latest_git_tag():
|
||||
"""
|
||||
Get the most recent tag from the HEAD,
|
||||
if it's main branch, it should be the latest release tag.
|
||||
if it's release/x.x.x branch, it should be the latest release tag of the branch.
|
||||
"""
|
||||
list_tag_cmd = "git describe --tags --abbrev=0 HEAD"
|
||||
p = subprocess.run(shlex.split(list_tag_cmd), capture_output=True, check=True)
|
||||
|
||||
all_tags = p.stdout.decode().strip()
|
||||
latest_tag = all_tags.split("\n")[-1]
|
||||
return latest_tag
|
||||
|
||||
|
||||
def match_version_pattern(v):
|
||||
pattern = r"WAMR-\d+\.\d+\.\d+"
|
||||
m = re.match(pattern, v)
|
||||
return m is not None
|
||||
|
||||
|
||||
def split_version_string(v):
|
||||
"""
|
||||
return the semantic version as an integer list
|
||||
"""
|
||||
pattern = r"WAMR-(\d+)\.(\d+)\.(\d+)"
|
||||
m = re.match(pattern, v)
|
||||
return [int(x) for x in m.groups()]
|
||||
|
||||
|
||||
def compare_version_string(v1, v2):
|
||||
"""
|
||||
return value:
|
||||
- 1. if v1 > v2
|
||||
- -1. if v1 < v2
|
||||
- 0. if v1 == v2
|
||||
"""
|
||||
if not match_version_pattern(v1):
|
||||
raise Exception(f"{v1} doesn't match the version pattern")
|
||||
|
||||
if not match_version_pattern(v2):
|
||||
raise Exception(f"{v2} doesn't match the version pattern")
|
||||
|
||||
v1_sem_ver = split_version_string(v1)
|
||||
v2_sem_ver = split_version_string(v2)
|
||||
|
||||
return 0 if v1_sem_ver == v2_sem_ver else (1 if v1_sem_ver > v2_sem_ver else -1)
|
||||
|
||||
|
||||
def is_major_or_minor_changed(v1, v2):
|
||||
"""
|
||||
return true if change either major of v2 or minor of v2
|
||||
return false or else
|
||||
"""
|
||||
if not match_version_pattern(v1):
|
||||
raise Exception(f"{v1} doesn't match the version pattern")
|
||||
|
||||
if not match_version_pattern(v2):
|
||||
raise Exception(f"{v2} doesn't match the version pattern")
|
||||
|
||||
v1_major, v1_minor, _ = split_version_string(v1)
|
||||
v2_major, v2_minor, _ = split_version_string(v2)
|
||||
|
||||
return v2_major != v1_major or v2_minor != v1_minor
|
||||
|
||||
|
||||
def next_version():
|
||||
definition = fetch_version_from_code()
|
||||
tag = fetch_latest_git_tag()
|
||||
|
||||
new_version = ""
|
||||
minor_changed = False
|
||||
if compare_version_string(definition, tag) == 1:
|
||||
new_version = definition.split("-")[-1]
|
||||
|
||||
if is_major_or_minor_changed(tag, definition):
|
||||
minor_changed = True
|
||||
|
||||
return new_version, "major_minor_change" if minor_changed else "patch_change"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(f"{next_version()[0]},{next_version()[1]}")
|
||||
sys.exit(0)
|
10
.github/scripts/install_qemu_xtensa.sh
vendored
10
.github/scripts/install_qemu_xtensa.sh
vendored
|
@ -1,10 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
URL=https://github.com/espressif/qemu/releases/download/esp-develop-9.0.0-20240606/qemu-xtensa-softmmu-esp_develop_9.0.0_20240606-x86_64-linux-gnu.tar.xz
|
||||
|
||||
DIR=$(mktemp -d)
|
||||
cd ${DIR}
|
||||
curl -fLsS "${URL}" | xzcat | tar -x
|
||||
ln -s ${DIR}/qemu/bin/qemu-system-xtensa /usr/local/bin/qemu-system-xtensa
|
102
.github/scripts/reuse_latest_release_binaries.py
vendored
102
.github/scripts/reuse_latest_release_binaries.py
vendored
|
@ -1,102 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
from urllib.error import HTTPError, URLError
|
||||
import urllib.request
|
||||
|
||||
|
||||
def get_last_commit(target_path, cwd):
|
||||
last_commit_cmd = f"git log -n 1 --pretty=format:%H -- {target_path}"
|
||||
p = subprocess.run(
|
||||
shlex.split(last_commit_cmd), capture_output=True, check=True, cwd=cwd
|
||||
)
|
||||
return p.stdout.decode().strip()
|
||||
|
||||
|
||||
def fetch_git_tags():
|
||||
list_tag_cmd = (
|
||||
'git tag --list WAMR-*.*.* --sort=committerdate --format="%(refname:short)"'
|
||||
)
|
||||
p = subprocess.run(shlex.split(list_tag_cmd), capture_output=True, check=True)
|
||||
|
||||
all_tags = p.stdout.decode().strip()
|
||||
return all_tags.split("\n")
|
||||
|
||||
|
||||
def download_binaries(binary_name_stem, cwd):
|
||||
"""
|
||||
1. find the latest release name
|
||||
2. form assets download url:
|
||||
"""
|
||||
try:
|
||||
all_tags = fetch_git_tags()
|
||||
# *release_process.yml* will create a tag and release at first
|
||||
second_last_tag = all_tags[-2]
|
||||
latest_tag = all_tags[-1]
|
||||
|
||||
latest_url = "https://api.github.com/repos/bytecodealliance/wasm-micro-runtime/releases/latest"
|
||||
print(f"::notice::query the latest release with {latest_url}...")
|
||||
with urllib.request.urlopen(latest_url) as response:
|
||||
body = response.read()
|
||||
|
||||
release_name = json.loads(body)["name"]
|
||||
|
||||
# WAMR-X.Y.Z -> X.Y.Z
|
||||
second_last_sem_ver = second_last_tag[5:]
|
||||
latest_sem_ver = latest_tag[5:]
|
||||
assert latest_sem_ver in binary_name_stem
|
||||
name_stem_in_release = binary_name_stem.replace(
|
||||
latest_sem_ver, second_last_sem_ver
|
||||
)
|
||||
|
||||
# download and rename
|
||||
for file_ext in (".zip", ".tar.gz"):
|
||||
assets_url = f"https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/{release_name}/{name_stem_in_release}{file_ext}"
|
||||
local_path = f"{binary_name_stem}{file_ext}"
|
||||
print(f"::notice::download from {assets_url} and save as {local_path}...")
|
||||
urllib.request.urlretrieve(assets_url, local_path)
|
||||
return True
|
||||
except HTTPError as error:
|
||||
print(error.status, error.reason)
|
||||
except URLError as error:
|
||||
print(error.reason)
|
||||
except TimeoutError:
|
||||
print("Request timeout")
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Reuse binaries of the latest release if no more modification on the_path since last_commit"
|
||||
)
|
||||
parser.add_argument("working_directory", type=str)
|
||||
parser.add_argument("--binary_name_stem", type=str)
|
||||
parser.add_argument("--last_commit", type=str)
|
||||
parser.add_argument("--the_path", type=str)
|
||||
args = parser.parse_args()
|
||||
|
||||
last_commit = get_last_commit(args.the_path, args.working_directory)
|
||||
if last_commit == args.last_commit:
|
||||
return download_binaries(args.binary_name_stem, args.working_directory)
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# use output to indicate results
|
||||
# echo "result=${result}" >> "$GITHUB_OUTPUT"
|
||||
with open(os.environ.get("GITHUB_OUTPUT"), 'a') as output_file:
|
||||
output_file.write("result=hit\n" if main() else "result=not-hit\n")
|
||||
|
||||
# always return 0
|
||||
sys.exit(0)
|
94
.github/workflows/build_docker_images.yml
vendored
94
.github/workflows/build_docker_images.yml
vendored
|
@ -1,94 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: Create and publish Docker images
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
upload_url:
|
||||
description: upload binary assets to the URL of release
|
||||
type: string
|
||||
required: true
|
||||
ver_num:
|
||||
description: a semantic version number.
|
||||
type: string
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-push-images:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and save Docker image(wasm-debug-server:${{ inputs.ver_num }}) to tar file
|
||||
run: |
|
||||
docker build -t wasm-debug-server:${{ inputs.ver_num }} .
|
||||
docker save -o wasm-debug-server.tar wasm-debug-server:${{ inputs.ver_num }}
|
||||
working-directory: test-tools/wamr-ide/WASM-Debug-Server/Docker
|
||||
|
||||
- name: compress the tar file
|
||||
run: |
|
||||
tar czf wasm-debug-server-${{ inputs.ver_num }}.tar.gz wasm-debug-server.tar
|
||||
zip wasm-debug-server-${{ inputs.ver_num }}.zip wasm-debug-server.tar
|
||||
working-directory: test-tools/wamr-ide/WASM-Debug-Server/Docker
|
||||
|
||||
- name: upload release tar.gz
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: test-tools/wamr-ide/WASM-Debug-Server/Docker/wasm-debug-server-${{ inputs.ver_num }}.tar.gz
|
||||
asset_name: wasm-debug-server-${{ inputs.ver_num }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: test-tools/wamr-ide/WASM-Debug-Server/Docker/wasm-debug-server-${{ inputs.ver_num }}.zip
|
||||
asset_name: wasm-debug-server-${{ inputs.ver_num }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Build and save Docker image(wasm-toolchain:${{ inputs.ver_num }}) to tar file
|
||||
run: |
|
||||
docker build -t wasm-toolchain:${{ inputs.ver_num }} .
|
||||
docker save -o wasm-toolchain.tar wasm-toolchain:${{ inputs.ver_num }}
|
||||
working-directory: test-tools/wamr-ide/WASM-Toolchain/Docker
|
||||
|
||||
- name: compress the tar file
|
||||
run: |
|
||||
tar czf wasm-toolchain-${{ inputs.ver_num }}.tar.gz wasm-toolchain.tar
|
||||
zip wasm-toolchain-${{ inputs.ver_num }}.zip wasm-toolchain.tar
|
||||
working-directory: test-tools/wamr-ide/WASM-Toolchain/Docker
|
||||
|
||||
- name: upload release tar.gz
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: test-tools/wamr-ide/WASM-Toolchain/Docker/wasm-toolchain-${{ inputs.ver_num }}.tar.gz
|
||||
asset_name: wasm-toolchain-${{ inputs.ver_num }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: test-tools/wamr-ide/WASM-Toolchain/Docker/wasm-toolchain-${{ inputs.ver_num }}.zip
|
||||
asset_name: wasm-toolchain-${{ inputs.ver_num }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
163
.github/workflows/build_iwasm_release.yml
vendored
163
.github/workflows/build_iwasm_release.yml
vendored
|
@ -1,163 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: build iwasm release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
description: arch of the release
|
||||
type: string
|
||||
required: false
|
||||
default: x86_64
|
||||
cwd:
|
||||
description: working directory
|
||||
type: string
|
||||
required: true
|
||||
llvm_cache_key:
|
||||
description: the cache key of llvm libraries
|
||||
type: string
|
||||
required: true
|
||||
runner:
|
||||
description: OS of compilation
|
||||
type: string
|
||||
required: true
|
||||
upload_url:
|
||||
description: a semantic version number. it is required when `release` is true.
|
||||
type: string
|
||||
required: false
|
||||
ver_num:
|
||||
description: a semantic version number. it is required when `release` is true.
|
||||
type: string
|
||||
required: false
|
||||
|
||||
env:
|
||||
DEFAULT_BUILD_OPTIONS:
|
||||
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 \
|
||||
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
|
||||
-DWAMR_BUILD_DEBUG_INTERP=0 \
|
||||
-DWAMR_BUILD_DEBUG_AOT=0 \
|
||||
-DWAMR_BUILD_DUMP_CALL_STACK=0 \
|
||||
-DWAMR_BUILD_LIBC_UVWASI=0 \
|
||||
-DWAMR_BUILD_LIBC_EMCC=0 \
|
||||
-DWAMR_BUILD_LIB_RATS=0 \
|
||||
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
|
||||
-DWAMR_BUILD_MEMORY_PROFILING=0 \
|
||||
-DWAMR_BUILD_MINI_LOADER=0 \
|
||||
-DWAMR_BUILD_MULTI_MODULE=0 \
|
||||
-DWAMR_BUILD_PERF_PROFILING=0 \
|
||||
-DWAMR_BUILD_SPEC_TEST=0 \
|
||||
-DWAMR_BUILD_BULK_MEMORY=1 \
|
||||
-DWAMR_BUILD_LIB_PTHREAD=1 \
|
||||
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
|
||||
-DWAMR_BUILD_LIB_WASI_THREADS=1 \
|
||||
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
||||
-DWAMR_BUILD_LIBC_WASI=1 \
|
||||
-DWAMR_BUILD_REF_TYPES=1 \
|
||||
-DWAMR_BUILD_SIMD=1 \
|
||||
-DWAMR_BUILD_SHARED_MEMORY=1 \
|
||||
-DWAMR_BUILD_TAIL_CALL=1 \
|
||||
-DWAMR_BUILD_THREAD_MGR=1"
|
||||
GC_EH_BUILD_OPTIONS:
|
||||
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 \
|
||||
-DWAMR_BUILD_CUSTOM_NAME_SECTION=0 \
|
||||
-DWAMR_BUILD_DEBUG_INTERP=0 \
|
||||
-DWAMR_BUILD_DEBUG_AOT=0 \
|
||||
-DWAMR_BUILD_DUMP_CALL_STACK=0 \
|
||||
-DWAMR_BUILD_LIBC_UVWASI=0 \
|
||||
-DWAMR_BUILD_LIBC_EMCC=0 \
|
||||
-DWAMR_BUILD_LIB_RATS=0 \
|
||||
-DWAMR_BUILD_LOAD_CUSTOM_SECTION=0 \
|
||||
-DWAMR_BUILD_MEMORY_PROFILING=0 \
|
||||
-DWAMR_BUILD_MINI_LOADER=0 \
|
||||
-DWAMR_BUILD_MULTI_MODULE=0 \
|
||||
-DWAMR_BUILD_PERF_PROFILING=0 \
|
||||
-DWAMR_BUILD_SPEC_TEST=0 \
|
||||
-DWAMR_BUILD_BULK_MEMORY=1 \
|
||||
-DWAMR_BUILD_LIB_PTHREAD=1 \
|
||||
-DWAMR_BUILD_LIB_PTHREAD_SEMAPHORE=1 \
|
||||
-DWAMR_BUILD_LIB_WASI_THREADS=1 \
|
||||
-DWAMR_BUILD_LIBC_BUILTIN=1 \
|
||||
-DWAMR_BUILD_LIBC_WASI=1 \
|
||||
-DWAMR_BUILD_REF_TYPES=1 \
|
||||
-DWAMR_BUILD_SIMD=1 \
|
||||
-DWAMR_BUILD_SHARED_MEMORY=1 \
|
||||
-DWAMR_BUILD_TAIL_CALL=1 \
|
||||
-DWAMR_BUILD_THREAD_MGR=1 \
|
||||
-DWAMR_BUILD_EXCE_HANDLING=1 \
|
||||
-DWAMR_BUILD_GC=1"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ inputs.runner }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- build_options: $DEFAULT_BUILD_OPTIONS
|
||||
suffix: ''
|
||||
- build_options: $GC_EH_BUILD_OPTIONS
|
||||
suffix: '-gc-eh'
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: get cached LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ inputs.llvm_cache_key }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: generate iwasm binary release
|
||||
shell: bash
|
||||
run: |
|
||||
cmake -S . -B build ${{ matrix.build_options }}
|
||||
cmake --build build --config Release --parallel 4
|
||||
working-directory: ${{ inputs.cwd }}
|
||||
|
||||
- name: Compress the binary on Windows
|
||||
if: inputs.runner == 'windows-latest'
|
||||
run: |
|
||||
tar -czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm.exe
|
||||
Compress-Archive -Path iwasm.exe -DestinationPath iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||
mv iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
|
||||
working-directory: ${{ inputs.cwd }}/build/Release
|
||||
|
||||
- name: compress the binary on non-Windows
|
||||
if: inputs.runner != 'windows-latest'
|
||||
run: |
|
||||
# Follow the symlink to the actual binary file
|
||||
tar --dereference -czf iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz iwasm
|
||||
zip iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip iwasm
|
||||
working-directory: ${{ inputs.cwd }}/build
|
||||
|
||||
- name: upload release tar.gz
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: ${{ inputs.cwd }}/build/iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
||||
asset_name: iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: ${{ inputs.cwd }}/build/iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||
asset_name: iwasm${{ matrix.suffix }}-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
||||
asset_content_type: application/zip
|
131
.github/workflows/build_llvm_libraries.yml
vendored
131
.github/workflows/build_llvm_libraries.yml
vendored
|
@ -1,131 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: Reusable workflow-build_llvm_libraries
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
os:
|
||||
required: true
|
||||
type: string
|
||||
arch:
|
||||
required: true
|
||||
type: string
|
||||
container_image:
|
||||
required: false
|
||||
type: string
|
||||
extra_build_llvm_options:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
cache_key_suffix:
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
outputs:
|
||||
cache_key:
|
||||
description: "A cached key of LLVM libraries"
|
||||
value: ${{ jobs.build_llvm_libraries.outputs.key}}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries:
|
||||
runs-on: ${{ inputs.os }}
|
||||
# Using given container image if it is specified.
|
||||
# Otherwise, it will be ignored by the runner.
|
||||
container:
|
||||
image: ${{ inputs.container_image }}
|
||||
outputs:
|
||||
key: ${{ steps.create_lib_cache_key.outputs.key}}
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write # for uploading cached artifact
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install dependencies for non macos-14
|
||||
if: inputs.os != 'macos-14'
|
||||
shell: bash
|
||||
run: /usr/bin/env python3 -m pip install -r requirements.txt
|
||||
working-directory: build-scripts
|
||||
|
||||
- name: install dependencies for macos-14
|
||||
if: inputs.os == 'macos-14'
|
||||
run: /usr/bin/env python3 -m pip install -r requirements.txt --break-system-packages
|
||||
working-directory: build-scripts
|
||||
|
||||
- name: Retrieve the last commit ID
|
||||
id: get_last_commit
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py ${{ inputs.extra_build_llvm_options }} --llvm-ver)" >> $GITHUB_OUTPUT
|
||||
working-directory: build-scripts
|
||||
|
||||
# Bump the prefix number to evict all previous caches and
|
||||
# enforce a clean build, in the unlikely case that some
|
||||
# weird build error occur and llvm/build becomes a potential
|
||||
# suspect.
|
||||
- name: form the cache key of libraries
|
||||
id: create_lib_cache_key
|
||||
shell: bash
|
||||
run: |
|
||||
echo "key=0-llvm-libraries-${{ inputs.os }}-${{ inputs.arch }}-${{ steps.get_last_commit.outputs.last_commit }}${{ inputs.cache_key_suffix }}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ steps.create_lib_cache_key.outputs.key}}
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ccache
|
||||
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
|
||||
restore-keys: |
|
||||
0-ccache-${{ inputs.os }}
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'ubuntu-22.04'
|
||||
|
||||
# Don't install dependencies if the cache is hit or running in docker container
|
||||
- run: sudo apt install -y ccache ninja-build
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'ubuntu') && inputs.container_image == ''
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/Library/Caches/ccache
|
||||
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
|
||||
restore-keys: |
|
||||
0-ccache-${{ inputs.os }}
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
|
||||
|
||||
- run: brew install ccache ninja
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && startsWith(inputs.os, 'macos')
|
||||
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/ccache
|
||||
key: 0-ccache-${{ inputs.os }}-${{ steps.get_last_commit.outputs.last_commit }}
|
||||
restore-keys: |
|
||||
0-ccache-${{ inputs.os }}
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'windows-latest'
|
||||
|
||||
# Install tools on Windows
|
||||
- run: choco install -y ccache ninja
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' && inputs.os == 'windows-latest'
|
||||
|
||||
- name: Build LLVM libraries
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: /usr/bin/env python3 ./build_llvm.py ${{ inputs.extra_build_llvm_options }} --arch ${{ inputs.arch }}
|
||||
working-directory: build-scripts
|
269
.github/workflows/build_wamr_lldb.yml
vendored
269
.github/workflows/build_wamr_lldb.yml
vendored
|
@ -1,269 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: build wamr lldb
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
description: arch of the release
|
||||
type: string
|
||||
required: false
|
||||
default: x86_64
|
||||
runner:
|
||||
description: OS of compilation
|
||||
type: string
|
||||
required: true
|
||||
upload_url:
|
||||
description: upload binary assets to the URL of release
|
||||
type: string
|
||||
required: true
|
||||
ver_num:
|
||||
description: a semantic version number
|
||||
type: string
|
||||
required: true
|
||||
wasi_sdk_url:
|
||||
description: download WASI_SDK from this URL
|
||||
type: string
|
||||
required: false
|
||||
default: "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
try_reuse:
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
uses: ./.github/workflows/reuse_latest_release_binaries.yml
|
||||
with:
|
||||
binary_name_stem: "wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}"
|
||||
last_commit: "ea63ba4bd010c2285623ad4acc0262a4d63bcfea"
|
||||
the_path: "./build-scripts/lldb_wasm.patch"
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
|
||||
build:
|
||||
needs: try_reuse
|
||||
if: needs.try_reuse.outputs.result != 'hit'
|
||||
runs-on: ${{ inputs.runner }}
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.10'
|
||||
PYTHON_UBUNTU_STANDALONE_BUILD: https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-unknown-linux-gnu-install_only.tar.gz
|
||||
PYTHON_MACOS_STANDALONE_BUILD: https://github.com/indygreg/python-build-standalone/releases/download/20230507/cpython-3.10.11+20230507-x86_64-apple-darwin-install_only.tar.gz
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: download and install wasi-sdk
|
||||
run: |
|
||||
cd /opt
|
||||
basename=$(basename ${{ inputs.wasi_sdk_url }})
|
||||
sudo wget --progress=dot:giga ${{ inputs.wasi_sdk_url }}
|
||||
sudo tar -xzf ${basename}
|
||||
sudo rm ${basename}
|
||||
sudo mv wasi-sdk-* wasi-sdk
|
||||
|
||||
- name: Cache build
|
||||
id: lldb_build_cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm-project/build/bin
|
||||
./core/deps/llvm-project/build/include
|
||||
./core/deps/llvm-project/build/lib
|
||||
./core/deps/llvm-project/build/libexec
|
||||
./core/deps/llvm-project/build/share
|
||||
./core/deps/llvm-project/lldb/tools/
|
||||
./core/deps/llvm-project/wamr-lldb/
|
||||
key: ${{inputs.arch}}-${{ inputs.runner }}-lldb_build
|
||||
|
||||
- name: setup xcode macos
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||||
uses: maxim-lobanov/setup-xcode@v1
|
||||
with:
|
||||
xcode-version: latest-stable
|
||||
|
||||
# Remove xCode command line tools, to prevent duplicate symbol compilation failures
|
||||
- name: install utils macos
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||||
run: |
|
||||
brew install swig cmake ninja libedit
|
||||
sudo rm -rf /Library/Developer/CommandLineTools
|
||||
|
||||
- name: install utils ubuntu
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||||
run: sudo apt update && sudo apt-get install -y lld ninja-build
|
||||
|
||||
# `git clone` takes ~7m
|
||||
- name: download llvm
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
wget https://github.com/llvm/llvm-project/archive/1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
|
||||
unzip -q 1f27fe6128769f00197925c3b8f6abb9d0e5cd2e.zip
|
||||
mv llvm-project-1f27fe6128769f00197925c3b8f6abb9d0e5cd2e llvm-project
|
||||
working-directory: core/deps/
|
||||
|
||||
- name: apply wamr patch
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git init
|
||||
git config user.email "action@github.com"
|
||||
git config user.name "github action"
|
||||
git apply ../../../build-scripts/lldb_wasm.patch
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: get stand-alone python ubuntu
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||||
run: |
|
||||
wget ${{ env.PYTHON_UBUNTU_STANDALONE_BUILD }} -O python.tar.gz
|
||||
tar -xvf python.tar.gz
|
||||
working-directory: core/deps
|
||||
|
||||
- name: get stand-alone python macos
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||||
run: |
|
||||
wget ${{ env.PYTHON_MACOS_STANDALONE_BUILD }} -O python.tar.gz
|
||||
tar -xvf python.tar.gz
|
||||
working-directory: core/deps
|
||||
|
||||
- name: build lldb ubuntu
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||||
run: |
|
||||
echo "start to build lldb..."
|
||||
mkdir -p wamr-lldb
|
||||
cmake -S ./llvm -B build \
|
||||
-G Ninja \
|
||||
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
|
||||
-DCMAKE_BUILD_TYPE:STRING="Release" \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
|
||||
-DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
|
||||
-DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
|
||||
-DLLVM_BUILD_DOCS:BOOL=OFF \
|
||||
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
|
||||
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
|
||||
-DLLVM_BUILD_TESTS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_DOCS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
|
||||
-DLLVM_ENABLE_BINDINGS:BOOL=OFF \
|
||||
-DLLVM_ENABLE_LIBXML2:BOOL=ON \
|
||||
-DLLVM_ENABLE_LLD:BOOL=ON \
|
||||
-DLLDB_ENABLE_PYTHON:BOOL=ON \
|
||||
-DLLDB_EMBED_PYTHON_HOME=ON \
|
||||
-DLLDB_PYTHON_HOME=.. \
|
||||
-DLLDB_PYTHON_RELATIVE_PATH=lib/lldb-python \
|
||||
-DPython3_EXECUTABLE="$(pwd)/../python/bin/python${{ env.PYTHON_VERSION }}"
|
||||
cmake --build build --target lldb install --parallel $(nproc)
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: validate lldb ubuntu
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||||
run: |
|
||||
echo "start to validate lldb..."
|
||||
mkdir -p wamr-debug
|
||||
cmake -S product-mini/platforms/linux -B wamr-debug -DWAMR_BUILD_DEBUG_INTERP=1
|
||||
cmake --build wamr-debug --parallel $(nproc)
|
||||
export LD_LIBRARY_PATH=$(pwd)/core/deps/python/lib:${LD_LIBRARY_PATH}
|
||||
python3 ci/validate_lldb.py --port 1239 --lldb core/deps/wamr-lldb/bin/lldb --wamr wamr-debug/iwasm --verbose
|
||||
working-directory: .
|
||||
|
||||
# Define CMAKE_OSX_SYSROOT to avoid the error:
|
||||
# no such file or directory: 'llvm-project/build/tools/lldb/tools/debugserver/source/mach_excServer.c'
|
||||
# no such file or directory: 'llvm-project/build/tools/lldb/tools/debugserver/source/mach_excUser.c'
|
||||
#
|
||||
# This workaround should be removed when the issue is fixed in llvm-project:
|
||||
# - https://github.com/llvm/llvm-project/pull/138020/
|
||||
- name: build lldb macos
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||||
run: |
|
||||
echo "start to build lldb..."
|
||||
mkdir -p wamr-lldb
|
||||
cmake -S ./llvm -B build \
|
||||
-G Ninja \
|
||||
-DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) \
|
||||
-DCMAKE_INSTALL_PREFIX=../wamr-lldb \
|
||||
-DCMAKE_BUILD_TYPE:STRING="Release" \
|
||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
|
||||
-DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
|
||||
-DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
|
||||
-DLLVM_BUILD_DOCS:BOOL=OFF \
|
||||
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
|
||||
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF \
|
||||
-DLLVM_BUILD_TESTS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_DOCS:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
|
||||
-DLLVM_INCLUDE_TESTS:BOOL=OFF \
|
||||
-DLLVM_ENABLE_BINDINGS:BOOL=OFF \
|
||||
-DLLVM_ENABLE_LIBXML2:BOOL=ON \
|
||||
-DLLDB_BUILD_FRAMEWORK:BOOL=OFF \
|
||||
-DLLDB_ENABLE_PYTHON:BOOL=ON \
|
||||
-DLLDB_EMBED_PYTHON_HOME=ON \
|
||||
-DLLDB_PYTHON_HOME=.. \
|
||||
-DLLDB_PYTHON_RELATIVE_PATH=lib/lldb-python \
|
||||
-DPython3_EXECUTABLE="$(pwd)/../python/bin/python${{ env.PYTHON_VERSION }}"
|
||||
cmake --build build --target lldb install --parallel $(nproc)
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: pack a distribution
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
mkdir -p wamr-lldb/bin
|
||||
mkdir -p wamr-lldb/lib
|
||||
cp build/bin/lldb* wamr-lldb/bin
|
||||
cp lldb/tools/lldb-vscode/package.json wamr-lldb
|
||||
cp -r lldb/tools/lldb-vscode/syntaxes/ wamr-lldb
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: pack ubuntu specific libraries
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'ubuntu')
|
||||
run: |
|
||||
cp build/lib/liblldb*.so wamr-lldb/lib
|
||||
cp build/lib/liblldb*.so.* wamr-lldb/lib
|
||||
cp -R build/lib/lldb-python wamr-lldb/lib
|
||||
cp -R ../python/lib/python* wamr-lldb/lib
|
||||
cp ../python/lib/libpython${{ env.PYTHON_VERSION }}.so.1.0 wamr-lldb/lib
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: pack macos specific libraries
|
||||
if: steps.lldb_build_cache.outputs.cache-hit != 'true' && contains(inputs.runner, 'macos')
|
||||
run: |
|
||||
cp build/lib/liblldb*.dylib wamr-lldb/lib
|
||||
cp -R build/lib/lldb-python wamr-lldb/lib
|
||||
cp -R ../python/lib/python* wamr-lldb/lib
|
||||
cp ../python/lib/libpython*.dylib wamr-lldb/lib
|
||||
install_name_tool -change /install/lib/libpython${{ env.PYTHON_VERSION }}.dylib @rpath/libpython${{ env.PYTHON_VERSION }}.dylib wamr-lldb/lib/liblldb.*.dylib
|
||||
# Patch path of python library -> https://github.com/indygreg/python-build-standalone/blob/85923ca3911784e6978b85d56e06e9ae75cb2dc4/docs/quirks.rst?plain=1#L412-L446
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: compress the binary
|
||||
run: |
|
||||
tar czf wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamr-lldb
|
||||
zip -r wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamr-lldb
|
||||
working-directory: core/deps/llvm-project
|
||||
|
||||
- name: upload release tar.gz
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: core/deps/llvm-project/wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
||||
asset_name: wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: core/deps/llvm-project/wamr-lldb-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||
asset_name: wamr-lldb-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
||||
asset_content_type: application/zip
|
109
.github/workflows/build_wamr_sdk.yml
vendored
109
.github/workflows/build_wamr_sdk.yml
vendored
|
@ -1,109 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: build wamr-sdk
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
description: arch of the release
|
||||
type: string
|
||||
required: false
|
||||
default: x86_64
|
||||
config_file:
|
||||
description: warm-sdk config file path
|
||||
type: string
|
||||
required: true
|
||||
runner:
|
||||
description: OS of compilation
|
||||
type: string
|
||||
required: true
|
||||
upload_url:
|
||||
description: upload binary assets to the URL of release
|
||||
type: string
|
||||
required: true
|
||||
ver_num:
|
||||
description: a semantic version number
|
||||
type: string
|
||||
required: true
|
||||
wasi_sdk_url:
|
||||
description: download WASI_SDK from this URL
|
||||
type: string
|
||||
required: true
|
||||
wamr_app_framework_url:
|
||||
description: download WAMR app framework to get wamr_sdk
|
||||
type: string
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ inputs.runner }}
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: download wamr-app-framework
|
||||
run: |
|
||||
git clone ${{ inputs.wamr_app_framework_url }}
|
||||
cd wamr-app-framework
|
||||
git submodule init
|
||||
git submodule update
|
||||
working-directory: wamr-sdk
|
||||
|
||||
- name: download and install wasi-sdk
|
||||
run: |
|
||||
cd /opt
|
||||
basename=$(basename ${{ inputs.wasi_sdk_url }})
|
||||
sudo wget --progress=dot:giga ${{ inputs.wasi_sdk_url }}
|
||||
sudo tar -xzf ${basename}
|
||||
sudo rm ${basename}
|
||||
sudo mv wasi-sdk-* wasi-sdk
|
||||
|
||||
- name: download dependencies
|
||||
run: |
|
||||
cd ./wamr-app-framework/deps
|
||||
./download.sh
|
||||
working-directory: wamr-sdk
|
||||
|
||||
- name: generate wamr-sdk release
|
||||
run: |
|
||||
cd ./wamr-app-framework/wamr-sdk
|
||||
./build_sdk.sh -n wamr-sdk -x $(pwd)/${{ inputs.config_file }}
|
||||
working-directory: wamr-sdk
|
||||
|
||||
- name: compress the binary
|
||||
run: |
|
||||
cd wamr-app-framework/wamr-sdk/out
|
||||
tar czf wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamr-sdk
|
||||
zip -r wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamr-sdk
|
||||
working-directory: wamr-sdk
|
||||
|
||||
- name: upload release tar.gz
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: wamr-sdk/wamr-app-framework/wamr-sdk/out/wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
||||
asset_name: wamr-sdk-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: wamr-sdk/wamr-app-framework/wamr-sdk/out/wamr-sdk-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||
asset_name: wamr-sdk-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: delete wamr-app-framework
|
||||
run: |
|
||||
rm -rf wamr-app-framework
|
||||
working-directory: wamr-sdk
|
79
.github/workflows/build_wamr_vscode_ext.yml
vendored
79
.github/workflows/build_wamr_vscode_ext.yml
vendored
|
@ -1,79 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: build wamr-ide vscode extension
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
upload_url:
|
||||
description: upload binary assets to the URL of release
|
||||
type: string
|
||||
required: true
|
||||
ver_num:
|
||||
description: a semantic version number.
|
||||
type: string
|
||||
required: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: set vscode extension to correct version
|
||||
run: |
|
||||
npm install -g json
|
||||
json -I -f package.json -e "this.version=\"${{ inputs.ver_num }}\""
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension
|
||||
|
||||
- name: generate wamr ide vscode extension
|
||||
run: |
|
||||
npm install -g @vscode/vsce
|
||||
rm -rf node_modules
|
||||
npm install
|
||||
vsce package
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension
|
||||
|
||||
- name: publish wamr ide vscode extension to the vsce marketplace
|
||||
if: ${{ github.repository == 'bytecodealliance/wasm-micro-runtime' }}
|
||||
run: |
|
||||
vsce publish -p ${{ secrets.TOKEN }}
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension
|
||||
|
||||
- name: compress the vscode extension
|
||||
run: |
|
||||
mv wamride-*.vsix wamr-ide.vsix
|
||||
tar czf wamr-ide-${{ inputs.ver_num }}.tar.gz wamr-ide.vsix
|
||||
zip wamr-ide-${{ inputs.ver_num }}.zip wamr-ide.vsix
|
||||
working-directory: test-tools/wamr-ide/VSCode-Extension
|
||||
|
||||
- name: upload release tar.gz
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.tar.gz
|
||||
asset_name: wamr-ide-${{ inputs.ver_num }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: test-tools/wamr-ide/VSCode-Extension/wamr-ide-${{ inputs.ver_num }}.zip
|
||||
asset_name: wamr-ide-${{ inputs.ver_num }}.zip
|
||||
asset_content_type: application/zip
|
101
.github/workflows/build_wamrc.yml
vendored
101
.github/workflows/build_wamrc.yml
vendored
|
@ -1,101 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: build wamrc
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
arch:
|
||||
description: arch of the release
|
||||
type: string
|
||||
required: false
|
||||
default: x86_64
|
||||
llvm_cache_key:
|
||||
description: the cache key of llvm libraries
|
||||
type: string
|
||||
required: true
|
||||
release:
|
||||
description: it is a part of the release process
|
||||
type: boolean
|
||||
required: true
|
||||
runner:
|
||||
description: OS of compilation
|
||||
type: string
|
||||
required: true
|
||||
upload_url:
|
||||
description: a semantic version number. it is required when `release` is true.
|
||||
type: string
|
||||
required: false
|
||||
ver_num:
|
||||
description: a semantic version number. it is required when `release` is true.
|
||||
type: string
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ${{ inputs.runner }}
|
||||
permissions:
|
||||
contents: write # for uploading release artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: get cached LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ inputs.llvm_cache_key }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: generate wamrc binary release
|
||||
run: |
|
||||
cmake -S . -B build
|
||||
cmake --build build --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Compress the binary on Windows
|
||||
if: inputs.runner == 'windows-latest' && inputs.release
|
||||
run: |
|
||||
tar -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc.exe
|
||||
Compress-Archive -Path wamrc.exe -DestinationPath wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||
mv wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.* ../
|
||||
working-directory: wamr-compiler/build/Release
|
||||
|
||||
- name: compress the binary on non-Windows
|
||||
if: inputs.runner != 'windows-latest' && inputs.release
|
||||
run: |
|
||||
# Follow the symlink to the actual binary file
|
||||
tar --dereference -czf wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz wamrc
|
||||
zip wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip wamrc
|
||||
working-directory: wamr-compiler/build
|
||||
|
||||
- name: upload release tar.gz
|
||||
if: inputs.release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.tar.gz
|
||||
asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
if: inputs.release
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: wamr-compiler/build/wamrc-${{ inputs.ver_num }}-${{ inputs.runner }}.zip
|
||||
asset_name: wamrc-${{ inputs.ver_num }}-${{ inputs.arch }}-${{ inputs.runner }}.zip
|
||||
asset_content_type: application/zip
|
29
.github/workflows/check_version_h.yml
vendored
29
.github/workflows/check_version_h.yml
vendored
|
@ -1,29 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: confirm version.h stay in sync
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
confirm_version:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: cmake execute to generate version.h
|
||||
run: cmake -B build_version -S .
|
||||
|
||||
- name: confirm version.h
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain | grep version.h)" ]; then
|
||||
echo "version.h is in sync"
|
||||
else
|
||||
echo "version.h is not in sync"
|
||||
exit 1
|
||||
fi
|
121
.github/workflows/codeql.yml
vendored
121
.github/workflows/codeql.yml
vendored
|
@ -1,121 +0,0 @@
|
|||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
#pull_request:
|
||||
# types:
|
||||
# - opened
|
||||
# branches: '*'
|
||||
#push:
|
||||
# branches: [ "main" ]
|
||||
# midnight UTC
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
if: github.repository == 'bytecodealliance/wasm-micro-runtime'
|
||||
name: Analyze
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners
|
||||
# Consider using larger runners for possible analysis time improvements.
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-13') || 'ubuntu-22.04' }}
|
||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
security-events: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3.29.0
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
queries: security-and-quality
|
||||
|
||||
# Command-line programs to run using the OS shell.
|
||||
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
- run: |
|
||||
./.github/scripts/codeql_buildscript.sh
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3.29.0
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
upload: false
|
||||
id: step1
|
||||
|
||||
# Filter out rules with low severity or high false positve rate
|
||||
# Also filter out warnings in third-party code
|
||||
- name: Filter out unwanted errors and warnings
|
||||
uses: advanced-security/filter-sarif@v1
|
||||
with:
|
||||
patterns: |
|
||||
-**:cpp/path-injection
|
||||
-**:cpp/world-writable-file-creation
|
||||
-**:cpp/poorly-documented-function
|
||||
-**:cpp/potentially-dangerous-function
|
||||
-**:cpp/use-of-goto
|
||||
-**:cpp/integer-multiplication-cast-to-long
|
||||
-**:cpp/comparison-with-wider-type
|
||||
-**:cpp/leap-year/*
|
||||
-**:cpp/ambiguously-signed-bit-field
|
||||
-**:cpp/suspicious-pointer-scaling
|
||||
-**:cpp/suspicious-pointer-scaling-void
|
||||
-**:cpp/unsigned-comparison-zero
|
||||
-**/cmake*/Modules/**
|
||||
input: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
||||
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
||||
|
||||
- name: Upload CodeQL results to code scanning
|
||||
uses: github/codeql-action/upload-sarif@v3.29.0
|
||||
with:
|
||||
sarif_file: ${{ steps.step1.outputs.sarif-output }}
|
||||
category: "/language:${{matrix.language}}"
|
||||
|
||||
- name: Upload CodeQL results as an artifact
|
||||
if: success() || failure()
|
||||
uses: actions/upload-artifact@v4.6.2
|
||||
with:
|
||||
name: codeql-results
|
||||
path: ${{ steps.step1.outputs.sarif-output }}
|
||||
retention-days: 10
|
||||
|
||||
- name: Fail if an error is found
|
||||
run: |
|
||||
./.github/scripts/codeql_fail_on_error.py \
|
||||
${{ steps.step1.outputs.sarif-output }}/cpp.sarif
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
31
.github/workflows/coding_guidelines.yml
vendored
31
.github/workflows/coding_guidelines.yml
vendored
|
@ -1,31 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: Coding Guidelines
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
compliance_job:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# github.event.pull_request.base.label = ${{github.repository}}/${{github.base_ref}}
|
||||
- name: Run Coding Guidelines Checks
|
||||
run: /usr/bin/env python3 ./ci/coding_guidelines_check.py --commits ${{ github.event.pull_request.base.sha }}..HEAD
|
723
.github/workflows/compilation_on_android_ubuntu.yml
vendored
723
.github/workflows/compilation_on_android_ubuntu.yml
vendored
|
@ -1,723 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: compilation on android, ubuntu-22.04
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/build_llvm_libraries.yml"
|
||||
- ".github/workflows/compilation_on_android_ubuntu.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "tests/unit/**"
|
||||
- "wamr-compiler/**"
|
||||
- "test-tools/wamr-ide/**"
|
||||
# will be triggered on push events
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "dev/**"
|
||||
paths:
|
||||
- ".github/workflows/build_llvm_libraries.yml"
|
||||
- ".github/workflows/compilation_on_android_ubuntu.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "tests/unit/**"
|
||||
- "wamr-compiler/**"
|
||||
- "test-tools/wamr-ide/**"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# For BUILD
|
||||
AOT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_INTERP_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
LLVM_LAZY_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
MULTI_TIER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
# For Spec Test
|
||||
DEFAULT_TEST_OPTIONS: "-s spec -b -P"
|
||||
MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M -P"
|
||||
SIMD_TEST_OPTIONS: "-s spec -b -S -P"
|
||||
THREADS_TEST_OPTIONS: "-s spec -b -p -P"
|
||||
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
|
||||
WASI_TEST_OPTIONS: "-s wasi_certification -w"
|
||||
WAMR_COMPILER_TEST_OPTIONS: "-s wamr_compiler -S -b -P"
|
||||
GC_TEST_OPTIONS: "-s spec -G -b -P"
|
||||
MEMORY64_TEST_OPTIONS: "-s spec -W -b -P"
|
||||
MULTI_MEMORY_TEST_OPTIONS: "-s spec -E -b -P"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check_version_h:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/check_version_h.yml
|
||||
|
||||
build_llvm_libraries_on_ubuntu_2204:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "ubuntu-22.04"
|
||||
arch: "X86"
|
||||
|
||||
build_wamrc:
|
||||
needs:
|
||||
[build_llvm_libraries_on_ubuntu_2204]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# since jobs.id can't contain the dot character
|
||||
# it is hard to use `format` to assemble the cache key
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
build_iwasm:
|
||||
needs:
|
||||
[build_llvm_libraries_on_ubuntu_2204]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
make_options_run_mode: [
|
||||
# Running mode
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
$MULTI_TIER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
make_options_feature: [
|
||||
# Features
|
||||
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
|
||||
"-DWAMR_BUILD_DEBUG_AOT=1",
|
||||
"-DWAMR_BUILD_DEBUG_INTERP=1",
|
||||
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
|
||||
"-DWAMR_BUILD_LIB_PTHREAD=1",
|
||||
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
|
||||
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
|
||||
"-DWAMR_BUILD_MINI_LOADER=1",
|
||||
"-DWAMR_BUILD_MEMORY_PROFILING=1",
|
||||
"-DWAMR_BUILD_MULTI_MODULE=1",
|
||||
"-DWAMR_BUILD_PERF_PROFILING=1",
|
||||
"-DWAMR_BUILD_REF_TYPES=1",
|
||||
"-DWAMR_BUILD_SIMD=1",
|
||||
"-DWAMR_BUILD_LIB_SIMDE=1",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
"-DWAMR_BUILD_MEMORY64=1",
|
||||
"-DWAMR_BUILD_MULTI_MEMORY=1",
|
||||
"-DWAMR_BUILD_SHARED=1",
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
platform: [android, linux]
|
||||
exclude:
|
||||
# incompatible feature and platform
|
||||
# incompatible mode and feature
|
||||
# MULTI_MODULE only on INTERP mode and AOT mode
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
# SIMD only on JIT/AOT/fast interpreter mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
# DEBUG_INTERP only on CLASSIC INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
# DEBUG_AOT only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# TODO: DEBUG_AOT on JIT
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# MINI_LOADER only on INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
# Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
|
||||
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
platform: android
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
# Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
|
||||
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
platform: android
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
# Fast-JIT and Multi-Tier-JIT mode don't support android
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
# LLVM JIT pre-built binary wasn't compiled by Android NDK
|
||||
# and isn't available for android
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
# android does not support WAMR_BUILD_SHARED in its CMakeLists.txt.
|
||||
- make_options_feature: "-DWAMR_BUILD_SHARED=1"
|
||||
platform: android
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# only download llvm cache when needed
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build iwasm for linux
|
||||
if: matrix.platform == 'linux'
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
- name: Build iwasm for android
|
||||
if: matrix.platform == 'android'
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
|
||||
-DWAMR_BUILD_TARGET=X86_64
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
build_unit_tests:
|
||||
needs:
|
||||
[
|
||||
build_llvm_libraries_on_ubuntu_2204,
|
||||
build_wamrc
|
||||
]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
build_target: [
|
||||
"X86_64",
|
||||
"X86_32",
|
||||
]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Install dependencies for X86_32
|
||||
if: matrix.build_target == 'X86_32'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y g++-multilib
|
||||
|
||||
- name: Build and run unit tests
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. -DWAMR_BUILD_TARGET=${{ matrix.build_target }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
ctest
|
||||
working-directory: tests/unit
|
||||
|
||||
build_samples_wasm_c_api:
|
||||
needs:
|
||||
[
|
||||
build_iwasm,
|
||||
build_llvm_libraries_on_ubuntu_2204,
|
||||
build_wamrc,
|
||||
]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
make_options: [
|
||||
# Running mode
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
$MULTI_TIER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build wamrc
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Build Sample [wasm-c-api]
|
||||
run: |
|
||||
VERBOSE=1
|
||||
cmake -S . -B build ${{ matrix.make_options }}
|
||||
cmake --build build --config Debug --parallel 4
|
||||
ctest --test-dir build --output-on-failure
|
||||
working-directory: samples/wasm-c-api
|
||||
|
||||
- name: Build Sample [printversion]
|
||||
run: |
|
||||
./test.sh
|
||||
working-directory: samples/printversion
|
||||
|
||||
build_samples_others:
|
||||
needs:
|
||||
[
|
||||
build_iwasm,
|
||||
build_llvm_libraries_on_ubuntu_2204,
|
||||
build_wamrc,
|
||||
]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Build Sample [basic]
|
||||
run: |
|
||||
cd samples/basic
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [file]
|
||||
run: |
|
||||
cd samples/file
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./src/iwasm -f wasm-app/file.wasm -d .
|
||||
|
||||
- name: Build Sample [multi-thread]
|
||||
run: |
|
||||
cd samples/multi-thread
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./iwasm wasm-apps/test.wasm
|
||||
|
||||
- name: Build Sample [multi-module]
|
||||
run: |
|
||||
cd samples/multi-module
|
||||
mkdir build && cd build
|
||||
cmake .. -DWAMR_BUILD_AOT=1
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./multi_module mC.wasm
|
||||
./multi_module mC.aot
|
||||
|
||||
- name: Build Sample [spawn-thread]
|
||||
run: |
|
||||
cd samples/spawn-thread
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./spawn_thread
|
||||
|
||||
- name: Build Sample [ref-types]
|
||||
run: |
|
||||
cd samples/ref-types
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./hello
|
||||
|
||||
- name: Build Sample [wasi-threads]
|
||||
run: |
|
||||
cd samples/wasi-threads
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./iwasm wasm-apps/no_pthread.wasm
|
||||
|
||||
- name: Build Sample [shared-module]
|
||||
run: |
|
||||
cd samples/shared-module
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [terminate]
|
||||
run: |
|
||||
cd samples/terminate
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [debug-tools]
|
||||
run: |
|
||||
cd samples/debug-tools
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./iwasm wasm-apps/trap.wasm | grep "#" > call_stack.txt
|
||||
./iwasm wasm-apps/trap.aot | grep "#" > call_stack_aot.txt
|
||||
bash -x ../symbolicate.sh
|
||||
|
||||
- name: Build Sample [native-stack-overflow]
|
||||
run: |
|
||||
cd samples/native-stack-overflow
|
||||
./build.sh
|
||||
./run.sh test1
|
||||
./run.sh test2
|
||||
|
||||
- name: Build Sample [shared-heap]
|
||||
run: |
|
||||
cd samples/shared-heap
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./shared_heap_test
|
||||
./shared_heap_test --aot
|
||||
|
||||
test:
|
||||
needs:
|
||||
[
|
||||
build_iwasm,
|
||||
build_llvm_libraries_on_ubuntu_2204,
|
||||
build_wamrc,
|
||||
]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
running_mode:
|
||||
[
|
||||
"classic-interp",
|
||||
"fast-interp",
|
||||
"jit",
|
||||
"aot",
|
||||
"fast-jit",
|
||||
"multi-tier-jit",
|
||||
]
|
||||
test_option:
|
||||
[
|
||||
$DEFAULT_TEST_OPTIONS,
|
||||
$MULTI_MODULES_TEST_OPTIONS,
|
||||
$SIMD_TEST_OPTIONS,
|
||||
$THREADS_TEST_OPTIONS,
|
||||
$WASI_TEST_OPTIONS,
|
||||
$GC_TEST_OPTIONS,
|
||||
$MEMORY64_TEST_OPTIONS,
|
||||
$MULTI_MEMORY_TEST_OPTIONS,
|
||||
]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
ubuntu_version: "22.04"
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
running_mode: aot
|
||||
test_option: $WAMR_COMPILER_TEST_OPTIONS
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set-up OCaml
|
||||
uses: ocaml/setup-ocaml@v3
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
with:
|
||||
ocaml-compiler: 4.13
|
||||
|
||||
- name: Set-up Ocamlbuild
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: opam install ocamlbuild dune menhir
|
||||
|
||||
- name: download and install wasi-sdk
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: set env variable(if llvm are used)
|
||||
if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
|
||||
run: echo "USE_LLVM=true" >> $GITHUB_ENV
|
||||
|
||||
- name: set env variable(if x86_32 test needed)
|
||||
if: >
|
||||
((matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
|
||||
|| matrix.test_option == '$WASI_TEST_OPTIONS' || matrix.test_option == '$GC_TEST_OPTIONS')
|
||||
&& matrix.test_option != '$MEMORY64_TEST_OPTIONS'
|
||||
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit')
|
||||
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
|
||||
|
||||
#only download llvm libraries in jit and aot mode
|
||||
- name: Get LLVM libraries
|
||||
if: env.USE_LLVM == 'true'
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install jq JSON processor
|
||||
if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: sudo apt-get update && sudo apt install -y jq
|
||||
|
||||
- name: Build WASI thread tests
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: bash build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
|
||||
|
||||
- name: build socket api tests
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: bash build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-socket/test/
|
||||
|
||||
- name: run tests
|
||||
timeout-minutes: 30
|
||||
if: matrix.test_option != '$GC_TEST_OPTIONS'
|
||||
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
- name: run gc tests
|
||||
timeout-minutes: 20
|
||||
if: matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: |
|
||||
eval $(opam env)
|
||||
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
#only install x32 support libraries when to run x86_32 cases
|
||||
- name: install x32 support libraries
|
||||
if: env.TEST_ON_X86_32 == 'true'
|
||||
run:
|
||||
# Add another apt repository as some packages cannot
|
||||
# be downloaded with the github default repository
|
||||
sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
|
||||
sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
|
||||
sudo apt-get update &&
|
||||
sudo apt install -y g++-multilib lib32gcc-9-dev
|
||||
|
||||
- name: run tests x86_32
|
||||
timeout-minutes: 30
|
||||
if: env.TEST_ON_X86_32 == 'true' && matrix.test_option != '$GC_TEST_OPTIONS'
|
||||
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
- name: run gc tests x86_32
|
||||
timeout-minutes: 20
|
||||
if: env.TEST_ON_X86_32 == 'true' && matrix.test_option == '$GC_TEST_OPTIONS'
|
||||
run: |
|
||||
eval $(opam env)
|
||||
./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
423
.github/workflows/compilation_on_macos.yml
vendored
423
.github/workflows/compilation_on_macos.yml
vendored
|
@ -1,423 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: compilation on macos
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/build_llvm_libraries.yml"
|
||||
- ".github/workflows/compilation_on_macos.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# will be triggered on push events
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "dev/**"
|
||||
paths:
|
||||
- ".github/workflows/build_llvm_libraries.yml"
|
||||
- ".github/workflows/compilation_on_macos.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# For BUILD
|
||||
AOT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_INTERP_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
LLVM_LAZY_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
MULTI_TIER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries_on_intel_macos:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "macos-13"
|
||||
arch: "X86"
|
||||
build_llvm_libraries_on_arm_macos:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "macos-14"
|
||||
arch: "AArch64 ARM"
|
||||
|
||||
build_wamrc:
|
||||
needs: [build_llvm_libraries_on_intel_macos]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: macos-13
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
build_iwasm:
|
||||
needs: [build_llvm_libraries_on_intel_macos]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
make_options_run_mode: [
|
||||
# Running mode
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
make_options_feature: [
|
||||
# Features
|
||||
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
|
||||
# doesn't support
|
||||
#"-DWAMR_BUILD_DEBUG_AOT=1",
|
||||
"-DWAMR_BUILD_DEBUG_INTERP=1",
|
||||
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
|
||||
"-DWAMR_BUILD_LIB_PTHREAD=1",
|
||||
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
|
||||
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
|
||||
"-DWAMR_BUILD_MINI_LOADER=1",
|
||||
"-DWAMR_BUILD_MEMORY_PROFILING=1",
|
||||
"-DWAMR_BUILD_MULTI_MODULE=1",
|
||||
"-DWAMR_BUILD_PERF_PROFILING=1",
|
||||
"-DWAMR_BUILD_REF_TYPES=1",
|
||||
"-DWAMR_BUILD_SIMD=1",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
]
|
||||
os: [macos-13]
|
||||
platform: [darwin]
|
||||
exclude:
|
||||
# incompatible feature and platform
|
||||
# incompatible mode and feature
|
||||
# MULTI_MODULE only on INTERP mode and AOT mode
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
# SIMD only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
# DEBUG_INTERP only on CLASSIC INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
# DEBUG_AOT only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# TODO: DEBUG_AOT on JIT
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# MINI_LOADER only on INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
include:
|
||||
- os: macos-13
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# only download llvm cache when needed
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build iwasm
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
build_samples_wasm_c_api:
|
||||
needs:
|
||||
[
|
||||
build_iwasm,
|
||||
build_llvm_libraries_on_intel_macos,
|
||||
build_wamrc,
|
||||
]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
make_options: [
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
$MULTI_TIER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
os: [macos-13]
|
||||
include:
|
||||
- os: macos-13
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build wamrc
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Build Sample [wasm-c-api]
|
||||
run: |
|
||||
VERBOSE=1
|
||||
cmake -S . -B build ${{ matrix.make_options }}
|
||||
cmake --build build --config Debug --parallel 4
|
||||
ctest --test-dir build --output-on-failure
|
||||
working-directory: samples/wasm-c-api
|
||||
|
||||
- name: Build Sample [printversion]
|
||||
run: |
|
||||
./test.sh
|
||||
working-directory: samples/printversion
|
||||
|
||||
build_samples_others:
|
||||
needs: [build_iwasm, build_wamrc, build_llvm_libraries_on_intel_macos, build_llvm_libraries_on_arm_macos]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [macos-13, macos-14]
|
||||
include:
|
||||
- os: macos-13
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_intel_macos.outputs.cache_key }}
|
||||
- os: macos-14
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_arm_macos.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build Sample [basic]
|
||||
run: |
|
||||
cd samples/basic
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [file]
|
||||
run: |
|
||||
cd samples/file
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./src/iwasm -f wasm-app/file.wasm -d .
|
||||
|
||||
- name: Build Sample [multi-thread]
|
||||
run: |
|
||||
cd samples/multi-thread
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./iwasm wasm-apps/test.wasm
|
||||
|
||||
- name: Build Sample [multi-module]
|
||||
run: |
|
||||
cd samples/multi-module
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./multi_module mC.wasm
|
||||
|
||||
- name: Build Sample [spawn-thread]
|
||||
run: |
|
||||
cd samples/spawn-thread
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./spawn_thread
|
||||
|
||||
- name: Build Sample [ref-types]
|
||||
run: |
|
||||
cd samples/ref-types
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./hello
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
# cmake --build . --config Debug --parallel 4
|
||||
- name: Build Sample [wasi-threads]
|
||||
run: |
|
||||
cd samples/wasi-threads
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --verbose
|
||||
./iwasm wasm-apps/no_pthread.wasm
|
||||
|
||||
../../../wamr-compiler/build/wamrc --size-level=0 --enable-multi-thread -o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
|
||||
./iwasm wasm-apps/no_pthread.aot
|
||||
|
||||
- name: Build Sample [shared-module]
|
||||
run: |
|
||||
cd samples/shared-module
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [terminate]
|
||||
run: |
|
||||
cd samples/terminate
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [debug-tools]
|
||||
run: |
|
||||
cd samples/debug-tools
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./iwasm wasm-apps/trap.wasm | grep "#" > call_stack.txt
|
||||
./iwasm wasm-apps/trap.aot | grep "#" > call_stack_aot.txt
|
||||
bash -x ../symbolicate.sh
|
||||
|
||||
- name: Build Sample [native-stack-overflow]
|
||||
run: |
|
||||
cd samples/native-stack-overflow
|
||||
./build.sh
|
||||
./run.sh test1
|
||||
./run.sh test2
|
||||
|
||||
- name: Build Sample [shared-heap]
|
||||
run: |
|
||||
cd samples/shared-heap
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./shared_heap_test
|
||||
./shared_heap_test --aot
|
146
.github/workflows/compilation_on_nuttx.yml
vendored
146
.github/workflows/compilation_on_nuttx.yml
vendored
|
@ -1,146 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: compilation on nuttx
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/compilation_on_nuttx.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# will be triggered on push events
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "dev/**"
|
||||
paths:
|
||||
- ".github/workflows/compilation_on_nuttx.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
WASI_SDK_PATH: "/opt/wasi-sdk"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_iwasm_on_nuttx:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux@sha256:d9261eacf6c6ebe656c571757751c803e8f04c3ae9b820320a5ea5dd57b7205a
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
nuttx_board_config: [
|
||||
# x64
|
||||
"boards/sim/sim/sim/configs/nsh",
|
||||
# cortex-m0
|
||||
"boards/arm/rp2040/raspberrypi-pico/configs/nsh",
|
||||
# cortex-m7
|
||||
"boards/arm/stm32h7/nucleo-h743zi/configs/nsh",
|
||||
# riscv32gc
|
||||
"boards/risc-v/qemu-rv/rv-virt/configs/nsh",
|
||||
# riscv64gc
|
||||
"boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
|
||||
# arm64
|
||||
"boards/arm64/qemu/qemu-armv8a/configs/nsh",
|
||||
]
|
||||
|
||||
wamr_config_option:
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT"
|
||||
- "CONFIG_INTERPRETERS_WAMR_FAST"
|
||||
- "CONFIG_INTERPRETERS_WAMR_CLASSIC"
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST"
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_FAST CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN"
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC"
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
|
||||
- "CONFIG_INTERPRETERS_WAMR_AOT CONFIG_INTERPRETERS_WAMR_CLASSIC CONFIG_INTERPRETERS_WAMR_LIBC_WASI"
|
||||
|
||||
steps:
|
||||
- name: Checkout NuttX
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: apache/nuttx
|
||||
ref: releases/12.9
|
||||
path: nuttx
|
||||
|
||||
- name: Checkout NuttX Apps
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: apache/nuttx-apps
|
||||
ref: releases/12.9
|
||||
path: apps
|
||||
|
||||
- name: Checkout WAMR
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
path: apps/interpreters/wamr/wamr
|
||||
|
||||
- name: Configure WAMR
|
||||
working-directory: nuttx
|
||||
run: |
|
||||
tools/configure.sh ${{ matrix.nuttx_board_config }}
|
||||
kconfig-tweak --enable CONFIG_PSEUDOFS_SOFTLINKS
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_IWASM_TASK
|
||||
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_PRIORITY 100
|
||||
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 8192
|
||||
for x in ${{ matrix.wamr_config_option }}; do
|
||||
kconfig-tweak --enable $x
|
||||
done
|
||||
|
||||
- name: Build
|
||||
working-directory: nuttx
|
||||
run: make -j$(nproc) EXTRAFLAGS=-Werror
|
||||
|
||||
- name: Checkout Bloaty
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: google/bloaty
|
||||
submodules: recursive
|
||||
path: bloaty
|
||||
ref: 34f4a66559ad4938c1e629e9b5f54630b2b4d7b0
|
||||
|
||||
- name: Build Bloaty
|
||||
run: |
|
||||
cmake -Bbuild -GNinja bloaty
|
||||
cmake --build build
|
||||
|
||||
- name: Size Report
|
||||
run: |
|
||||
echo "Build target: ${{ matrix.nuttx_board_config }}"
|
||||
echo "WAMR build config: ${{ matrix.wamr_config_option }}"
|
||||
echo "WAMR size:"
|
||||
build/bloaty -d compileunits --source-filter wamr nuttx/nuttx
|
||||
echo "libc-builtin size (if enabled):"
|
||||
build/bloaty -d compileunits --source-filter libc-builtin nuttx/nuttx
|
||||
echo "libc-wasi size (if enabled):"
|
||||
build/bloaty -d compileunits --source-filter libc-wasi nuttx/nuttx
|
317
.github/workflows/compilation_on_sgx.yml
vendored
317
.github/workflows/compilation_on_sgx.yml
vendored
|
@ -1,317 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: compilation on SGX
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/build_llvm_libraries.yml"
|
||||
- ".github/workflows/compilation_on_sgx.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# will be triggered on push events
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "dev/**"
|
||||
paths:
|
||||
- ".github/workflows/build_llvm_libraries.yml"
|
||||
- ".github/workflows/compilation_on_sgx.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# ref types enabled in wamrc by default, so we need to enable it for iwasm in AOT mode
|
||||
AOT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0 -DWAMR_BUILD_REF_TYPES=1"
|
||||
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0 -DWAMR_BUILD_SIMD=0"
|
||||
FAST_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
LLVM_LAZY_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
# For Spec Test
|
||||
DEFAULT_TEST_OPTIONS: "-s spec -x -p -b"
|
||||
SIMD_TEST_OPTIONS: "-s spec -x -p -b -S"
|
||||
XIP_TEST_OPTIONS: "-s spec -x -p -b -X"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: ubuntu-22.04
|
||||
arch: "X86"
|
||||
|
||||
build_iwasm:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
make_options_run_mode: [
|
||||
# Running modes supported
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
# Running modes unsupported
|
||||
#$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
make_options_feature: [
|
||||
# Features
|
||||
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
|
||||
# doesn't support
|
||||
# "-DWAMR_BUILD_DEBUG_AOT=1",
|
||||
# "-DWAMR_BUILD_DEBUG_INTERP=1",
|
||||
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
|
||||
"-DWAMR_BUILD_LIB_PTHREAD=1",
|
||||
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
|
||||
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
|
||||
"-DWAMR_BUILD_MINI_LOADER=1",
|
||||
"-DWAMR_BUILD_MEMORY_PROFILING=1",
|
||||
"-DWAMR_BUILD_MULTI_MODULE=1",
|
||||
"-DWAMR_BUILD_PERF_PROFILING=1",
|
||||
"-DWAMR_BUILD_REF_TYPES=1",
|
||||
# doesn't support
|
||||
"-DWAMR_BUILD_SIMD=0",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
"-DWAMR_BUILD_SGX_IPFS=1",
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
platform: [linux-sgx]
|
||||
exclude:
|
||||
# incompatible mode and feature
|
||||
# MINI_LOADER only on INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install SGX SDK and necessary libraries
|
||||
uses: ./.github/actions/install-linux-sgx
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build iwasm
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
cd ../enclave-sample
|
||||
make
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
run_samples_file:
|
||||
needs: [build_iwasm, build_llvm_libraries]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
iwasm_make_options_run_mode: [
|
||||
# Running modes supported
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
# Running modes unsupported
|
||||
#$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
#$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
iwasm_make_options_feature: [
|
||||
# Features to be tested: IPFS
|
||||
"-DWAMR_BUILD_SGX_IPFS=1",
|
||||
]
|
||||
platform: [linux-sgx]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: install SGX SDK and necessary libraries
|
||||
uses: ./.github/actions/install-linux-sgx
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build iwasm for testing samples
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.iwasm_make_options_run_mode }} ${{ matrix.iwasm_make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
cd ../enclave-sample
|
||||
make
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
- name: Get LLVM libraries
|
||||
if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Build wamrc only for testing samples in aot mode
|
||||
if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
|
||||
run: |
|
||||
cmake -S . -B build
|
||||
cmake --build build --config Release --parallel 4
|
||||
cp build/wamrc ../product-mini/platforms/${{ matrix.platform }}/enclave-sample
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Build Sample [file]
|
||||
run: |
|
||||
cmake -S . -B build
|
||||
cmake --build build --config Debug --parallel 4
|
||||
cp build/wasm-app/file.wasm ../../product-mini/platforms/${{ matrix.platform }}/enclave-sample
|
||||
working-directory: samples/file
|
||||
|
||||
- name: Test Sample [file] in non-aot mode
|
||||
if: matrix.iwasm_make_options_run_mode != '$AOT_BUILD_OPTIONS'
|
||||
run: |
|
||||
source /opt/intel/sgxsdk/environment
|
||||
./iwasm --dir=. ./file.wasm
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample
|
||||
|
||||
- name: Test Sample [file] in aot mode
|
||||
if: matrix.iwasm_make_options_run_mode == '$AOT_BUILD_OPTIONS'
|
||||
run: |
|
||||
source /opt/intel/sgxsdk/environment
|
||||
./wamrc -sgx -o ./file.aot ./file.wasm
|
||||
./iwasm --dir=. ./file.aot
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}/enclave-sample
|
||||
|
||||
spec_test_default:
|
||||
needs: [build_iwasm, build_llvm_libraries]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
#(workaround) disable "fast-interp" because of SIMDE
|
||||
running_mode: ["classic-interp", "aot", "fast-jit"]
|
||||
test_option:
|
||||
[$DEFAULT_TEST_OPTIONS, $SIMD_TEST_OPTIONS, $XIP_TEST_OPTIONS]
|
||||
os: [ubuntu-22.04]
|
||||
exclude:
|
||||
# classic-interp, fast-interp and fast-jit don't support simd
|
||||
- running_mode: "classic-interp"
|
||||
test_option: $SIMD_TEST_OPTIONS
|
||||
- running_mode: "fast-interp"
|
||||
test_option: $SIMD_TEST_OPTIONS
|
||||
- running_mode: "fast-jit"
|
||||
test_option: $SIMD_TEST_OPTIONS
|
||||
# classic-interp, fast-interp and fast jit don't support XIP
|
||||
- running_mode: "classic-interp"
|
||||
test_option: $XIP_TEST_OPTIONS
|
||||
- running_mode: "fast-interp"
|
||||
test_option: $XIP_TEST_OPTIONS
|
||||
- running_mode: "fast-jit"
|
||||
test_option: $XIP_TEST_OPTIONS
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
if: matrix.running_mode == 'aot'
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: matrix.running_mode == 'aot' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install SGX SDK and necessary libraries
|
||||
uses: ./.github/actions/install-linux-sgx
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
#workaround about a https://github.com/actions/runner-images/issues/6680#issuecomment-2640923706
|
||||
- name: Increase swapfile
|
||||
run: |
|
||||
sudo swapoff -a
|
||||
sudo fallocate -l 15G /swapfile
|
||||
sudo chmod 600 /swapfile
|
||||
sudo mkswap /swapfile
|
||||
sudo swapon /swapfile
|
||||
sudo swapon --show
|
||||
|
||||
- name: run spec tests
|
||||
run: |
|
||||
set +e
|
||||
source /opt/intel/sgxsdk/environment
|
||||
attempts=0
|
||||
max_attempts=3
|
||||
|
||||
while [ $attempts -lt $max_attempts ]; do
|
||||
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
exitcode="$?"
|
||||
|
||||
if [ $exitcode -eq 0 ]; then
|
||||
echo "Spec test passed"
|
||||
exit 0
|
||||
elif [ $exitcode -ne 143 ]; then
|
||||
echo "Spec test failed with error code $exitcode"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$exitcode is a known GitHub-hosted runner issue"
|
||||
echo "::notice::Re-running the spec test due to error code 143"
|
||||
attempts=$((attempts + 1))
|
||||
done
|
||||
|
||||
echo "::notice::Report an error with code 143 in SGX CI after $max_attempts attempts"
|
||||
exit 143
|
||||
working-directory: ./tests/wamr-test-suites
|
183
.github/workflows/compilation_on_windows.yml
vendored
183
.github/workflows/compilation_on_windows.yml
vendored
|
@ -1,183 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: compilation on windows-latest
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/compilation_on_windows.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# will be triggered on push events
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "dev/**"
|
||||
paths:
|
||||
- ".github/workflows/compilation_on_windows.yml"
|
||||
- "build-scripts/**"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "samples/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# For Spec Test
|
||||
DEFAULT_TEST_OPTIONS: "-s spec -b"
|
||||
MULTI_MODULES_TEST_OPTIONS: "-s spec -b -M"
|
||||
THREADS_TEST_OPTIONS: "-s spec -b -p"
|
||||
WASI_TEST_OPTIONS: "-s wasi_certification -w"
|
||||
WASI_TEST_FILTER: ${{ github.workspace }}/product-mini/platforms/windows/wasi_filtered_tests.json
|
||||
# Used when building the WASI socket and thread tests
|
||||
CC: ${{ github.workspace }}/wasi-sdk/bin/clang
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries_on_windows:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "windows-latest"
|
||||
arch: "AArch64 ARM Mips RISCV X86"
|
||||
|
||||
build_iwasm:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
build_options:
|
||||
[
|
||||
"-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_INTERP=0",
|
||||
"-DWAMR_BUILD_AOT=0",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
"-DWAMR_BUILD_REF_TYPES=1",
|
||||
"-DWAMR_BUILD_SIMD=1",
|
||||
"-DWAMR_BUILD_DEBUG_INTERP=1",
|
||||
"-DWAMR_BUILD_LIB_PTHREAD=1",
|
||||
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
|
||||
"-DWAMR_BUILD_LIBC_UVWASI=0 -DWAMR_BUILD_LIBC_WASI=1",
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: clone uvwasi library
|
||||
if: ${{ !contains(matrix.build_options, '-DWAMR_BUILD_LIBC_UVWASI=0') }}
|
||||
run: |
|
||||
cd core/deps
|
||||
git clone https://github.com/nodejs/uvwasi.git
|
||||
- name: Build iwasm
|
||||
run: |
|
||||
cd product-mini/platforms/windows
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.build_options }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
|
||||
build_wamrc:
|
||||
needs: [build_llvm_libraries_on_windows]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# since jobs.id can't contain the dot character
|
||||
# it is hard to use `format` to assemble the cache key
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
cmake -S . -B build
|
||||
cmake --build build --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
test:
|
||||
runs-on: windows-latest
|
||||
needs: [build_iwasm, build_wamrc]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
running_mode: ["classic-interp", "fast-interp"]
|
||||
test_option:
|
||||
[
|
||||
$DEFAULT_TEST_OPTIONS,
|
||||
$MULTI_MODULES_TEST_OPTIONS,
|
||||
$THREADS_TEST_OPTIONS,
|
||||
$WASI_TEST_OPTIONS,
|
||||
]
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: download and install wasi-sdk
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: |
|
||||
curl "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0.m-mingw.tar.gz" -o wasi-sdk.tar.gz -L
|
||||
mkdir wasi-sdk
|
||||
tar -xzf wasi-sdk.tar.gz -C wasi-sdk --strip-components 1
|
||||
|
||||
- name: build socket api tests
|
||||
shell: bash
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: ./build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-socket/test/
|
||||
|
||||
- name: Build WASI thread tests
|
||||
shell: bash
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: ./build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
|
||||
|
||||
- name: install wget
|
||||
shell: bash
|
||||
run: choco install wget
|
||||
|
||||
- name: run tests
|
||||
shell: bash
|
||||
timeout-minutes: 20
|
||||
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
87
.github/workflows/create_tag.yml
vendored
87
.github/workflows/create_tag.yml
vendored
|
@ -1,87 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: create a tag
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
minor_version:
|
||||
description: "the new version is a minor version or a major version"
|
||||
value: ${{ jobs.create_tag.outputs.minor_version}}
|
||||
new_ver:
|
||||
description: "the new version"
|
||||
value: ${{ jobs.create_tag.outputs.new_ver}}
|
||||
new_tag:
|
||||
description: "the new tag just created"
|
||||
value: ${{ jobs.create_tag.outputs.new_tag}}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
create_tag:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
minor_version: ${{ steps.preparation.outputs.minor_version }}
|
||||
new_ver: ${{ steps.preparation.outputs.new_ver }}
|
||||
new_tag: ${{ steps.preparation.outputs.new_tag }}
|
||||
permissions:
|
||||
contents: write # create and push tags
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# Full git history is needed to get a proper list of commits and tags
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: prepare
|
||||
id: preparation
|
||||
run: |
|
||||
# show latest 3 versions on the branch that create release
|
||||
# Set the initial commit to the head of the branch
|
||||
commit="HEAD"
|
||||
#
|
||||
# Loop to get the three most recent tags
|
||||
for i in {1..3}
|
||||
do
|
||||
# Get the most recent tag reachable from the current commit
|
||||
tag=$(git describe --tags --abbrev=0 $commit)
|
||||
|
||||
# Print the tag
|
||||
echo "$tag"
|
||||
|
||||
# Move to the commit before the found tag to find the next tag in the next iteration
|
||||
commit=$(git rev-list -n 1 $tag^)
|
||||
done
|
||||
# compare latest git tag and semantic version definition
|
||||
result=$(python3 ./.github/scripts/fetch_and_compare_version.py)
|
||||
echo "script result is ${result}"
|
||||
#
|
||||
# return in a form like "WAMR-X.Y.Z,major_minor_change" or ",patch_change"
|
||||
new_ver=$(echo "${result}" | awk -F',' '{print $1}')
|
||||
diff_versioning=$(echo "${result}" | awk -F',' '{print $2}')
|
||||
echo "next version is ${new_ver}, it ${diff_versioning}"
|
||||
#
|
||||
# set output
|
||||
if [[ ${diff_versioning} == 'major_minor_change' ]];then
|
||||
echo "minor_version=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "minor_version=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
#
|
||||
#
|
||||
if [[ -z ${new_ver} ]]; then
|
||||
echo "::error::please indicate the right semantic version in core/version.h"
|
||||
echo "new_ver=''" >> "$GITHUB_OUTPUT"
|
||||
echo "new_tag=''" >> "$GITHUB_OUTPUT"
|
||||
exit 1
|
||||
else
|
||||
echo "new_ver=${new_ver}" >> "$GITHUB_OUTPUT"
|
||||
echo "new_tag=WAMR-${new_ver}" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: push tag
|
||||
if: steps.preparation.outputs.new_tag != ''
|
||||
run: |
|
||||
git tag ${{ steps.preparation.outputs.new_tag }}
|
||||
git push origin --force --tags
|
50
.github/workflows/hadolint_dockerfiles.yml
vendored
50
.github/workflows/hadolint_dockerfiles.yml
vendored
|
@ -1,50 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: hadolint dockerfiles
|
||||
|
||||
on:
|
||||
# will be triggered on PR events
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- "**/Dockerfile*"
|
||||
- ".github/workflows/hadolint_dockerfiles.yml"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- "dev/**"
|
||||
paths:
|
||||
- "**/Dockerfile*"
|
||||
- ".github/workflows/hadolint_dockerfiles.yml"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
run-hadolint-on-dockerfiles:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# on default, hadolint will fail on warnings and errors
|
||||
- name: Run hadolint on dockerfiles
|
||||
run: |
|
||||
docker pull hadolint/hadolint:latest-debian
|
||||
find . -name "*Dockerfile*" | while read dockerfile; do
|
||||
echo "run hadolint on $dockerfile:"
|
||||
docker run --rm -i hadolint/hadolint:latest-debian hadolint - <"$dockerfile"
|
||||
echo "successful"
|
||||
done
|
712
.github/workflows/nightly_run.yml
vendored
712
.github/workflows/nightly_run.yml
vendored
|
@ -1,712 +0,0 @@
|
|||
# Copyright (C) 2023 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: nightly_run
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
# running nightly pipeline if you're changing it
|
||||
# stress tests are run only in nightly at the moment, so running them in they are changed
|
||||
paths:
|
||||
- ".github/workflows/nightly_run.yml"
|
||||
- "core/iwasm/libraries/lib-wasi-threads/stress-test/**"
|
||||
|
||||
# midnight UTC
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# For BUILD
|
||||
AOT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
CLASSIC_INTERP_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_INTERP_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=0 -DWAMR_BUILD_FAST_INTERP=1 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
FAST_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=0 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
LLVM_LAZY_JIT_BUILD_OPTIONS: " -DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
LLVM_EAGER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=0 -DWAMR_BUILD_FAST_JIT=0 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=0"
|
||||
MULTI_TIER_JIT_BUILD_OPTIONS: "-DWAMR_BUILD_AOT=1 -DWAMR_BUILD_FAST_INTERP=0 -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_JIT=1 -DWAMR_BUILD_JIT=1 -DWAMR_BUILD_LAZY_JIT=1"
|
||||
# For Spec Test
|
||||
# FIXME: use binary release(adding -b) instead of building from source after upgrading to 22.04
|
||||
DEFAULT_TEST_OPTIONS: "-s spec -P"
|
||||
MULTI_MODULES_TEST_OPTIONS: "-s spec -M -P"
|
||||
SIMD_TEST_OPTIONS: "-s spec -S -P"
|
||||
THREADS_TEST_OPTIONS: "-s spec -p -P"
|
||||
X86_32_TARGET_TEST_OPTIONS: "-m x86_32 -P"
|
||||
WASI_TEST_OPTIONS: "-s wasi_certification -w"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries_on_ubuntu:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "ubuntu-22.04"
|
||||
arch: "X86"
|
||||
|
||||
build_wamrc:
|
||||
needs: build_llvm_libraries_on_ubuntu
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# since jobs.id can't contain the dot character
|
||||
# it is hard to use `format` to assemble the cache key
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
build_iwasm:
|
||||
needs: build_llvm_libraries_on_ubuntu
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
make_options_run_mode: [
|
||||
# Running mode
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
$MULTI_TIER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
make_options_feature: [
|
||||
# Features
|
||||
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
|
||||
"-DWAMR_BUILD_DEBUG_AOT=1",
|
||||
"-DWAMR_BUILD_DEBUG_INTERP=1",
|
||||
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
|
||||
"-DWAMR_BUILD_LIB_PTHREAD=1",
|
||||
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
|
||||
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
|
||||
"-DWAMR_BUILD_MINI_LOADER=1",
|
||||
"-DWAMR_BUILD_MEMORY_PROFILING=1",
|
||||
"-DWAMR_BUILD_MULTI_MODULE=1",
|
||||
"-DWAMR_BUILD_PERF_PROFILING=1",
|
||||
"-DWAMR_BUILD_REF_TYPES=1",
|
||||
"-DWAMR_BUILD_SIMD=1",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
"-DWAMR_BUILD_MEMORY64=1",
|
||||
"-DWAMR_BUILD_MULTI_MEMORY=1",
|
||||
"-DWAMR_BUILD_SHARED=1",
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
platform: [android, linux]
|
||||
exclude:
|
||||
# incompatible feature and platform
|
||||
# incompatible mode and feature
|
||||
# MULTI_MODULE only on INTERP mode and AOT mode
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
# SIMD only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
# DEBUG_INTERP only on CLASSIC INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
# DEBUG_AOT only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# TODO: DEBUG_AOT on JIT
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# MINI_LOADER only on INTERP mode
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
# Memory64 only on CLASSIC INTERP and AOT mode, and only on 64-bit platform
|
||||
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
platform: android
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
# Multi memory only on CLASSIC INTERP mode, and only on 64-bit platform
|
||||
- make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
platform: android
|
||||
- make_options_run_mode: $AOT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
# Fast-JIT and Multi-Tier-JIT mode don't support android
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
- make_options_run_mode: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
# LLVM JIT pre-built binary wasn't compiled by Android NDK
|
||||
# and isn't available for android
|
||||
- make_options_run_mode: $LLVM_LAZY_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
- make_options_run_mode: $LLVM_EAGER_JIT_BUILD_OPTIONS
|
||||
platform: android
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# only download llvm cache when needed
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS')
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: endsWith(matrix.make_options_run_mode, '_JIT_BUILD_OPTIONS') && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Build iwasm for linux
|
||||
if: matrix.platform == 'linux'
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }}
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
- name: Build iwasm for android
|
||||
if: matrix.platform == 'android'
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} \
|
||||
-DWAMR_BUILD_TARGET=X86_64
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: product-mini/platforms/${{ matrix.platform }}
|
||||
|
||||
build_iwasm_linux_gcc4_8:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:14.04
|
||||
strategy:
|
||||
matrix:
|
||||
make_options_run_mode: [
|
||||
# Running mode
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
make_options_feature: [
|
||||
# Features
|
||||
"-DWAMR_BUILD_CUSTOM_NAME_SECTION=1",
|
||||
"-DWAMR_BUILD_DEBUG_AOT=1",
|
||||
"-DWAMR_BUILD_DEBUG_INTERP=1",
|
||||
"-DWAMR_BUILD_DUMP_CALL_STACK=1",
|
||||
"-DWAMR_BUILD_LIB_PTHREAD=1",
|
||||
"-DWAMR_BUILD_LIB_WASI_THREADS=1",
|
||||
"-DWAMR_BUILD_LOAD_CUSTOM_SECTION=1",
|
||||
"-DWAMR_BUILD_MINI_LOADER=1",
|
||||
"-DWAMR_BUILD_MEMORY_PROFILING=1",
|
||||
"-DWAMR_BUILD_MULTI_MODULE=1",
|
||||
"-DWAMR_BUILD_PERF_PROFILING=1",
|
||||
"-DWAMR_BUILD_REF_TYPES=1",
|
||||
"-DWAMR_BUILD_SIMD=1",
|
||||
"-DWAMR_BUILD_TAIL_CALL=1",
|
||||
"-DWAMR_DISABLE_HW_BOUND_CHECK=1",
|
||||
"-DWAMR_BUILD_MEMORY64=1",
|
||||
"-DWAMR_BUILD_MULTI_MEMORY=1",
|
||||
]
|
||||
exclude:
|
||||
# incompatible feature and platform
|
||||
# incompatible mode and feature
|
||||
# MULTI_MODULE only on INTERP mode and AOT mode
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MODULE=1"
|
||||
# SIMD only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_SIMD=1"
|
||||
# DEBUG_INTERP only on CLASSIC INTERP mode
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_INTERP=1"
|
||||
# DEBUG_AOT only on JIT/AOT mode
|
||||
- make_options_run_mode: $CLASSIC_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# TODO: DEBUG_AOT on JIT
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_DEBUG_AOT=1"
|
||||
# MINI_LOADER only on INTERP mode
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MINI_LOADER=1"
|
||||
# Memory64 only on CLASSIC INTERP mode
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MEMORY64=1"
|
||||
# Memory64 only on CLASSIC INTERP mode
|
||||
- make_options_run_mode: $FAST_INTERP_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
- make_options_run_mode: $FAST_JIT_BUILD_OPTIONS
|
||||
make_options_feature: "-DWAMR_BUILD_MULTI_MEMORY=1"
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt update && apt install -y make g++-4.8 gcc-4.8 wget git
|
||||
|
||||
- name: checkout
|
||||
run: |
|
||||
git clone https://github.com/${{ github.repository }} wamr
|
||||
|
||||
- name: Install cmake
|
||||
run: |
|
||||
wget https://github.com/Kitware/CMake/releases/download/v3.26.1/cmake-3.26.1-linux-x86_64.tar.gz -O cmake.tar.gz
|
||||
tar xzf cmake.tar.gz
|
||||
cp cmake-3.26.1-linux-x86_64/bin/cmake /usr/local/bin
|
||||
cp -r cmake-3.26.1-linux-x86_64/share/cmake-3.26/ /usr/local/share/
|
||||
- name: Build iwasm
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake .. ${{ matrix.make_options_run_mode }} ${{ matrix.make_options_feature }} -DCMAKE_C_COMPILER=gcc-4.8 -DCMAKE_CXX_COMPILER=g++-4.8
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr/product-mini/platforms/linux
|
||||
|
||||
build_samples_wasm_c_api:
|
||||
needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sanitizer: ["", "ubsan", "asan"]
|
||||
make_options: [
|
||||
# Running mode
|
||||
$AOT_BUILD_OPTIONS,
|
||||
$CLASSIC_INTERP_BUILD_OPTIONS,
|
||||
$FAST_INTERP_BUILD_OPTIONS,
|
||||
$FAST_JIT_BUILD_OPTIONS,
|
||||
$LLVM_LAZY_JIT_BUILD_OPTIONS,
|
||||
$LLVM_EAGER_JIT_BUILD_OPTIONS,
|
||||
$MULTI_TIER_JIT_BUILD_OPTIONS,
|
||||
]
|
||||
os: [ubuntu-22.04]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
|
||||
exclude:
|
||||
- make_options: $MULTI_TIER_JIT_BUILD_OPTIONS
|
||||
sanitizer: asan
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS')) && (steps.retrieve_llvm_libs.outputs.cache-hit != 'true')
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Build wamrc
|
||||
if: (!endsWith(matrix.make_options, '_INTERP_BUILD_OPTIONS'))
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Build Sample [wasm-c-api]
|
||||
run: |
|
||||
VERBOSE=1
|
||||
cmake -S . -B build ${{ matrix.make_options }} \
|
||||
-D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" \
|
||||
-D WAMR_BUILD_QUICK_AOT_ENTRY=0
|
||||
cmake --build build --config Release --parallel 4
|
||||
ctest --test-dir build --output-on-failure
|
||||
working-directory: samples/wasm-c-api
|
||||
|
||||
build_samples_others:
|
||||
needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: Get LLVM libraries
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Build wamrc
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -D WAMR_BUILD_SANITIZER="${{matrix.sanitizer}}" ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
working-directory: wamr-compiler
|
||||
|
||||
- name: Build Sample [basic]
|
||||
run: |
|
||||
cd samples/basic
|
||||
./build.sh
|
||||
./run.sh
|
||||
- name: Build Sample [file]
|
||||
run: |
|
||||
cd samples/file
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
./src/iwasm -f wasm-app/file.wasm -d .
|
||||
- name: Build Sample [multi-thread]
|
||||
run: |
|
||||
cd samples/multi-thread
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
./iwasm wasm-apps/test.wasm
|
||||
- name: Build Sample [multi-module]
|
||||
run: |
|
||||
cd samples/multi-module
|
||||
mkdir build && cd build
|
||||
cmake .. -DWAMR_BUILD_AOT=1
|
||||
cmake --build . --config Release --parallel 4
|
||||
./multi_module mC.wasm
|
||||
./multi_module mC.aot
|
||||
- name: Build Sample [spawn-thread]
|
||||
run: |
|
||||
cd samples/spawn-thread
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
./spawn_thread
|
||||
- name: Build Sample [ref-types]
|
||||
run: |
|
||||
cd samples/ref-types
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
./hello
|
||||
|
||||
- name: Build Sample [wasi-threads]
|
||||
run: |
|
||||
cd samples/wasi-threads
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
./iwasm wasm-apps/no_pthread.wasm
|
||||
|
||||
- name: Build Sample [shared-module]
|
||||
run: |
|
||||
cd samples/shared-module
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [terminate]
|
||||
run: |
|
||||
cd samples/terminate
|
||||
./build.sh
|
||||
./run.sh
|
||||
|
||||
- name: Build Sample [native-stack-overflow]
|
||||
run: |
|
||||
cd samples/native-stack-overflow
|
||||
./build.sh
|
||||
./run.sh test1
|
||||
./run.sh test2
|
||||
|
||||
- name: Build Sample [native-lib]
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Release --parallel 4
|
||||
./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so --native-lib=./libtest_hello2.so wasm-app/test.wasm
|
||||
working-directory: ./samples/native-lib
|
||||
|
||||
# FIXME: un-comment me after fix cmake minimum issue
|
||||
# https://github.com/bytecodealliance/wamr-app-framework/pull/11
|
||||
# - name: checkout wamr-app-framework
|
||||
# run: git clone https://github.com/bytecodealliance/wamr-app-framework.git
|
||||
|
||||
# - name: download wamr-app-framework dependencies
|
||||
# run: LVGL=0 LV_DRIVERS=0 ./download.sh
|
||||
# working-directory: ./wamr-app-framework/deps
|
||||
|
||||
# - name: Build Sample [simple]
|
||||
# run: |
|
||||
# ./build.sh -p host-interp
|
||||
# python3 ./sample_test_run.py $(pwd)/out
|
||||
# exit $?
|
||||
# working-directory: ./wamr-app-framework/samples/simple
|
||||
|
||||
- name: Build Sample [shared-heap]
|
||||
run: |
|
||||
cd samples/shared-heap
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
cmake --build . --config Debug --parallel 4
|
||||
./shared_heap_test
|
||||
./shared_heap_test --aot
|
||||
|
||||
test:
|
||||
needs: [build_iwasm, build_llvm_libraries_on_ubuntu, build_wamrc]
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
sanitizer: ["", "ubsan", "asan", "tsan"]
|
||||
running_mode:
|
||||
[
|
||||
"classic-interp",
|
||||
"fast-interp",
|
||||
"jit",
|
||||
"aot",
|
||||
"fast-jit",
|
||||
"multi-tier-jit",
|
||||
]
|
||||
test_option:
|
||||
[
|
||||
$DEFAULT_TEST_OPTIONS,
|
||||
$MULTI_MODULES_TEST_OPTIONS,
|
||||
$SIMD_TEST_OPTIONS,
|
||||
$THREADS_TEST_OPTIONS,
|
||||
$WASI_TEST_OPTIONS,
|
||||
]
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu.outputs.cache_key }}
|
||||
ubuntu_version: "22.04"
|
||||
|
||||
exclude:
|
||||
# asan works only for aot now
|
||||
- running_mode: "classic-interp"
|
||||
sanitizer: asan
|
||||
- running_mode: "fast-interp"
|
||||
sanitizer: asan
|
||||
- running_mode: "jit"
|
||||
sanitizer: asan
|
||||
- running_mode: "fast-jit"
|
||||
sanitizer: asan
|
||||
- running_mode: "multi-tier-jit"
|
||||
sanitizer: asan
|
||||
- running_mode: "classic-interp"
|
||||
sanitizer: tsan
|
||||
- running_mode: "jit"
|
||||
sanitizer: tsan
|
||||
- running_mode: "fast-jit"
|
||||
sanitizer: tsan
|
||||
- running_mode: "multi-tier-jit"
|
||||
sanitizer: tsan
|
||||
# simd128.h brings ubsan errors
|
||||
# like: negation of XXXcannot be represented in type 'long int';
|
||||
# cast to an unsigned type to negate this value to itself
|
||||
- running_mode: "fast-interp"
|
||||
sanitizer: ubsan
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: install-wasi-sdk-wabt
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
uses: ./.github/actions/install-wasi-sdk-wabt
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
|
||||
- name: set env variable(if llvm are used)
|
||||
if: matrix.running_mode == 'aot' || matrix.running_mode == 'jit' || matrix.running_mode == 'multi-tier-jit'
|
||||
run: echo "USE_LLVM=true" >> $GITHUB_ENV
|
||||
|
||||
- name: set env variable(if x86_32 test needed)
|
||||
if: >
|
||||
(matrix.test_option == '$DEFAULT_TEST_OPTIONS' || matrix.test_option == '$THREADS_TEST_OPTIONS'
|
||||
|| matrix.test_option == '$WASI_TEST_OPTIONS')
|
||||
&& matrix.running_mode != 'fast-jit' && matrix.running_mode != 'jit' && matrix.running_mode != 'multi-tier-jit'
|
||||
run: echo "TEST_ON_X86_32=true" >> $GITHUB_ENV
|
||||
|
||||
- name: set additional tsan options
|
||||
run: |
|
||||
echo "TSAN_OPTIONS=suppressions=$PWD/tsan_suppressions.txt" >> $GITHUB_ENV
|
||||
sudo sysctl vm.mmap_rnd_bits=28
|
||||
working-directory: tests/wamr-test-suites
|
||||
|
||||
#only download llvm libraries in jit and aot mode
|
||||
- name: Get LLVM libraries
|
||||
if: env.USE_LLVM == 'true'
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.llvm_cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: env.USE_LLVM == 'true' && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: install jq JSON processor
|
||||
if: matrix.running_mode == 'aot' && matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: sudo apt-get update && sudo apt install -y jq
|
||||
|
||||
- name: install for wabt compilation
|
||||
run: sudo apt update && sudo apt install -y ninja-build
|
||||
|
||||
- name: Build WASI thread tests
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: bash build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-wasi-threads/test/
|
||||
|
||||
- name: Build WASI thread stress tests
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: bash build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-wasi-threads/stress-test/
|
||||
|
||||
- name: build socket api tests
|
||||
if: matrix.test_option == '$WASI_TEST_OPTIONS'
|
||||
run: bash build.sh
|
||||
working-directory: ./core/iwasm/libraries/lib-socket/test/
|
||||
|
||||
- name: run tests
|
||||
timeout-minutes: 40
|
||||
run: ./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }} -T "${{ matrix.sanitizer }}"
|
||||
working-directory: ./tests/wamr-test-suites
|
||||
|
||||
#only install x32 support libraries when to run x86_32 cases
|
||||
- name: install x32 support libraries
|
||||
if: env.TEST_ON_X86_32 == 'true'
|
||||
run:
|
||||
# Add another apt repository as some packages cannot
|
||||
# be downloaded with the github default repository
|
||||
sudo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc &&
|
||||
sudo apt-add-repository https://packages.microsoft.com/ubuntu/${{ matrix.ubuntu_version }}/prod &&
|
||||
sudo apt-get update &&
|
||||
sudo apt install -y g++-multilib lib32gcc-9-dev
|
||||
|
||||
- name: run tests x86_32
|
||||
timeout-minutes: 40
|
||||
if: env.TEST_ON_X86_32 == 'true'
|
||||
run: ./test_wamr.sh ${{ env.X86_32_TARGET_TEST_OPTIONS }} ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
|
||||
working-directory: ./tests/wamr-test-suites
|
241
.github/workflows/release_process.yml
vendored
241
.github/workflows/release_process.yml
vendored
|
@ -1,241 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: the binary release processes
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
require_confirmation:
|
||||
description: "If the process requires a confirmation"
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
|
||||
# Cancel any in-flight jobs for the same PR/branch so there's only one active
|
||||
# at a time
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
create_tag:
|
||||
permissions:
|
||||
contents: write # create and push tags
|
||||
uses: ./.github/workflows/create_tag.yml
|
||||
|
||||
create_release:
|
||||
permissions:
|
||||
contents: write # create release
|
||||
needs: [create_tag]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: prepare the release note
|
||||
run: |
|
||||
extract_result="$(python3 ./.github/scripts/extract_from_release_notes.py RELEASE_NOTES.md)"
|
||||
echo "RELEASE_NOTE<<EOF" >> $GITHUB_ENV
|
||||
echo "${extract_result}" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
- name: create a release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ needs.create_tag.outputs.new_tag }}
|
||||
release_name: ${{ needs.create_tag.outputs.new_tag }}
|
||||
prerelease: ${{ inputs.require_confirmation || needs.create_tag.outputs.minor_version }}
|
||||
draft: false
|
||||
body: ${{ env.RELEASE_NOTE }}
|
||||
|
||||
#
|
||||
# LLVM_LIBRARIES
|
||||
build_llvm_libraries_on_ubuntu_2204:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "ubuntu-22.04"
|
||||
arch: "AArch64 ARM Mips RISCV X86"
|
||||
|
||||
build_llvm_libraries_on_macos:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "macos-13"
|
||||
arch: "AArch64 ARM Mips RISCV X86"
|
||||
|
||||
build_llvm_libraries_on_windows:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "windows-latest"
|
||||
arch: "AArch64 ARM Mips RISCV X86"
|
||||
|
||||
#
|
||||
# WAMRC
|
||||
release_wamrc_on_ubuntu_2204:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2204 ]
|
||||
uses: ./.github/workflows/build_wamrc.yml
|
||||
with:
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
release: true
|
||||
runner: ubuntu-22.04
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver }}
|
||||
|
||||
release_wamrc_on_ubuntu_macos:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release, build_llvm_libraries_on_macos]
|
||||
uses: ./.github/workflows/build_wamrc.yml
|
||||
with:
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_macos.outputs.cache_key }}
|
||||
release: true
|
||||
runner: macos-13
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver }}
|
||||
|
||||
release_wamrc_on_windows:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release, build_llvm_libraries_on_windows]
|
||||
uses: ./.github/workflows/build_wamrc.yml
|
||||
with:
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}
|
||||
release: true
|
||||
runner: windows-latest
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver }}
|
||||
|
||||
#
|
||||
# IWASM
|
||||
release_iwasm_on_ubuntu_2204:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release, build_llvm_libraries_on_ubuntu_2204]
|
||||
uses: ./.github/workflows/build_iwasm_release.yml
|
||||
with:
|
||||
cwd: product-mini/platforms/linux
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_ubuntu_2204.outputs.cache_key }}
|
||||
runner: ubuntu-22.04
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
||||
|
||||
release_iwasm_on_macos:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release, build_llvm_libraries_on_macos]
|
||||
uses: ./.github/workflows/build_iwasm_release.yml
|
||||
with:
|
||||
cwd: product-mini/platforms/darwin
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_macos.outputs.cache_key }}
|
||||
runner: macos-13
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
||||
|
||||
release_iwasm_on_windows:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release, build_llvm_libraries_on_windows]
|
||||
uses: ./.github/workflows/build_iwasm_release.yml
|
||||
with:
|
||||
cwd: product-mini/platforms/windows
|
||||
llvm_cache_key: ${{ needs.build_llvm_libraries_on_windows.outputs.cache_key }}
|
||||
runner: windows-latest
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
||||
|
||||
#
|
||||
# WAMR_SDK
|
||||
release_wamr_sdk_on_ubuntu_2204:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_wamr_sdk.yml
|
||||
with:
|
||||
config_file: wamr_config_ubuntu_release.cmake
|
||||
runner: ubuntu-22.04
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
||||
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz
|
||||
wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git
|
||||
|
||||
release_wamr_sdk_on_macos:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_wamr_sdk.yml
|
||||
with:
|
||||
config_file: wamr_config_macos_release.cmake
|
||||
runner: macos-13
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
||||
wasi_sdk_url: https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-macos.tar.gz
|
||||
wamr_app_framework_url: https://github.com/bytecodealliance/wamr-app-framework.git
|
||||
|
||||
# Let's disable it for now and reopen it when the actual requirement arises.
|
||||
# Please ensure all dependencies have been updated before reopening.
|
||||
#
|
||||
# # vscode extension cross-platform
|
||||
# release_wamr_ide_vscode_ext:
|
||||
# permissions:
|
||||
# contents: write # upload release artifact
|
||||
# needs: [create_tag, create_release]
|
||||
# uses: ./.github/workflows/build_wamr_vscode_ext.yml
|
||||
# secrets: inherit
|
||||
# with:
|
||||
# upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
# ver_num: ${{ needs.create_tag.outputs.new_ver }}
|
||||
|
||||
# #
|
||||
# # vscode extension docker images package
|
||||
# release_wamr_ide_docker_images_package:
|
||||
# permissions:
|
||||
# contents: write # upload release artifact
|
||||
# needs: [create_tag, create_release]
|
||||
# uses: ./.github/workflows/build_docker_images.yml
|
||||
# with:
|
||||
# upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
# ver_num: ${{ needs.create_tag.outputs.new_ver }}
|
||||
|
||||
#
|
||||
# WAMR_LLDB
|
||||
release_wamr_lldb_on_ubuntu_2204:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_wamr_lldb.yml
|
||||
with:
|
||||
runner: ubuntu-22.04
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
||||
|
||||
release_wamr_lldb_on_macos_universal:
|
||||
permissions:
|
||||
contents: write # upload release artifact
|
||||
needs: [create_tag, create_release]
|
||||
uses: ./.github/workflows/build_wamr_lldb.yml
|
||||
with:
|
||||
runner: macos-13
|
||||
arch: universal
|
||||
upload_url: ${{ needs.create_release.outputs.upload_url }}
|
||||
ver_num: ${{ needs.create_tag.outputs.new_ver}}
|
|
@ -1,74 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
name: reuse binaries of the latest release if no more modification on the_path since last_commit
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
binary_name_stem:
|
||||
type: string
|
||||
required: true
|
||||
last_commit:
|
||||
type: string
|
||||
required: true
|
||||
the_path:
|
||||
type: string
|
||||
required: true
|
||||
upload_url:
|
||||
description: upload binary assets to the URL of release
|
||||
type: string
|
||||
required: true
|
||||
outputs:
|
||||
result:
|
||||
value: ${{ jobs.build.outputs.result }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
reuse:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
result: ${{ steps.try_reuse.outputs.result }}
|
||||
permissions:
|
||||
contents: write # for creating realease and uploading release artifacts
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# Full git history is needed to get a proper list of commits and tags
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: try to reuse binaries
|
||||
id: try_reuse
|
||||
run: |
|
||||
echo '::echo::on'
|
||||
python3 ./.github/scripts/reuse_latest_release_binaries.py \
|
||||
--binary_name_stem ${{ inputs.binary_name_stem }} \
|
||||
--last_commit ${{ inputs.last_commit }} \
|
||||
--the_path ${{ inputs.the_path }} .
|
||||
ls -lh .
|
||||
|
||||
- run: echo ${{ steps.try_reuse.outputs.result }}
|
||||
|
||||
- name: upload release tar.gz
|
||||
if: steps.try_reuse.outputs.result == 'hit'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: ${{ inputs.binary_name_stem }}.tar.gz
|
||||
asset_name: ${{ inputs.binary_name_stem }}.tar.gz
|
||||
asset_content_type: application/x-gzip
|
||||
|
||||
- name: upload release zip
|
||||
if: steps.try_reuse.outputs.result == 'hit'
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ inputs.upload_url }}
|
||||
asset_path: ${{ inputs.binary_name_stem }}.zip
|
||||
asset_name: ${{ inputs.binary_name_stem }}.zip
|
||||
asset_content_type: application/zip
|
335
.github/workflows/spec_test_on_nuttx.yml
vendored
335
.github/workflows/spec_test_on_nuttx.yml
vendored
|
@ -1,335 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
name: spec test on nuttx
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
paths:
|
||||
- ".github/workflows/spec_test_on_nuttx.yml"
|
||||
- "core/**"
|
||||
- "!core/deps/**"
|
||||
- "product-mini/**"
|
||||
- "!samples/workload/**"
|
||||
- "tests/wamr-test-suites/**"
|
||||
- "wamr-compiler/**"
|
||||
- "wamr-sdk/**"
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
# Note on INTERPRETERS_WAMR_STACK_GUARD_SIZE:
|
||||
# https://github.com/apache/nuttx-apps/pull/2241 is not included in
|
||||
# releases/12.4 branch as of writing this.
|
||||
env:
|
||||
LLVM_CACHE_SUFFIX: "build-llvm_libraries_ex"
|
||||
WASI_SDK_PATH: "/opt/wasi-sdk"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build_llvm_libraries:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "ubuntu-22.04"
|
||||
arch: "ARM RISCV AArch64"
|
||||
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
|
||||
|
||||
build_llvm_libraries_xtensa:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: write
|
||||
uses: ./.github/workflows/build_llvm_libraries.yml
|
||||
with:
|
||||
os: "ubuntu-22.04"
|
||||
arch: "Xtensa"
|
||||
extra_build_llvm_options: "--platform xtensa"
|
||||
cache_key_suffix: "-xtensa"
|
||||
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
|
||||
|
||||
spec_test_on_qemu:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build_llvm_libraries, build_llvm_libraries_xtensa]
|
||||
container:
|
||||
image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
|
||||
strategy:
|
||||
matrix:
|
||||
target_config: [
|
||||
# {
|
||||
# config: "boards/arm64/qemu/qemu-armv8a/configs/nsh",
|
||||
# target: "aarch64_vfp",
|
||||
# fpu_type: "fp"
|
||||
# },
|
||||
# {
|
||||
# config: "boards/arm/imx6/sabre-6quad/configs/nsh",
|
||||
# target: "thumbv7",
|
||||
# fpu_type: "none"
|
||||
# },
|
||||
{
|
||||
config: "boards/arm/imx6/sabre-6quad/configs/nsh",
|
||||
target: "thumbv7_vfp",
|
||||
fpu_type: "dp"
|
||||
},
|
||||
{
|
||||
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
|
||||
target: "riscv32",
|
||||
fpu_type: "none"
|
||||
},
|
||||
#{
|
||||
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
|
||||
# target: "riscv32_ilp32f",
|
||||
# fpu_type: "fp"
|
||||
#},
|
||||
# {
|
||||
# config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh",
|
||||
# target: "riscv32_ilp32d",
|
||||
# fpu_type: "dp"
|
||||
# },
|
||||
{
|
||||
config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64",
|
||||
target: "riscv64",
|
||||
fpu_type: "none"
|
||||
},
|
||||
{
|
||||
config: "boards/xtensa/esp32s3/esp32s3-devkit/configs/qemu_debug",
|
||||
target: "xtensa",
|
||||
fpu_type: "none"
|
||||
},
|
||||
]
|
||||
|
||||
wamr_test_option: [
|
||||
{
|
||||
mode: "-t aot",
|
||||
option: "CONFIG_INTERPRETERS_WAMR_AOT"
|
||||
},
|
||||
{
|
||||
mode: "-t aot -X",
|
||||
option: "CONFIG_INTERPRETERS_WAMR_AOT"
|
||||
},
|
||||
# {
|
||||
# mode: "-t classic-interp",
|
||||
# option: "CONFIG_INTERPRETERS_WAMR_CLASSIC"
|
||||
# },
|
||||
# {
|
||||
# mode: "-t fast-interp",
|
||||
# option: "CONFIG_INTERPRETERS_WAMR_FAST"
|
||||
# },
|
||||
]
|
||||
|
||||
wamr_feature_option:
|
||||
# Empty option for default
|
||||
- { option: "", mode: "" }
|
||||
# need to install menhir
|
||||
# - { option: "CONFIG_INTERPRETERS_WAMR_GC CONFIG_INTERPRETERS_WAMR_AOT_STACK_FRAME", mode: "-G" }
|
||||
|
||||
exclude:
|
||||
# XIP is not fully supported yet on RISCV64, some relocations can not be resolved
|
||||
- target_config: { config: "boards/risc-v/qemu-rv/rv-virt/configs/nsh64" }
|
||||
wamr_test_option: { mode: "-t aot -X" }
|
||||
|
||||
# Our xtensa environment doesn't have enough memory
|
||||
- target_config: { target: "xtensa" }
|
||||
wamr_feature_option: { mode: "-G" }
|
||||
|
||||
steps:
|
||||
# Note: we use an unreleased version nuttx for xtensa because
|
||||
# 12.4 doesn't contain necessary esp32s3 changes.
|
||||
- name: Checkout NuttX
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: apache/nuttx
|
||||
ref: ${{ matrix.target_config.target == 'xtensa' && '985d395b025cf2012b22f6bb4461959fa6d87645' || 'releases/12.9' }}
|
||||
path: nuttx
|
||||
|
||||
- name: Checkout NuttX Apps
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: apache/nuttx-apps
|
||||
ref: ${{ matrix.target_config.target == 'xtensa' && '2ef3eb25c0cec944b13792185f7e5d5a05990d5f' || 'releases/12.9' }}
|
||||
path: apps
|
||||
|
||||
- name: Checkout WAMR
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ github.repository }}
|
||||
path: apps/interpreters/wamr/wamr
|
||||
|
||||
- name: Get LLVM libraries
|
||||
if: contains(matrix.wamr_test_option.mode, 'aot')
|
||||
id: retrieve_llvm_libs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./core/deps/llvm/build/bin
|
||||
./core/deps/llvm/build/include
|
||||
./core/deps/llvm/build/lib
|
||||
./core/deps/llvm/build/libexec
|
||||
./core/deps/llvm/build/share
|
||||
key: ${{ matrix.target_config.target == 'xtensa' && needs.build_llvm_libraries_xtensa.outputs.cache_key || needs.build_llvm_libraries.outputs.cache_key }}
|
||||
|
||||
- name: Quit if cache miss
|
||||
if: contains(matrix.wamr_test_option.mode, 'aot') && steps.retrieve_llvm_libs.outputs.cache-hit != 'true'
|
||||
run: echo "::error::can not get prebuilt llvm libraries" && exit 1
|
||||
|
||||
- name: Copy LLVM
|
||||
if: contains(matrix.wamr_test_option.mode, 'aot')
|
||||
run: cp -r core/deps/llvm apps/interpreters/wamr/wamr/core/deps/llvm
|
||||
|
||||
- name: Build wamrc
|
||||
if: contains(matrix.wamr_test_option.mode, 'aot')
|
||||
working-directory: apps/interpreters/wamr/wamr/wamr-compiler
|
||||
run: |
|
||||
cmake -B build -DWAMR_BUILD_SHRUNK_MEMORY=0 -S .
|
||||
cmake --build build
|
||||
|
||||
# the nuttx version we use for xtensa requires esptool.py newer than
|
||||
# what we have in our version of the apache-nuttx-ci-linux image.
|
||||
- name: Install the latest esptool.py (xtensa)
|
||||
if: matrix.target_config.target == 'xtensa'
|
||||
run: |
|
||||
pip3 install esptool==4.7.0
|
||||
esptool.py version
|
||||
|
||||
- name: Configure NuttX
|
||||
run: |
|
||||
tools/configure.sh ${{ matrix.target_config.config }}
|
||||
working-directory: nuttx
|
||||
|
||||
# depending on configurations, the iwasm command line generated
|
||||
# by spec-test-script can be longer than the default NSH_LINELEN,
|
||||
# which is 64 or 80.
|
||||
- name: Enable WAMR for NuttX
|
||||
run: |
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LOG
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_LIBC_BUILTIN
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_REF_TYPES
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_ENABLE_SPEC_TEST
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_SHARED_MEMORY
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_BULK_MEMORY
|
||||
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACK_GUARD_SIZE 1024
|
||||
kconfig-tweak --enable CONFIG_FS_HOSTFS
|
||||
kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS
|
||||
kconfig-tweak --enable CONFIG_ARM_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
|
||||
kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS
|
||||
kconfig-tweak --enable CONFIG_RISCV_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
|
||||
kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS
|
||||
kconfig-tweak --enable CONFIG_XTENSA_SEMIHOSTING_HOSTFS_CACHE_COHERENCE
|
||||
kconfig-tweak --enable CONFIG_LIBC_FLOATINGPOINT
|
||||
kconfig-tweak --set-val CONFIG_NSH_LINELEN 255
|
||||
working-directory: nuttx
|
||||
|
||||
- name: Set WAMR stack size for NuttX
|
||||
if: matrix.target_config.target != 'xtensa'
|
||||
run: |
|
||||
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 327680
|
||||
working-directory: nuttx
|
||||
|
||||
# because qemu doesn't have a proper emulation of esp32s3 psram,
|
||||
# we are limited to the internal ram, which is about 400KB.
|
||||
- name: Set WAMR stack size for NuttX (xtensa)
|
||||
if: matrix.target_config.target == 'xtensa'
|
||||
run: |
|
||||
kconfig-tweak --set-val CONFIG_INTERPRETERS_WAMR_STACKSIZE 25600
|
||||
working-directory: nuttx
|
||||
|
||||
- name: Enable WAMR interpreter/aot runtime for NuttX
|
||||
if: matrix.wamr_test_option.option != ''
|
||||
run: |
|
||||
for x in ${{ matrix.wamr_test_option.option }}; do
|
||||
kconfig-tweak --enable $x
|
||||
done
|
||||
working-directory: nuttx
|
||||
|
||||
- name: Enable WAMR Features for NuttX
|
||||
if: matrix.wamr_feature_option.option != ''
|
||||
run: |
|
||||
for x in ${{ matrix.wamr_feature_option.option }}; do
|
||||
kconfig-tweak --enable $x
|
||||
done
|
||||
working-directory: nuttx
|
||||
|
||||
- name: Disable FPU for NuttX
|
||||
if: matrix.target_config.fpu_type == 'none'
|
||||
run: |
|
||||
kconfig-tweak --disable CONFIG_ARCH_FPU
|
||||
working-directory: nuttx
|
||||
|
||||
- name: Disable DPFPU for NuttX
|
||||
if: matrix.target_config.fpu_type == 'fp'
|
||||
run: |
|
||||
kconfig-tweak --disable CONFIG_ARCH_DPFPU
|
||||
working-directory: nuttx
|
||||
|
||||
# Note: while a real hardware would need
|
||||
# INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=y,
|
||||
# it doesn't work with xtensa qemu which we use on the CI because it
|
||||
# doesn't have a proper emulation of I/D separate mappings.
|
||||
# we work it around by using INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR=n.
|
||||
# this configuration won't work on a real hardware.
|
||||
- name: Tweak NuttX config (xtensa)
|
||||
if: matrix.target_config.target == 'xtensa'
|
||||
run: |
|
||||
kconfig-tweak --enable CONFIG_INTERPRETERS_WAMR_AOT_WORD_ALIGN_READ
|
||||
kconfig-tweak --disable CONFIG_INTERPRETERS_WAMR_MEM_DUAL_BUS_MIRROR
|
||||
working-directory: nuttx
|
||||
|
||||
- name: Build NuttX
|
||||
run: |
|
||||
make olddefconfig
|
||||
make -j$(nproc)
|
||||
working-directory: nuttx
|
||||
|
||||
# for xtensa, build a 8MB firmware image.
|
||||
# simple boot is assumed. (thus the nuttx.bin offset in the image is 0)
|
||||
# qemu will infer the flash size from the file size.
|
||||
- name: Post build processing (xtensa)
|
||||
if: matrix.target_config.target == 'xtensa'
|
||||
run: |
|
||||
cd nuttx
|
||||
dd if=/dev/zero of=flash.img bs=1024 count=8192
|
||||
dd if=nuttx.bin of=flash.img conv=notrunc
|
||||
mv flash.img nuttx
|
||||
|
||||
- name: Build firmware path
|
||||
id: build_firmware_path
|
||||
run: |
|
||||
echo "firmware=$PWD/nuttx/nuttx" >> $GITHUB_OUTPUT
|
||||
|
||||
# for xtensa, use the espressif fork of qemu, which has esp32s3 support.
|
||||
- name: Install QEMU (xtensa)
|
||||
if: matrix.target_config.target == 'xtensa'
|
||||
run: |
|
||||
apt-get remove -y qemu-system-misc
|
||||
apt-get update && apt-get install -y libsdl2-2.0-0
|
||||
./.github/scripts/install_qemu_xtensa.sh
|
||||
qemu-system-xtensa --version
|
||||
working-directory: apps/interpreters/wamr/wamr
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd apps/interpreters/wamr/wamr/tests/wamr-test-suites
|
||||
./test_wamr.sh -s spec ${{ matrix.wamr_test_option.mode }} -m ${{ matrix.target_config.target }} -b -Q -F ${{ steps.build_firmware_path.outputs.firmware }} ${{ matrix.wamr_feature_option.mode}}
|
||||
|
||||
- name: pack the log
|
||||
if: always()
|
||||
run: |
|
||||
mkdir log
|
||||
cp $PWD/nuttx/.config log/dot-config
|
||||
cp ${{ steps.build_firmware_path.outputs.firmware }} log
|
||||
tar -C apps/interpreters/wamr/wamr/tests/wamr-test-suites/workspace -cvzf log/report.tgz report
|
||||
|
||||
- name: upload the log
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4.6.2
|
||||
with:
|
||||
name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }}
|
||||
path: log
|
65
.github/workflows/supply_chain.yml
vendored
65
.github/workflows/supply_chain.yml
vendored
|
@ -1,65 +0,0 @@
|
|||
# This workflow uses actions that are not certified by GitHub. They are provided
|
||||
# by a third-party and are governed by separate terms of service, privacy
|
||||
# policy, and support documentation.
|
||||
|
||||
# Check current WASM Micro Runtime results here: https://securityscorecards.dev/viewer/?uri=github.com/bytecodealliance/wasm-micro-runtime
|
||||
|
||||
name: Scorecard supply-chain security
|
||||
on:
|
||||
# For Branch-Protection check. Only the default branch is supported. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
|
||||
branch_protection_rule:
|
||||
# To guarantee Maintained check is occasionally updated. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||
# midnight UTC
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
# allow to be triggered manually
|
||||
workflow_dispatch:
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecard analysis
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'bytecodealliance/wasm-micro-runtime'
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Needed to publish results and get a badge (see publish_results below).
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
||||
# - Publish results to OpenSSF REST API for easy access by consumers
|
||||
# - Allows the repository to include the Scorecard badge.
|
||||
# - See https://github.com/ossf/scorecard-action#publishing-results.
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v3.1.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@2847b7f7ab9f48fc49eca90a53fff6007285f399
|
||||
with:
|
||||
sarif_file: results.sarif
|
42
.gitignore
vendored
42
.gitignore
vendored
|
@ -1,42 +1,2 @@
|
|||
.cache
|
||||
.clangd
|
||||
.vs
|
||||
.vscode
|
||||
.venv
|
||||
/.idea
|
||||
**/cmake-build-*/
|
||||
**/*build*/
|
||||
!/build-scripts
|
||||
*.obj
|
||||
*.a
|
||||
*.so
|
||||
.clangd
|
||||
.DS_Store
|
||||
*.o
|
||||
.aider*
|
||||
|
||||
core/deps/**
|
||||
core/shared/mem-alloc/tlsf
|
||||
core/iwasm/libraries/lib-wasi-threads/test/*.wasm
|
||||
core/iwasm/libraries/lib-socket/test/*.wasm
|
||||
|
||||
product-mini/app-samples/hello-world/test.wasm
|
||||
product-mini/platforms/linux-sgx/enclave-sample/App/
|
||||
product-mini/platforms/linux-sgx/enclave-sample/Enclave/
|
||||
product-mini/platforms/linux-sgx/enclave-sample/iwasm
|
||||
|
||||
build_out
|
||||
tests/wamr-test-suites/workspace
|
||||
|
||||
!/test-tools/wamr-ide/VSCode-Extension/.vscode
|
||||
|
||||
samples/socket-api/wasm-src/inc/pthread.h
|
||||
|
||||
**/__pycache__
|
||||
|
||||
tests/benchmarks/coremark/coremark*
|
||||
|
||||
samples/workload/include/**
|
||||
!samples/workload/include/.gitkeep
|
||||
|
||||
# core/iwasm/libraries/wasi-threads
|
||||
**/*build/
|
||||
|
|
36
ADOPTERS.md
36
ADOPTERS.md
|
@ -1,36 +0,0 @@
|
|||
# WAMR adopters
|
||||
|
||||
_If you are using WAMR in production/pre-production at your organization, please add your company name to this list.
|
||||
The list is in alphabetical order._
|
||||
|
||||
| Organization | Contact | Status | Description of Use |
|
||||
| -------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| [Alibaba](https://www.alibaba.com) | [@johnlanni](https://github.com/johnlanni) |  | Higress is a next-generation cloud-native gateway built on the core of open-source Istio + Envoy based on Alibaba's internal Envoy Gateway practice. |
|
||||
| [Amazon](https://www.amazon.com) | [@loganek](https://github.com/loganek) |  | Prime Video is a global streaming service by Amazon that provides on-demand access to a vast library of movies, TV shows, and original programming, as well as live content. |
|
||||
| [Ant Group](https://www.antgroup.com) | [@wei-tang](https://github.com/wei-tang) |  | AntChain is a blockchain technology platform owned by Ant Group, a Chinese tech conglomerate that also runs Alipay, China's largest digital payment system. |
|
||||
| [Bosch](https://www.bosch.com) | emily.ruppel@us.bosch.com |  | Silverline Cloud-Edge platform |
|
||||
| [Disney](https://www.disney.com) | |  | Disney+ Streaming |
|
||||
| [Intel](https://www.intel.com) | [@wenyongh](https://github.com/wenyongh) |  | Edge and the embedded environments |
|
||||
| [Moonbit](https://www.moonbitlang.com) | [@peter-jerry-ye](https://github.com/peter-jerry-ye) |  | MoonBit is an end-to-end programming language toolchain for cloud and edge computing using WebAssembly. |
|
||||
| [Microsoft](https://www.microsoft.com) | [@Mossaka](https://github.com/Mossaka) |  | Hyperlight runs Wasm workloads in VMs without OS and kernel, it is a solution for improving the management and security of Wasm workloads on Azure. |
|
||||
| [Midokura](https://www.midokura.com) | [@yamt](https://github.com/yamt) |  | The next-generation Edge AI sensing platform |
|
||||
| [Siemens](https://www.siemens.com) | [@ttrenner](https://github.com/ttrenner) |  | Industrial, IoT |
|
||||
| [Sony Semiconductor Solutions](https://www.sony-semicon.com) | [@dongsheng28849455](https://github.com/dongsheng28849455) |  | AI digital camera |
|
||||
| [Xiaomi](https://www.mi.com) | [@no1wudi](https://github.com/no1wudi) |  | Xiaomi Vela is Xiaomi's IoT embedded software platform based on the open-source, real-time operating system NuttX. |
|
||||
| [Xiaomi](https://www.mi.com) | [@no1wudi](https://github.com/no1wudi) |  | TEE (trusted execution environment) app engine. |
|
||||
|
||||
# Adopted in open-source projects
|
||||
|
||||
_The list is in alphabetical order._
|
||||
|
||||
| Project | Reference |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| [Apache Teaclave](https://github.com/apache/incubator-teaclave) | https://github.com/apache/incubator-teaclave/blob/master/docs/executing-wasm.md |
|
||||
| [Envoy](https://github.com/envoyproxy/envoy) | https://github.com/envoyproxy/envoy/blob/main/docs/root/configuration/other_features/wasm.rst |
|
||||
| [faasm](https://github.com/faasm/faasm) | https://github.com/faasm/faasm/blob/main/docs/source/wamr.md |
|
||||
| [fluent-bit](https://github.com/fluent/fluent-bit) | https://github.com/fluent/fluent-bit/tree/master/lib/wasm-micro-runtime-WAMR-1.3.0 |
|
||||
| [harfbuzz](https://github.com/harfbuzz/harfbuzz) | https://github.com/harfbuzz/harfbuzz/blob/main/docs/wasm-shaper.md#enabling-the-wasm-shaper-when-building-harfbuzz |
|
||||
| [inclave-containers](https://github.com/inclavare-containers/inclavare-containers) | https://github.com/inclavare-containers/inclavare-containers |
|
||||
| [private-data-objects](https://github.com/hyperledger-labs/private-data-objects) | https://github.com/hyperledger-labs/private-data-objects/blob/main/common/interpreter/wawaka_wasm/README.md |
|
||||
| [runwasi](https://github.com/containerd/runwasi) | https://github.com/containerd/runwasi/pull/508 (WIP) |
|
||||
| [Wasmnizer-ts](https://github.com/web-devkits/Wasmnizer-ts) | https://github.com/web-devkits/Wasmnizer-ts |
|
105
ATTRIBUTIONS.md
105
ATTRIBUTIONS.md
|
@ -1,105 +0,0 @@
|
|||
WebAssembly Micro Runtime Attributions
|
||||
======================================
|
||||
|
||||
WAMR project reused some components from other open source project:
|
||||
- **cJson**: in the repository [wamr-app-framework](https://github.com/bytecodealliance/wamr-app-framework/), used in the host_tool for remotely managing wasm applications
|
||||
- **contiki-ng**: for the coap protocol implementation
|
||||
- **freebsd libm**: used in core/shared/platform/alios/bh_math.c
|
||||
- **LVGL**: in the repository [wamr-app-framework](https://github.com/bytecodealliance/wamr-app-framework/), for the gui samples and wrapped the wasm graphic layer
|
||||
- **llvm**: for the AOT/JIT compilation
|
||||
- **wasm-c-api**: to implement the C-APIs of wasm. using headers and sameples
|
||||
- **wasmtime**: for the wasi libc implementation
|
||||
- **zephyr**: for several platform specific examples
|
||||
- **WebAssembly debugging patch for LLDB**: for extending the ability of LLDB to support wasm debugging
|
||||
- **libuv**: for the WASI Libc with uvwasi implementation
|
||||
- **uvwasi**: for the WASI Libc with uvwasi implementation
|
||||
- **asmjit**: for the Fast JIT x86-64 codegen implementation
|
||||
- **zydis**: for the Fast JIT x86-64 codegen implementation
|
||||
- **NuttX ELF headers**: used in core/iwasm/aot/debug/elf_parser.c
|
||||
- **Dhrystone**: for the test benchmark dhrystone
|
||||
|
||||
The WAMR fast interpreter is a clean room development. We would acknowledge the inspirations by [WASM3](https://github.com/wasm3/wasm3) open source project for the approach of pre-calculated operand stack location.
|
||||
|
||||
| third party components | version number | latest release | vendor pages | CVE details |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| cjson | 1.7.16 | 1.7.16 | https://github.com/DaveGamble/cJSON | https://www.cvedetails.com/vendor/19164/Cjson-Project.html |
|
||||
| contiki-ng (er-coap) | unspecified | 3.0 | https://github.com/contiki-os/contiki | https://www.cvedetails.com/vendor/16528/Contiki-os.html |
|
||||
| freebsd libm | unspecified | 13.0 | https://www.freebsd.org/ | https://www.cvedetails.com/vendor/6/Freebsd.html |
|
||||
| LVGL | 6.0.1 | 7.11.0 | https://lvgl.io/ | |
|
||||
| llvm | 11.0.1 | 12.0.0 | https://llvm.org | https://www.cvedetails.com/vendor/13260/Llvm.html |
|
||||
| wasm-c-api | ac9b509f4df86e40e56e9b01f3f49afab0100037 | c9d31284651b975f05ac27cee0bab1377560b87e | https://github.com/WebAssembly/wasm-c-api | |
|
||||
| wasmtime | unspecified | v0.26.0 | https://github.com/bytecodealliance/wasmtime | |
|
||||
| zephyr | unspecified | v2.5.0 | https://www.zephyrproject.org/ | https://www.cvedetails.com/vendor/19255/Zephyrproject.html |
|
||||
| WebAssembly debugging patch for LLDB | unspecified | unspecified | https://reviews.llvm.org/D78801 | |
|
||||
| libuv | v1.46.0 | v1.46.0 | https://github.com/libuv/libuv | https://www.cvedetails.com/vendor/15402/Libuv-Project.html |
|
||||
| uvwasi | unspecified | v0.0.12 | https://github.com/nodejs/uvwasi | |
|
||||
| asmjit | unspecified | unspecified | https://github.com/asmjit/asmjit | |
|
||||
| zydis | unspecified | e14a07895136182a5b53e181eec3b1c6e0b434de | https://github.com/zyantific/zydis | |
|
||||
| NuttX ELF headers | 72313301e23f9c2de969fb64b9a0f67bb4c284df | 10.3.0 | https://github.com/apache/nuttx | |
|
||||
| Dhrystone | 2.1 | 2.1 | https://fossies.org/linux/privat/old/ | |
|
||||
|
||||
## Licenses
|
||||
|
||||
### cJson
|
||||
|
||||
[LICENSE](https://github.com/bytecodealliance/wamr-app-framework/blob/main/test-tools/host-tool/external/cJSON/LICENSE)
|
||||
|
||||
### contiki-ng
|
||||
|
||||
[LICENSE](./core/shared/coap/er-coap/LICENSE.md)
|
||||
|
||||
### freebsd libm
|
||||
|
||||
[COPYRIGHT](./core/shared/platform/common/math/COPYRIGHT)
|
||||
|
||||
### LVGL
|
||||
|
||||
[LICENSE](https://github.com/bytecodealliance/wamr-app-framework/blob/main/samples/littlevgl/LICENCE.txt)
|
||||
|
||||
[LICENSE](https://github.com/bytecodealliance/wamr-app-framework/blob/main/app-framework/wgl/app/wa-inc/lvgl/LICENCE.txt)
|
||||
|
||||
### llvm
|
||||
|
||||
[LICENSE](./LICENSE)
|
||||
|
||||
### wasm-c-api
|
||||
|
||||
[LICENSE](./samples/wasm-c-api/src/LICENSE)
|
||||
|
||||
### wasmtime
|
||||
|
||||
[LICENSE](./core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/LICENSE)
|
||||
|
||||
[LICENSE](./core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/LICENSE)
|
||||
|
||||
[LICENSE](./core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/include/LICENSE)
|
||||
|
||||
### zephyr
|
||||
|
||||
[LICENSE](https://github.com/bytecodealliance/wamr-app-framework/blob/main/samples/gui/wasm-runtime-wgl/src/platform/zephyr/LICENSE)
|
||||
|
||||
### libuv
|
||||
|
||||
[LICENSE](./core/iwasm/libraries/libc-uvwasi/LICENSE_LIBUV)
|
||||
|
||||
### uvwasi
|
||||
|
||||
[LICENSE](./core/iwasm/libraries/libc-uvwasi/LICENSE_UVWASI)
|
||||
|
||||
### asmjit
|
||||
|
||||
[LICENSE](./core/iwasm/fast-jit/cg/LICENSE_ASMJIT)
|
||||
|
||||
### zydis
|
||||
|
||||
[LICENSE](./core/iwasm/fast-jit/cg/LICENSE_ZYDIS)
|
||||
|
||||
### NuttX ELF headers
|
||||
|
||||
[LICENSE](./core/iwasm/aot/debug/LICENSE_NUTTX)
|
||||
|
||||
[NOTICE](./core/iwasm/aot/debug/NOTICE_NUTTX)
|
||||
|
||||
### Dhrystone
|
||||
|
||||
[LICENSE](./tests/benchmarks/dhrystone/LICENSE)
|
191
CMakeLists.txt
191
CMakeLists.txt
|
@ -1,191 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
cmake_minimum_required (VERSION 3.14)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)
|
||||
|
||||
if(ESP_PLATFORM)
|
||||
include (${COMPONENT_DIR}/build-scripts/esp-idf/wamr/CMakeLists.txt)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project (iwasm LANGUAGES C)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set (CMAKE_VERBOSE_MAKEFILE OFF)
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_PLATFORM)
|
||||
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
|
||||
endif ()
|
||||
|
||||
# Reset default linker flags
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
set (CMAKE_C_STANDARD 99)
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_INTERP)
|
||||
# Enable Interpreter by default
|
||||
set (WAMR_BUILD_INTERP 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_AOT)
|
||||
# Enable AOT by default.
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_JIT)
|
||||
# Disable JIT by default.
|
||||
set (WAMR_BUILD_JIT 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_FAST_JIT)
|
||||
# Disable Fast JIT by default
|
||||
set (WAMR_BUILD_FAST_JIT 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_LIBC_BUILTIN)
|
||||
# Enable libc builtin support by default
|
||||
set (WAMR_BUILD_LIBC_BUILTIN 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_LIBC_WASI)
|
||||
# Enable libc wasi support by default
|
||||
set (WAMR_BUILD_LIBC_WASI 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_FAST_INTERP)
|
||||
# Enable fast interpreter
|
||||
set (WAMR_BUILD_FAST_INTERP 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_MULTI_MODULE)
|
||||
# Disable multiple modules by default
|
||||
set (WAMR_BUILD_MULTI_MODULE 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_LIB_PTHREAD)
|
||||
# Disable pthread library by default
|
||||
set (WAMR_BUILD_LIB_PTHREAD 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_LIB_WASI_THREADS)
|
||||
# Disable wasi threads library by default
|
||||
set (WAMR_BUILD_LIB_WASI_THREADS 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_ENABLE_COPY_CALLSTACK)
|
||||
# Disable copy callstack by default
|
||||
set (WAMR_ENABLE_COPY_CALLSTACK 0)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_MINI_LOADER)
|
||||
# Disable wasm mini loader by default
|
||||
set (WAMR_BUILD_MINI_LOADER 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_SIMD)
|
||||
# Enable SIMD by default
|
||||
set (WAMR_BUILD_SIMD 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_REF_TYPES)
|
||||
# Enable reference types by default
|
||||
set (WAMR_BUILD_REF_TYPES 1)
|
||||
endif ()
|
||||
|
||||
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
|
||||
if (NOT WIN32)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security \
|
||||
-ffunction-sections -fdata-sections \
|
||||
-Wno-unused-parameter -Wno-pedantic \
|
||||
-fvisibility=hidden")
|
||||
# Remove the extra spaces for better make log
|
||||
string (REGEX REPLACE " *" " " CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat -Wformat-security -Wno-unused")
|
||||
endif()
|
||||
|
||||
if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
|
||||
if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# The following flags are to enhance security, but it may impact performance,
|
||||
# we disable them by default.
|
||||
#if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
|
||||
# set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrapv -D_FORTIFY_SOURCE=2")
|
||||
#endif ()
|
||||
#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector-strong --param ssp-buffer-size=4")
|
||||
#set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now")
|
||||
|
||||
include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
|
||||
|
||||
set (THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE})
|
||||
set_target_properties (vmlib PROPERTIES OUTPUT_NAME iwasm)
|
||||
target_include_directories(vmlib INTERFACE
|
||||
$<BUILD_INTERFACE:${WAMR_ROOT_DIR}/core/iwasm/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
target_link_libraries (vmlib PUBLIC ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
|
||||
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
|
||||
target_link_libraries(vmlib INTERFACE boringssl_crypto)
|
||||
endif ()
|
||||
|
||||
if (MINGW)
|
||||
target_link_libraries(vmlib INTERFACE -lWs2_32 -lwsock32)
|
||||
target_link_libraries(vmlib PRIVATE ws2_32)
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(vmlib PRIVATE ntdll)
|
||||
endif()
|
||||
|
||||
set (WAMR_PUBLIC_HEADERS
|
||||
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
|
||||
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
|
||||
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
|
||||
)
|
||||
set_target_properties (vmlib PROPERTIES PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}")
|
||||
|
||||
set_version_info (vmlib)
|
||||
|
||||
install (TARGETS vmlib
|
||||
EXPORT iwasmTargets
|
||||
LIBRARY DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
)
|
||||
|
||||
install_iwasm_package ()
|
29
CODEOWNERS
29
CODEOWNERS
|
@ -1,29 +0,0 @@
|
|||
# In this project, we use CODEOWNERS to identify people who are likely to know
|
||||
# who should review a pull request.
|
||||
#
|
||||
# People listed in this file are committing to respond in a timely fashion to
|
||||
# PRs in the selected areas. However, that response doesn't have to be a full
|
||||
# code review; it could also take any of these forms:
|
||||
#
|
||||
# - "I intend to review this but I can't yet. Please leave me a message if I
|
||||
# haven't responded by (a specific date in the near future)."
|
||||
#
|
||||
# - "I think (a specific other contributor) should review this." (Note that the
|
||||
# best reviewer for a PR may not necessarily be listed in this file.)
|
||||
#
|
||||
# People must only be added to this file if they've agreed to provide one of
|
||||
# the above responses in a reasonable amount of time for every PR to which
|
||||
# they're assigned.
|
||||
#
|
||||
# We only ask for this commitment from people who are employed full-time to
|
||||
# work on this project. We gratefully welcome reviews from other contributors,
|
||||
# but we don't believe it's fair to ask volunteers to respond quickly.
|
||||
|
||||
# If none of the later patterns match, assign to anyone. This team is the
|
||||
# parent of all the other teams and automatically includes everyone on those
|
||||
# teams.
|
||||
* @loganek @lum1n0us @no1wudi @TianlongLiang @wenyongh @xujuntwt95329 @yamt
|
||||
|
||||
# Some parts of the project require more specialized knowledge. In those areas
|
||||
# we designate smaller groups who are more likely to be aware of who's working
|
||||
# in specific areas.
|
|
@ -19,7 +19,7 @@ Code changes
|
|||
We Use Github Flow, So All Code Changes Happen Through Pull Requests. Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:
|
||||
|
||||
- If you've added code that should be tested, add tests. Ensure the test suite passes.
|
||||
- Avoid use macros for different platforms. Use separate folder of source files to host different platform logic.
|
||||
- Avoid use macros for different platforms. Use seperate folder of source files to host diffeent platform logic.
|
||||
- Put macro definitions inside share_lib/include/config.h if you have to use macro.
|
||||
- Make sure your code lints and compliant to our coding style.
|
||||
- Extend the application library is highly welcome.
|
||||
|
@ -27,7 +27,7 @@ We Use Github Flow, So All Code Changes Happen Through Pull Requests. Pull reque
|
|||
Coding Style
|
||||
===============================
|
||||
Please use [K&R](https://en.wikipedia.org/wiki/Indentation_style#K.26R) coding style, such as 4 spaces for indentation rather than tabs etc.
|
||||
We suggest using VS Code like IDE or stable coding format tools, like clang-format, to make your code compliant to the customized format(in .clang-format).
|
||||
We suggest use Eclipse like IDE or stable coding format tools to make your code compliant to K&R format.
|
||||
|
||||
Report bugs
|
||||
===================
|
||||
|
|
21
Dockerfile
Normal file
21
Dockerfile
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Currently supports clang-8 compiler
|
||||
# Using the "test.c" app from the README.md:
|
||||
# clang-8 --target=wasm32 -O3 -Wl,--initial-memory=131072,--allow-undefined,--export=main,--no-threads,--strip-all,--no-entry -nostdlib -o test.wasm test.c
|
||||
# Pay attention to spacing above! ^
|
||||
# iwasm test.wasm
|
||||
|
||||
FROM ubuntu:latest
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get -y upgrade && \
|
||||
apt-get install -y build-essential clang-8 cmake g++-multilib git lib32gcc-5-dev llvm-8 lld-8 nano
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
RUN git clone https://github.com/intel/wasm-micro-runtime
|
||||
|
||||
RUN cd wasm-micro-runtime/core/iwasm/products/linux/ && mkdir build && \
|
||||
cd build && cmake .. && make
|
||||
|
||||
RUN cd /usr/bin && ln -s wasm-ld-8 wasm-ld
|
||||
RUN cd /usr/bin && ln -s ~/wasm-micro-runtime/core/iwasm/products/linux/build/iwasm iwasm
|
239
README.md
239
README.md
|
@ -1,107 +1,159 @@
|
|||
# WebAssembly Micro Runtime
|
||||
|
||||
WebAssembly Micro Runtime
|
||||
=========================
|
||||
|
||||
**A [Bytecode Alliance][BA] project**
|
||||
|
||||
[BA]: https://bytecodealliance.org/
|
||||
|
||||
**[Guide](https://wamr.gitbook.io/)**  **[Website](https://bytecodealliance.github.io/wamr.dev)**  **[Chat](https://bytecodealliance.zulipchat.com/#narrow/stream/290350-wamr)**
|
||||
|
||||
[Build WAMR](./doc/build_wamr.md) | [Build AOT Compiler](./wamr-compiler/README.md) | [Embed WAMR](./doc/embed_wamr.md) | [Export Native API](./doc/export_native_api.md) | [Build Wasm Apps](./doc/build_wasm_app.md) | [Samples](./samples/README.md)
|
||||
|
||||
WebAssembly Micro Runtime (WAMR) is a lightweight standalone WebAssembly (Wasm) runtime with small footprint, high performance and highly configurable features for applications cross from embedded, IoT, edge to Trusted Execution Environment (TEE), smart contract, cloud native and so on. It includes a few parts as below:
|
||||
- [**VMcore**](./core/iwasm/): A set of runtime libraries for loading and running Wasm modules. It supports rich running modes including interpreter, Ahead-of-Time compilation(AoT) and Just-in-Time compilation (JIT). WAMR supports two JIT tiers - Fast JIT, LLVM JIT, and dynamic tier-up from Fast JIT to LLVM JIT.
|
||||
- [**iwasm**](./product-mini/): The executable binary built with WAMR VMcore which supports WASI and command line interface.
|
||||
- [**wamrc**](./wamr-compiler/): The AOT compiler to compile Wasm file into AOT file
|
||||
- Useful components and tools for building real solutions with WAMR vmcore:
|
||||
- [App-framework](https://github.com/bytecodealliance/wamr-app-framework/blob/main/app-framework/README.md): A framework for supporting APIs for the Wasm applications
|
||||
- [App-manager](https://github.com/bytecodealliance/wamr-app-framework/blob/main/app-mgr/README.md): A framework for dynamical loading the Wasm module remotely
|
||||
- [WAMR-IDE](./test-tools/wamr-ide): An experimental VSCode extension for developping WebAssembly applications with C/C++
|
||||
WebAssembly Micro Runtime (WAMR) is a standalone WebAssembly (WASM) runtime with small footprint. It includes a few parts as below:
|
||||
- A WebAssembly VM core (namely iwasm)
|
||||
- The supporting API's for the WASM applications
|
||||
- A mechanism for dynamic management of the WASM application
|
||||
|
||||
|
||||
### Key features
|
||||
- Full compliant to the W3C Wasm MVP
|
||||
- Small runtime binary size (core vmlib on cortex-m4f with tail-call/bulk memory/shared memory support, text size from bloaty)
|
||||
* ~58.9K for fast interpreter
|
||||
* ~56.3K for classic interpreter
|
||||
* ~29.4K for aot runtime
|
||||
* ~21.4K for libc-wasi library
|
||||
* ~3.7K for libc-builtin library
|
||||
- Near to native speed by AOT and JIT
|
||||
- Self-implemented AOT module loader to enable AOT working on Linux, Windows, MacOS, Android, SGX and MCU systems
|
||||
- Choices of Wasm application libc support: the built-in libc subset for the embedded environment or [WASI](https://github.com/WebAssembly/WASI) for the standard libc
|
||||
- [The simple C APIs to embed WAMR into host environment](./doc/embed_wamr.md), see [how to integrate WAMR](./doc/embed_wamr.md) and the [API list](./core/iwasm/include/wasm_export.h)
|
||||
- [The mechanism to export native APIs to Wasm applications](./doc/export_native_api.md), see [how to register native APIs](./doc/export_native_api.md)
|
||||
- [Multiple modules as dependencies](./doc/multi_module.md), ref to [document](./doc/multi_module.md) and [sample](samples/multi-module)
|
||||
- [Multi-thread, pthread APIs and thread management](./doc/pthread_library.md), ref to [document](./doc/pthread_library.md) and [sample](samples/multi-thread)
|
||||
- [wasi-threads](./doc/pthread_impls.md#wasi-threads-new), ref to [document](./doc/pthread_impls.md#wasi-threads-new) and [sample](samples/wasi-threads)
|
||||
- [Linux SGX (Intel Software Guard Extension) support](./doc/linux_sgx.md), ref to [document](./doc/linux_sgx.md)
|
||||
- [Source debugging support](./doc/source_debugging.md), ref to [document](./doc/source_debugging.md)
|
||||
- [XIP (Execution In Place) support](./doc/xip.md), ref to [document](./doc/xip.md)
|
||||
- [Berkeley/Posix Socket support](./doc/socket_api.md), ref to [document](./doc/socket_api.md) and [sample](./samples/socket-api)
|
||||
- [Multi-tier JIT](./product-mini#linux) and [Running mode control](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/)
|
||||
- Language bindings: [Go](./language-bindings/go/README.md), [Python](./language-bindings/python/README.md), [Rust](./language-bindings/rust/README.md)
|
||||
Current Features of WAMR
|
||||
=========================
|
||||
- WASM interpreter (AOT is planned)
|
||||
- Provides embedding C API
|
||||
- Provides a mechanism for exporting native API's to WASM applications
|
||||
- Supports libc for WASM applications in two modes: the built-in libc subset for embedded environment and [WASI](https://github.com/WebAssembly/WASI) for standard libc
|
||||
- The WASM application framework and asynchronized app programming model
|
||||
- Supports for micro-service and pub-sub event inter-app communication models
|
||||
- Supports remote WASM application management from either host or cloud
|
||||
- Menu configuration for easy integration of application libraries
|
||||
|
||||
### Wasm post-MVP features
|
||||
- [wasm-c-api](https://github.com/WebAssembly/wasm-c-api), ref to [document](doc/wasm_c_api.md) and [sample](samples/wasm-c-api)
|
||||
- [128-bit SIMD](https://github.com/WebAssembly/simd), ref to [samples/workload](samples/workload)
|
||||
- [Reference Types](https://github.com/WebAssembly/reference-types), ref to [document](doc/ref_types.md) and [sample](samples/ref-types)
|
||||
- [Bulk memory operations](https://github.com/WebAssembly/bulk-memory-operations), [Shared memory](https://github.com/WebAssembly/threads/blob/main/proposals/threads/Overview.md#shared-linear-memory), [Memory64](https://github.com/WebAssembly/memory64)
|
||||
- [Tail-call](https://github.com/WebAssembly/tail-call), [Garbage Collection](https://github.com/WebAssembly/gc), [Exception Handling](https://github.com/WebAssembly/exception-handling)
|
||||
Application framework architecture
|
||||
===================================
|
||||
|
||||
### Supported architectures and platforms
|
||||
The WAMR VMcore supports the following architectures:
|
||||
- X86-64, X86-32
|
||||
- ARM, THUMB (ARMV7 Cortex-M7 and Cortex-A15 are tested)
|
||||
- AArch64 (Cortex-A57 and Cortex-A53 are tested)
|
||||
- RISCV64, RISCV32 (RISC-V LP64 and RISC-V LP64D are tested)
|
||||
- XTENSA, MIPS, ARC
|
||||
By using the iwasm VM core, we are flexible to build different application frameworks for the specific domains.
|
||||
|
||||
The following platforms are supported, click each link below for how to build iwasm on that platform. Refer to [WAMR porting guide](./doc/port_wamr.md) for how to port WAMR to a new platform.
|
||||
- [Linux](./product-mini/README.md#linux), [Linux SGX (Intel Software Guard Extension)](./doc/linux_sgx.md), [MacOS](./product-mini/README.md#macos), [Android](./product-mini/README.md#android), [Windows](./product-mini/README.md#windows), [Windows (MinGW, MSVC)](./product-mini/README.md#mingw)
|
||||
- [Zephyr](./product-mini/README.md#zephyr), [AliOS-Things](./product-mini/README.md#alios-things), [VxWorks](./product-mini/README.md#vxworks), [NuttX](./product-mini/README.md#nuttx), [RT-Thread](./product-mini/README.md#RT-Thread), [ESP-IDF(FreeRTOS)](./product-mini/README.md#esp-idf)
|
||||
The WAMR has offered a comprehensive application framework for device and IoT usages. The framework solves many common requirements for building a real project:
|
||||
- Modular design for more language runtimes support
|
||||
- Inter application communication
|
||||
- Remote application management
|
||||
- WASM APP programming model and API extension mechanism
|
||||
|
||||
<img src="./doc/pics/wamr-arch.JPG" width="80%">
|
||||
|
||||
|
||||
## Getting started
|
||||
- [Build VM core](./doc/build_wamr.md) and [Build wamrc AOT compiler](./wamr-compiler/README.md)
|
||||
- [Build iwasm (mini product)](./product-mini/README.md): [Linux](./product-mini/README.md#linux), [SGX](./doc/linux_sgx.md), [MacOS](./product-mini/README.md#macos) and [Windows](./product-mini/README.md#windows)
|
||||
- [Embed into C/C++](./doc/embed_wamr.md), [Embed into Python](./language-bindings/python), [Embed into Go](./language-bindings/go), [Embed in Rust](./language-bindings/rust)
|
||||
- [Register native APIs for Wasm applications](./doc/export_native_api.md)
|
||||
- [Build wamrc AOT compiler](./wamr-compiler/README.md)
|
||||
- [Build Wasm applications](./doc/build_wasm_app.md)
|
||||
- [Port WAMR to a new platform](./doc/port_wamr.md)
|
||||
- [VS Code development container](./doc/devcontainer.md)
|
||||
- [Samples](./samples) and [Benchmarks](./tests/benchmarks)
|
||||
- [End-user APIs documentation](https://bytecodealliance.github.io/wamr.dev/apis/)
|
||||
|
||||
Build WAMR
|
||||
==========
|
||||
|
||||
## Build WAMR VM core
|
||||
|
||||
|
||||
### Performance and memory
|
||||
- [Blog: The WAMR memory model](https://bytecodealliance.github.io/wamr.dev/blog/the-wamr-memory-model/)
|
||||
- [Blog: Understand WAMR heaps](https://bytecodealliance.github.io/wamr.dev/blog/understand-the-wamr-heaps/) and [stacks](https://bytecodealliance.github.io/wamr.dev/blog/understand-the-wamr-stacks/)
|
||||
- [Blog: Introduction to WAMR running modes](https://bytecodealliance.github.io/wamr.dev/blog/introduction-to-wamr-running-modes/)
|
||||
- [Memory usage tuning](./doc/memory_tune.md): the memory model and how to tune the memory usage
|
||||
- [Memory usage profiling](./doc/build_wamr.md#enable-memory-profiling-experiment): how to profile the memory usage
|
||||
- [Performance tuning](./doc/perf_tune.md): how to tune the performance
|
||||
- [Benchmarks](./tests/benchmarks): checkout these links for how to run the benchmarks: [PolyBench](./tests/benchmarks/polybench), [CoreMark](./tests/benchmarks/coremark), [Sightglass](./tests/benchmarks/sightglass), [JetStream2](./tests/benchmarks/jetstream)
|
||||
- [Performance and footprint data](https://github.com/bytecodealliance/wasm-micro-runtime/wiki/Performance): the performance and footprint data
|
||||
WAMR VM core (iwasm) can support building for different target platforms:
|
||||
- Linux
|
||||
- Zephyr
|
||||
- MacOS
|
||||
- VxWorks
|
||||
- AliOS-Things
|
||||
- Intel Software Guard Extention (SGX)
|
||||
|
||||
See [Build WAMR VM core](./doc/build_wamr.md) for the detailed instructions.
|
||||
|
||||
## Libc building options
|
||||
|
||||
WAMR supports WASI for standard libc library as well as a [built-in libc subset](./doc/wamr_api.md) for tiny footprint.
|
||||
|
||||
WASI is supported for following platforms and enabled by default building:
|
||||
- Linux
|
||||
|
||||
|
||||
Project Technical Steering Committee
|
||||
====================================
|
||||
The [WAMR PTSC Charter](./TSC_Charter.md) governs the operations of the project TSC.
|
||||
The current TSC members:
|
||||
- [dongsheng28849455](https://github.com/dongsheng28849455) - **Dongsheng Yan**, <dongsheng.yan@sony.com>
|
||||
- [loganek](https://github.com/loganek) - **Marcin Kolny**, <mkolny@amazon.co.uk>
|
||||
- [lum1n0us](https://github.com/lum1n0us) - **Liang He**, <liang.he@intel.com>
|
||||
- [no1wudi](https://github.com/no1wudi) **Qi Huang**, <huangqi3@xiaomi.com>
|
||||
- [qinxk-inter](https://github.com/qinxk-inter) - **Xiaokang Qin**, <xiaokang.qxk@antgroup.com>
|
||||
- [ttrenner ](https://github.com/ttrenner) - **Trenner, Thomas**, <trenner.thomas@siemens.com>
|
||||
- [wei-tang](https://github.com/wei-tang) - **Wei Tang**, <tangwei.tang@antgroup.com>
|
||||
- [wenyongh](https://github.com/wenyongh) - **Wenyong Huang**, <wenyong.huang@intel.com>
|
||||
- [woodsmc](https://github.com/woodsmc) - **Woods, Chris**, <chris.woods@siemens.com>
|
||||
- [xujuntwt95329](https://github.com/xujuntwt95329) - **Jun Xu**, <Jun1.Xu@intel.com>
|
||||
- [xwang98](https://github.com/xwang98) - **Xin Wang**, <xin.wang@intel.com> (chair)
|
||||
- [yamt](https://github.com/yamt) - **Takashi Yamamoto**, <yamamoto@midokura.com>
|
||||
|
||||
## Embed WAMR VM core
|
||||
|
||||
WAMR can be built into a standalone executable which takes the WASM application file name as input, and then executes it. In some other situations, the WAMR source code is embedded the product code and built into the final product.
|
||||
|
||||
WAMR provides a set of C API for loading the WASM module, instantiating the module and invoking a WASM function from a native call. See [Embed WAMR VM core](./doc/embed_wamr.md) for the details.
|
||||
|
||||
The WAMR application framework supports dynamically installing WASM application remotely by embedding the WAMR VM core. It can be used as reference for how to use the embedding API's.
|
||||
|
||||
|
||||
## Integrate WAMR application library
|
||||
|
||||
The WAMR provides an application framework which supports event driven programming model as below:
|
||||
|
||||
- Single thread per WASM app instance
|
||||
- App must implement system callbacks: on_init, on_destroy
|
||||
|
||||
Application programming API sets are available as below:
|
||||
|
||||
- Timer
|
||||
- Micro service (Request/Response) and Pub/Sub inter-app communication
|
||||
- Sensor
|
||||
- Connectivity and data transmission
|
||||
- 2D graphic UI (based on littlevgl)
|
||||
|
||||
See [WAMR application library](./doc/wamr_api.md) for the details.
|
||||
|
||||
One WAMR build can select a subset from the WAMR application library. Refer to the sample "simple" for how to integrate API sets into WAMR building.
|
||||
|
||||
|
||||
|
||||
## Build WAMR with customized application library
|
||||
|
||||
When WAMR is integrated into a specific project, it probably includes additional project specific applications APIs which can be either expansion or modification to the standard WAMR application library.
|
||||
|
||||
The extended application library should be created in the folder [core/iwasm/lib/app-libs](./core/iwasm/lib/app-libs/). See the [doc/export_native_api.md](./doc/export_native_api.md) for the details.
|
||||
|
||||
|
||||
|
||||
# Create WASM application SDK
|
||||
|
||||
When a customized WAMR runtime is shipped with the products, an associated WASM application SDK should be distributed to the application developers in order to develop WASM applications for the product. At the most time, the WASM application SDK should match the version of the runtime distribution.
|
||||
|
||||
|
||||
Typically a WASM APP SDK package contains following components:
|
||||
|
||||
* **WASI-SDK**: only needed when WASI is enabled in the runtime. It can be a link to the WASI-SDK GitHub or the full offline copy.
|
||||
* **sysroot** folder: only needed when WASI is not enabled in the runtime. copied from [test-tools/toolchain/sysroot](./test-tools/toolchain/sysroot)
|
||||
* **app-lib** folder: copied from [core/iwasm/lib/app-libs](./core/iwasm/lib/app-libs/)
|
||||
* **cmake toolchain** file: copied from [test-tools/toolchain/wamr_toolchain.cmake](./test-tools/toolchain/wamr_toolchain.cmake)
|
||||
* optionally with some guide documents and samples
|
||||
|
||||
|
||||
|
||||
Build WASM applications
|
||||
===================================
|
||||
|
||||
WebAssembly as a new binary instruction can be viewed as a virtual architecture. If the WASM application is developed in C/C++ language, developers can use conventional cross-compilation procedure to build the WASM application. cmake is the recommended building tool and Clang is the preferred compiler. While emcc may still work but it is not guaranteed.
|
||||
|
||||
Refer to [Build WASM applications](doc/build_wasm_app.md) for details.
|
||||
|
||||
|
||||
Samples and demos
|
||||
=================
|
||||
|
||||
The WAMR samples are located in folder [./samples](./samples). A sample usually contains the WAMR runtime build, WASM applications and test tools. The WARM provides following samples:
|
||||
- [Simple](./samples/simple/README.md): The runtime is integrated with most of the WAMR APP libaries and multiple WASM applications are provided for using different WASM API set.
|
||||
- [littlevgl](./samples/littlevgl/README.md): Demostrating the graphic user interface application usage on WAMR. The whole [LittlevGL](https://github.com/littlevgl/) 2D user graphic library and the UI application is built into WASM application.
|
||||
- [gui](./samples/gui/README.md): Moved the [LittlevGL](https://github.com/littlevgl/) library into the runtime and defined a WASM application interface by wrapping the littlevgl API.
|
||||
- [IoT-APP-Store-Demo](./test-tools/IoT-APP-Store-Demo/README.md): A web site for demostrating a WASM APP store usage where we can remotely install and uninstall WASM application on remote devices.
|
||||
|
||||
|
||||
The graphic user interface demo photo:
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
Releases and acknowledgments
|
||||
============================
|
||||
|
||||
WAMR is a community efforts. Since Intel Corp contributed the first release of this open source project, this project has received many good contributions from the community.
|
||||
|
||||
See the [major features releasing history and contributor names](./doc/release_ack.md)
|
||||
|
||||
|
||||
Roadmap
|
||||
=======
|
||||
|
||||
See the [roadmap](./doc/roadmap.md) to understand what major features are planned or under development.
|
||||
|
||||
Please submit issues for any new feature request, or your plan for contributing new features.
|
||||
|
||||
|
||||
License
|
||||
|
@ -111,9 +163,10 @@ exception. See the LICENSE file for details. This license allows you to freely
|
|||
use, modify, distribute and sell your own products based on WAMR.
|
||||
Any contributions you make will be under the same license.
|
||||
|
||||
# More resources
|
||||
- [Who use WAMR?](https://github.com/bytecodealliance/wasm-micro-runtime/wiki)
|
||||
- [WAMR Blogs](https://bytecodealliance.github.io/wamr.dev/blog/)
|
||||
- [Community news and events](https://bytecodealliance.github.io/wamr.dev/events/)
|
||||
- [WAMR TSC meetings](https://github.com/bytecodealliance/wasm-micro-runtime/wiki/TSC-meeting-notes)
|
||||
|
||||
Submit issues and contact the maintainers
|
||||
=========================================
|
||||
[Click here to submit. Your feedback is always welcome!](https://github.com/intel/wasm-micro-runtime/issues/new)
|
||||
|
||||
|
||||
Contact the maintainers: imrt-public@intel.com
|
||||
|
|
1554
RELEASE_NOTES.md
1554
RELEASE_NOTES.md
File diff suppressed because it is too large
Load Diff
23
SConscript
23
SConscript
|
@ -1,23 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2021, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
# for module compiling
|
||||
import os
|
||||
|
||||
from building import *
|
||||
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
list = os.listdir(cwd)
|
||||
|
||||
if GetDepend(['PKG_USING_WAMR']):
|
||||
wamr_entry_sconscript = os.path.join(cwd, "product-mini", "platforms", "rt-thread", 'SConscript')
|
||||
wamr_runlib_sconscript = os.path.join(cwd, "build-scripts", 'SConscript')
|
||||
|
||||
objs = objs + SConscript(wamr_entry_sconscript)
|
||||
objs = objs + SConscript(wamr_runlib_sconscript)
|
||||
|
||||
Return('objs')
|
28
SECURITY.md
28
SECURITY.md
|
@ -1,3 +1,29 @@
|
|||
# Security Policy
|
||||
|
||||
Please refer to the [Bytecode Alliance security policy](https://bytecodealliance.org/security) for details on how to report security issues in WebAssembly Micro Runtime, our disclosure policy, and how to receive notifications about security issues.
|
||||
Building secure foundations for software development is at the core of what we do in the Bytecode Alliance. Contributions of external security researchers are a vital part of that.
|
||||
|
||||
## Scope
|
||||
|
||||
If you believe you've found a security issue in any website, service, or software owned or operated by the Bytecode Alliance, we encourage you to notify us.
|
||||
|
||||
## How to Submit a Report
|
||||
|
||||
To submit a vulnerability report to the Bytecode Alliance, please contact us at [security@bytecodealliance.org](mailto:security@bytecodealliance.org). Your submission will be reviewed and validated by a member of our security team.
|
||||
|
||||
## Safe Harbor
|
||||
|
||||
The Bytecode Alliance supports safe harbor for security researchers who:
|
||||
|
||||
* Make a good faith effort to avoid privacy violations, destruction of data, and interruption or degradation of our services.
|
||||
* Only interact with accounts you own or with explicit permission of the account holder. If you do encounter Personally Identifiable Information (PII) contact us immediately, do not proceed with access, and immediately purge any local information.
|
||||
* Provide us with a reasonable amount of time to resolve vulnerabilities prior to any disclosure to the public or a third-party.
|
||||
|
||||
We will consider activities conducted consistent with this policy to constitute "authorized" conduct and will not pursue civil action or initiate a complaint to law enforcement. We will help to the extent we can if legal action is initiated by a third party against you.
|
||||
|
||||
Please submit a report to us before engaging in conduct that may be inconsistent with or unaddressed by this policy.
|
||||
|
||||
## Preferences
|
||||
|
||||
* Please provide detailed reports with reproducible steps and a clearly defined impact.
|
||||
* Submit one vulnerability per report.
|
||||
* Social engineering (e.g. phishing, vishing, smishing) is prohibited.
|
||||
|
|
168
TSC_Charter.md
168
TSC_Charter.md
|
@ -1,168 +0,0 @@
|
|||
# Project Technical Steering Committee (PTSC) Charter
|
||||
|
||||
## Section 1. Guiding Principle
|
||||
|
||||
The WebAssembly Micro Runtime (WAMR) project is part of the
|
||||
Bytecode Alliance (BA) which operates transparently, openly,
|
||||
collaboratively, and ethically. Project proposals, timelines, and status
|
||||
must not merely be open, but also easily visible to outsiders.
|
||||
|
||||
## Section 2. Project Governance under Bytecode Alliance
|
||||
|
||||
Technical leadership for the WAMR projects within the Bytecode Alliance
|
||||
is delegated to the projects through the project charter. Though the BA TSC
|
||||
will not interfere with day-to-day discussions, votes or meetings of the PTSC,
|
||||
the BA TSC may request additional amendments to the PTSC charter when
|
||||
there is misalignment between the project charter and the BA mission and values.
|
||||
|
||||
|
||||
|
||||
The PTSC structure described in this document may be overhauled as part of
|
||||
establishing a BA TSC in order to adhere to constraints or requirements that
|
||||
TSC will impose on project-level governance.
|
||||
|
||||
## Section 3. Establishment of the PTSC
|
||||
|
||||
PTSC memberships are not time-limited. There is no maximum size of the PTSC.
|
||||
The size is expected to vary in order to ensure adequate coverage of important
|
||||
areas of expertise, balanced with the ability to make decisions efficiently.
|
||||
The PTSC must have at least four members.
|
||||
|
||||
There is no specific set of requirements or qualifications for PTSC
|
||||
membership beyond these rules. The PTSC may add additional members to the
|
||||
PTSC by a standard PTSC motion and vote. A PTSC member may be removed from the
|
||||
PTSC by voluntary resignation, by a standard PTSC motion, or in accordance to the
|
||||
participation rules described below.
|
||||
|
||||
Changes to PTSC membership should be posted in the agenda, and may be suggested
|
||||
as any other agenda item.
|
||||
|
||||
The PTSC may, at its discretion, invite any number of non-voting observers to
|
||||
participate in the public portion of PTSC discussions and meetings.
|
||||
|
||||
The PTSC shall meet regularly using tools that enable participation by the
|
||||
community (e.g. weekly on a Zulip channel, or through any other
|
||||
appropriate means selected by the PTSC ). The meeting shall be directed by
|
||||
the PTSC Chairperson. Responsibility for directing individual meetings may be
|
||||
delegated by the PTSC Chairperson to any other PTSC member. Minutes or an
|
||||
appropriate recording shall be taken and made available to the community
|
||||
through accessible public postings.
|
||||
|
||||
PTSC members are expected to regularly participate in PTSC activities.
|
||||
|
||||
In the case where an individual PTSC member -- within any three month period --
|
||||
attends fewer than 25% of the regularly scheduled meetings, does not
|
||||
participate in PTSC discussions, *and* does not participate in PTSC votes, the
|
||||
member shall be automatically removed from the PTSC. The member may be invited
|
||||
to continue attending PTSC meetings as an observer.
|
||||
|
||||
## Section 4. Responsibilities of the PTSC
|
||||
|
||||
Subject to such policies as may be set by the BA TSC, the WAMR PTSC is
|
||||
responsible for all technical development within the WAMR project,
|
||||
including:
|
||||
|
||||
* Setting release dates.
|
||||
* Release quality standards.
|
||||
* Technical direction.
|
||||
* Project governance and process.
|
||||
* GitHub repository hosting.
|
||||
* Conduct guidelines.
|
||||
* Maintaining the list of additional Collaborators.
|
||||
* Development process and any coding standards.
|
||||
* Mediating technical conflicts between Collaborators or Foundation
|
||||
projects.
|
||||
|
||||
The PTSC will define WAMR project’s release vehicles.
|
||||
|
||||
## Section 5. WAMR Project Operations
|
||||
|
||||
The PTSC will establish and maintain a development process for the WAMR
|
||||
project. The development process will establish guidelines
|
||||
for how the developers and community will operate. It will, for example,
|
||||
establish appropriate timelines for PTSC review (e.g. agenda items must be
|
||||
published at least a certain number of hours in advance of a PTSC
|
||||
meeting).
|
||||
|
||||
The PTSC and entire technical community will follow any processes as may
|
||||
be specified by the Bytecode Alliance Board relating to the intake and license compliance
|
||||
review of contributions, including the Bytecode Alliance IP Policy.
|
||||
|
||||
## Section 6. Elections
|
||||
|
||||
Leadership roles in the WAMR project will be peer elected
|
||||
representatives of the community.
|
||||
|
||||
For election of persons (such as the PTSC Chairperson), a multiple-candidate
|
||||
method should be used, such as:
|
||||
|
||||
* [Condorcet][] or
|
||||
* [Single Transferable Vote][]
|
||||
|
||||
Multiple-candidate methods may be reduced to simple election by plurality
|
||||
when there are only two candidates for one position to be filled. No
|
||||
election is required if there is only one candidate and no objections to
|
||||
the candidate's election. Elections shall be done within the projects by
|
||||
the Collaborators active in the project.
|
||||
|
||||
The PTSC will elect from amongst voting PTSC members a PTSC Chairperson to
|
||||
work on building an agenda for PTSC meetings. The PTSC shall hold annual
|
||||
|
||||
elections to select a PTSC Chairperson; there are no limits on the number
|
||||
of terms a PTSC Chairperson may serve.
|
||||
|
||||
## Section 7. Voting
|
||||
|
||||
For internal project decisions, Collaborators shall operate under Lazy
|
||||
Consensus. The PTSC shall establish appropriate guidelines for
|
||||
implementing Lazy Consensus (e.g. expected notification and review time
|
||||
periods) within the development process.
|
||||
|
||||
The PTSC follows a [Consensus Seeking][] decision making model. When an agenda
|
||||
item has appeared to reach a consensus the moderator will ask "Does anyone
|
||||
object?" as a final call for dissent from the consensus.
|
||||
|
||||
If an agenda item cannot reach a consensus a PTSC member can call for
|
||||
either a closing vote or a vote to table the issue to the next meeting.
|
||||
The call for a vote must be seconded by a majority of the PTSC or else the
|
||||
discussion will continue.
|
||||
|
||||
For all votes, a simple majority of all PTSC members for, or against, the issue
|
||||
wins. A PTSC member may choose to participate in any vote through abstention.
|
||||
|
||||
## Section 8. Project Roles
|
||||
|
||||
The WAMR git repository is maintained by the PTSC and
|
||||
additional Collaborators who are added by the PTSC on an ongoing basis.
|
||||
|
||||
Individuals making significant and valuable contributions,
|
||||
“Contributor(s)”, are made Collaborators and given commit-access to the
|
||||
project. These individuals are identified by the PTSC and their addition
|
||||
as Collaborators is discussed during a PTSC meeting. Modifications of the
|
||||
contents of the git repository are made on a collaborative basis as defined in
|
||||
the development process.
|
||||
|
||||
Collaborators may opt to elevate significant or controversial
|
||||
modifications, or modifications that have not found consensus to the PTSC
|
||||
for discussion by assigning the `tsc-agenda` tag to a pull request or
|
||||
issue. The PTSC should serve as the final arbiter where required. The PTSC
|
||||
will maintain and publish a list of current Collaborators, as
|
||||
well as a development process guide for Collaborators and Contributors
|
||||
looking to participate in the development effort.
|
||||
|
||||
## Section 9. Definitions
|
||||
|
||||
* **Contributors**: contribute code or other artifacts, but do not have
|
||||
the right to commit to the code base. Contributors work with the
|
||||
project’s Collaborators to have code committed to the code base. A
|
||||
Contributor may be promoted to a Collaborator by the PTSC. Contributors should
|
||||
rarely be encumbered by the PTSC.
|
||||
|
||||
* **Project**: a technical collaboration effort, e.g. a subsystem, that
|
||||
is organized through the project creation process and approved by the
|
||||
PTSC.
|
||||
|
||||
[Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
|
||||
[Condorcet]: https://en.wikipedia.org/wiki/Condorcet_method
|
||||
[Single Transferable Vote]: https://en.wikipedia.org/wiki/Single_transferable_vote
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2021, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import os
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
objs = []
|
||||
|
||||
WAMR_ROOT_DIR = os.path.join(cwd, "..")
|
||||
SHARED_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'shared')
|
||||
IWASM_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'iwasm')
|
||||
DEPS_DIR = os.path.join(WAMR_ROOT_DIR, 'core', 'deps')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_INTERP']):
|
||||
script_path = os.path.join(IWASM_DIR, 'interpreter', 'SConscript')
|
||||
objs += SConscript(script_path)
|
||||
|
||||
if GetDepend(['WAMR_BUILD_AOT']):
|
||||
script_path = os.path.join(IWASM_DIR, 'aot', 'SConscript')
|
||||
objs += SConscript(script_path)
|
||||
if GetDepend(['WAMR_BUILD_JIT']):
|
||||
script_path = os.path.join(IWASM_DIR, 'compilation', 'SConscript')
|
||||
objs += SConscript(script_path)
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_BUILTIN']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-builtin', 'SConscript'))
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_WASI']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-wasi', 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'common', 'posix', 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'common', 'libc-util', 'SConscript'))
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIB_PTHREAD']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'lib-pthread', 'SConscript'))
|
||||
|
||||
if GetDepend(['WAMR_BUILD_THREAD_MGR']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'thread-mgr', 'SConscript'))
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_EMCC']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'libc-emmc', 'SConscript'))
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIB_WASI_THREADS']):
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'libraries', 'lib-wasi-threads', 'SConscript'))
|
||||
|
||||
objs += SConscript(os.path.join(cwd, 'SConscript_config'));
|
||||
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'platform', 'rt-thread', 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'mem-alloc', 'SConscript'))
|
||||
objs += SConscript(os.path.join(IWASM_DIR, 'common', 'SConscript'))
|
||||
objs += SConscript(os.path.join(SHARED_DIR, 'utils', 'SConscript'))
|
||||
|
||||
Return('objs')
|
|
@ -1,138 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2021, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from building import *
|
||||
|
||||
Import('rtconfig')
|
||||
|
||||
src = []
|
||||
objs = []
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
IWASM_INC_DIR = os.path.join(cwd, '..', 'core', 'iwasm', 'include')
|
||||
|
||||
CPPPATH = [IWASM_INC_DIR]
|
||||
|
||||
if rtconfig.BUILD == 'debug':
|
||||
CPPDEFINES = ['BH_DEBUG=1']
|
||||
else:
|
||||
CPPDEFINES = ['BH_DEBUG=0']
|
||||
|
||||
if rtconfig.ARCH == 'arm':
|
||||
if re.match('^cortex-m.*', rtconfig.CPU):
|
||||
print('[WAMR] using thumbv4t')
|
||||
CPPDEFINES += ['BUILD_TARGET_THUMB']
|
||||
CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_THUMB']
|
||||
elif re.match('^cortex-a.*', rtconfig.CPU):
|
||||
print('[WAMR] using armv7')
|
||||
CPPDEFINES += ['BUILD_TARGET_ARM']
|
||||
CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV7']
|
||||
elif re.match('^cortex-r.*', rtconfig.CPU):
|
||||
print('[WAMR] using armv7')
|
||||
CPPDEFINES += ['BUILD_TARGET_ARM']
|
||||
CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV7']
|
||||
elif rtconfig.CPU == 'armv6':
|
||||
print('[WAMR] using armv6')
|
||||
CPPDEFINES += ['BUILD_TARGET_ARM']
|
||||
CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV6']
|
||||
elif re.match('^arm9*', rtconfig.CPU):
|
||||
print('[WAMR] using armv4')
|
||||
CPPDEFINES += ['BUILD_TARGET_ARM']
|
||||
CPPDEFINES += ['RTT_WAMR_BUILD_TARGET_ARMV4']
|
||||
elif rtconfig.ARCH == 'ia32':
|
||||
CPPDEFINES += ['BUILD_TARGET_X86_32', 'RTT_WAMR_BUILD_TARGET_X86_32']
|
||||
else:
|
||||
print("[WAMR] unknown arch", rtconfig.ARCH)
|
||||
|
||||
if GetDepend(['WAMR_BUILD_INTERP']):
|
||||
CPPDEFINES += ['WASM_ENABLE_INTERP=1']
|
||||
if GetDepend(['WAMR_BUILD_FAST_INTERP']):
|
||||
CPPDEFINES += ['WASM_ENABLE_FAST_INTERP=1']
|
||||
print("[WAMR] fast interpreter was enabled")
|
||||
else:
|
||||
CPPDEFINES += ['WASM_ENABLE_FAST_INTERP=0']
|
||||
print("[WAMR] fast interpreter was disabled")
|
||||
else:
|
||||
CPPDEFINES += ['WASM_ENABLE_INTERP=0']
|
||||
|
||||
CPPDEFINES += ['WASM_ENABLE_JIT=0']
|
||||
|
||||
if GetDepend(['WAMR_BUILD_MULTI_MODULE']):
|
||||
CPPDEFINES += ['WASM_ENABLE_MULTI_MODULE=1']
|
||||
else:
|
||||
CPPDEFINES += ['WASM_ENABLE_MULTI_MODULE=0']
|
||||
|
||||
if GetDepend(['WAMR_BUILD_SPEC_TEST']):
|
||||
CPPDEFINES += ['WASM_ENABLE_SPEC_TEST=1']
|
||||
print("[WAMR] spec test compatible mode was enabled")
|
||||
|
||||
if GetDepend(['WAMR_BUILD_BULK_MEMORY']):
|
||||
CPPDEFINES += ['WASM_ENABLE_BULK_MEMORY=1']
|
||||
print("[WAMR] Bulk memory feature was enabled")
|
||||
else:
|
||||
CPPDEFINES += ['WASM_ENABLE_BULK_MEMORY=0']
|
||||
|
||||
if GetDepend(['WAMR_BUILD_SHARED_MEMORY']):
|
||||
CPPDEFINES += ['WASM_ENABLE_SHARED_MEMORY=1']
|
||||
print("[WAMR] Shared memory enabled")
|
||||
else:
|
||||
CPPDEFINES += ['WASM_ENABLE_SHARED_MEMORY=0']
|
||||
|
||||
if GetDepend(['WAMR_BUILD_MINI_LOADER']):
|
||||
CPPDEFINES += ['WASM_ENABLE_MINI_LOADER=1']
|
||||
print("[WAMR] mini loader enabled")
|
||||
else:
|
||||
CPPDEFINES += ['WASM_ENABLE_MINI_LOADER=0']
|
||||
|
||||
if GetDepend(['WAMR_DISABLE_HW_BOUND_CHECK']):
|
||||
CPPDEFINES += ['WASM_DISABLE_HW_BOUND_CHECK=1']
|
||||
CPPDEFINES += ['WASM_DISABLE_STACK_HW_BOUND_CHECK=1']
|
||||
print("[WAMR] Hardware boundary check disabled")
|
||||
|
||||
if GetDepend(['WAMR_BUILD_SIMD']):
|
||||
CPPDEFINES += ['WASM_ENABLE_SIMD=1']
|
||||
print('[WAMR] SIMD enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_MEMORY_PROFILING']):
|
||||
CPPDEFINES += ['WASM_ENABLE_MEMORY_PROFILING=1']
|
||||
print('[WAMR] Memory profiling enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_CUSTOM_NAME_SECTION']):
|
||||
CPPDEFINES += ['WASM_ENABLE_CUSTOM_NAME_SECTION=1']
|
||||
print('[WAMR] Custom name section enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_TAIL_CALL']):
|
||||
CPPDEFINES += ['WASM_ENABLE_TAIL_CALL=1']
|
||||
print('[WAMR] Tail call enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_THREAD_MGR']):
|
||||
CPPDEFINES += ['WASM_ENABLE_THREAD_MGR=1']
|
||||
print('[WAMR] Thread manager enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIBC_WASI']):
|
||||
CPPDEFINES += ['WASM_ENABLE_LIBC_WASI=1']
|
||||
CPPDEFINES += ['WASM_ENABLE_MODULE_INST_CONTEXT=1']
|
||||
print('[WAMR] Libc wasi enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_LIB_WASI_THREADS']):
|
||||
CPPDEFINES += ['WASM_ENABLE_LIB_WASI_THREADS=1']
|
||||
print('[WAMR] Lib wasi threads enabled')
|
||||
|
||||
if GetDepend(['WAMR_BUILD_REF_TYPES']):
|
||||
CPPDEFINES += ['WASM_ENABLE_REF_TYPES=1']
|
||||
print('[WAMR] enable ref types')
|
||||
|
||||
CPPDEFINES += ['BH_MALLOC=wasm_runtime_malloc']
|
||||
CPPDEFINES += ['BH_FREE=wasm_runtime_free']
|
||||
|
||||
LIBS = ['m']
|
||||
|
||||
group = DefineGroup('wamr', src, depend = ['PKG_USING_WAMR'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
|
||||
|
||||
Return('group')
|
|
@ -1,353 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pathlib
|
||||
import requests
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import sysconfig
|
||||
import sys
|
||||
|
||||
|
||||
def clone_llvm(dst_dir, llvm_repo, llvm_branch):
|
||||
"""
|
||||
any error will raise CallProcessError
|
||||
"""
|
||||
llvm_dir = dst_dir.joinpath("llvm").resolve()
|
||||
|
||||
if not llvm_dir.exists():
|
||||
GIT_CLONE_CMD = f"git clone --depth 1 --branch {llvm_branch} {llvm_repo} llvm"
|
||||
print(GIT_CLONE_CMD)
|
||||
subprocess.check_output(shlex.split(GIT_CLONE_CMD), cwd=dst_dir)
|
||||
|
||||
return llvm_dir
|
||||
|
||||
|
||||
def query_llvm_version(llvm_info):
|
||||
github_token = os.environ['GH_TOKEN']
|
||||
owner_project = llvm_info['repo'].replace("https://github.com/", "").replace(".git", "")
|
||||
url = f"https://api.github.com/repos/{owner_project}/commits/{llvm_info['branch']}"
|
||||
headers = {
|
||||
'Authorization': f"Bearer {github_token}"
|
||||
}
|
||||
|
||||
try:
|
||||
response = requests.request("GET", url, headers=headers, data={})
|
||||
response.raise_for_status()
|
||||
except requests.exceptions.HTTPError as error:
|
||||
print (error) # for debugging purpose
|
||||
return None
|
||||
|
||||
response = response.json()
|
||||
return response['sha']
|
||||
|
||||
|
||||
def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_flags=''):
|
||||
LLVM_COMPILE_OPTIONS = [
|
||||
'-DCMAKE_BUILD_TYPE:STRING="Release"',
|
||||
"-DCMAKE_EXPORT_COMPILE_COMMANDS=ON",
|
||||
"-DLLVM_APPEND_VC_REV:BOOL=ON",
|
||||
"-DLLVM_BUILD_EXAMPLES:BOOL=OFF",
|
||||
"-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF",
|
||||
"-DLLVM_ENABLE_BINDINGS:BOOL=OFF",
|
||||
"-DLLVM_ENABLE_IDE:BOOL=OFF",
|
||||
"-DLLVM_ENABLE_LIBEDIT=OFF",
|
||||
"-DLLVM_ENABLE_TERMINFO:BOOL=OFF",
|
||||
"-DLLVM_ENABLE_ZLIB:BOOL=ON",
|
||||
"-DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF",
|
||||
"-DLLVM_INCLUDE_DOCS:BOOL=OFF",
|
||||
"-DLLVM_INCLUDE_EXAMPLES:BOOL=OFF",
|
||||
"-DLLVM_INCLUDE_UTILS:BOOL=OFF",
|
||||
"-DLLVM_INCLUDE_TESTS:BOOL=OFF",
|
||||
"-DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON",
|
||||
]
|
||||
|
||||
# ccache is not available on Windows
|
||||
if not "windows" == platform:
|
||||
LLVM_COMPILE_OPTIONS.append("-DLLVM_CCACHE_BUILD:BOOL=ON")
|
||||
# perf support is available on Linux only
|
||||
if "linux" == platform:
|
||||
LLVM_COMPILE_OPTIONS.append("-DLLVM_USE_PERF:BOOL=ON")
|
||||
|
||||
# use clang/clang++/lld. but macos doesn't support lld
|
||||
if not sys.platform.startswith("darwin") and use_clang:
|
||||
if shutil.which("clang") and shutil.which("clang++") and shutil.which("lld"):
|
||||
os.environ["CC"] = "clang"
|
||||
os.environ["CXX"] = "clang++"
|
||||
LLVM_COMPILE_OPTIONS.append('-DLLVM_USE_LINKER:STRING="lld"')
|
||||
print("Use the clang toolchain")
|
||||
else:
|
||||
print("Can not find clang, clang++ and lld, keep using the gcc toolchain")
|
||||
else:
|
||||
print("Use the gcc toolchain")
|
||||
|
||||
LLVM_EXTRA_COMPILE_OPTIONS = {
|
||||
"arc": [
|
||||
'-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD:STRING="ARC"',
|
||||
"-DLLVM_ENABLE_LIBICUUC:BOOL=OFF",
|
||||
"-DLLVM_ENABLE_LIBICUDATA:BOOL=OFF",
|
||||
],
|
||||
"xtensa": [
|
||||
'-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD:STRING="Xtensa"',
|
||||
],
|
||||
"windows": [
|
||||
"-DCMAKE_INSTALL_PREFIX=LLVM-install",
|
||||
],
|
||||
"default": [],
|
||||
}
|
||||
|
||||
experimental_backends = ["ARC", "Xtensa"]
|
||||
normal_backends = [s for s in backends if s not in experimental_backends]
|
||||
|
||||
LLVM_TARGETS_TO_BUILD = [
|
||||
'-DLLVM_TARGETS_TO_BUILD:STRING="' + ";".join(normal_backends) + '"'
|
||||
if normal_backends
|
||||
else '-DLLVM_TARGETS_TO_BUILD:STRING="AArch64;ARM;Mips;RISCV;X86"'
|
||||
]
|
||||
|
||||
# if not on ARC platform, but want to add expeirmental backend ARC as target
|
||||
if platform != "ARC" and "ARC" in backends:
|
||||
LLVM_TARGETS_TO_BUILD.extend(
|
||||
LLVM_EXTRA_COMPILE_OPTIONS["arc"]
|
||||
)
|
||||
|
||||
LLVM_PROJECTS_TO_BUILD = [
|
||||
'-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else ""
|
||||
]
|
||||
|
||||
# lldb project requires libxml2
|
||||
LLVM_LIBXML2_OPTION = [
|
||||
"-DLLVM_ENABLE_LIBXML2:BOOL=" + ("ON" if "lldb" in projects else "OFF")
|
||||
]
|
||||
|
||||
# enabling LLVM_INCLUDE_TOOLS will increase ~300M to the final package
|
||||
LLVM_INCLUDE_TOOLS_OPTION = [
|
||||
"-DLLVM_INCLUDE_TOOLS:BOOL=ON" if projects else "-DLLVM_INCLUDE_TOOLS:BOOL=OFF"
|
||||
]
|
||||
|
||||
if not llvm_dir.exists():
|
||||
raise Exception(f"{llvm_dir} doesn't exist")
|
||||
|
||||
build_dir = llvm_dir.joinpath("build").resolve()
|
||||
build_dir.mkdir(exist_ok=True)
|
||||
|
||||
lib_llvm_core_library = build_dir.joinpath("lib/libLLVMCore.a").resolve()
|
||||
if lib_llvm_core_library.exists():
|
||||
print(
|
||||
f"It has already been fully compiled. If want to a re-build, please remove {build_dir} manually and try again"
|
||||
)
|
||||
return None
|
||||
|
||||
compile_options = " ".join(
|
||||
LLVM_COMPILE_OPTIONS
|
||||
+ LLVM_LIBXML2_OPTION
|
||||
+ LLVM_EXTRA_COMPILE_OPTIONS.get(
|
||||
platform, LLVM_EXTRA_COMPILE_OPTIONS["default"]
|
||||
)
|
||||
+ LLVM_TARGETS_TO_BUILD
|
||||
+ LLVM_PROJECTS_TO_BUILD
|
||||
+ LLVM_INCLUDE_TOOLS_OPTION
|
||||
)
|
||||
|
||||
CONFIG_CMD = f"cmake {compile_options} {extra_flags} ../llvm"
|
||||
if "windows" == platform:
|
||||
if "mingw" in sysconfig.get_platform().lower():
|
||||
CONFIG_CMD += " -G'Unix Makefiles'"
|
||||
else:
|
||||
CONFIG_CMD += " -A x64"
|
||||
else:
|
||||
CONFIG_CMD += " -G'Ninja'"
|
||||
print(f"Config command: {CONFIG_CMD}")
|
||||
subprocess.check_call(shlex.split(CONFIG_CMD), cwd=build_dir)
|
||||
|
||||
BUILD_CMD = "cmake --build . --target package" + (
|
||||
" --config Release" if "windows" == platform else ""
|
||||
)
|
||||
if "windows" == platform:
|
||||
BUILD_CMD += " --parallel " + str(os.cpu_count())
|
||||
print(f"Build command: {BUILD_CMD}")
|
||||
subprocess.check_call(shlex.split(BUILD_CMD), cwd=build_dir)
|
||||
|
||||
return build_dir
|
||||
|
||||
|
||||
def repackage_llvm(llvm_dir):
|
||||
build_dir = llvm_dir.joinpath("./build").resolve()
|
||||
|
||||
packs = [f for f in build_dir.glob("LLVM-*.tar.gz")]
|
||||
if len(packs) > 1:
|
||||
raise Exception("Find more than one LLVM-*.tar.gz")
|
||||
|
||||
if not packs:
|
||||
raise Exception("Didn't find any LLVM-* package")
|
||||
return
|
||||
|
||||
llvm_package = packs[0].name
|
||||
# mv build/LLVM-*.gz .
|
||||
shutil.move(str(build_dir.joinpath(llvm_package).resolve()), str(llvm_dir))
|
||||
# rm -r build
|
||||
shutil.rmtree(str(build_dir))
|
||||
# mkdir build
|
||||
build_dir.mkdir()
|
||||
# tar xf ./LLVM-*.tar.gz --strip-components=1 --directory=build
|
||||
CMD = f"tar xf {llvm_dir.joinpath(llvm_package).resolve()} --strip-components=1 --directory={build_dir}"
|
||||
subprocess.check_call(shlex.split(CMD), cwd=llvm_dir)
|
||||
# rm ./LLVM-1*.gz
|
||||
os.remove(llvm_dir.joinpath(llvm_package).resolve())
|
||||
|
||||
def repackage_llvm_windows(llvm_dir):
|
||||
build_dir = llvm_dir.joinpath("./build").resolve()
|
||||
|
||||
packs_path = [f for f in build_dir.glob("./_CPack_Packages/win64/NSIS/LLVM-*-win64")]
|
||||
if len(packs_path) > 1:
|
||||
raise Exception("Find more than one LLVM-* package")
|
||||
|
||||
if not packs_path:
|
||||
raise Exception("Didn't find any LLVM-* package")
|
||||
return
|
||||
|
||||
llvm_package_path = f"_CPack_Packages/win64/NSIS/{packs_path[0].name}"
|
||||
windows_package_dir = build_dir.joinpath(llvm_package_path).resolve()
|
||||
|
||||
# mv package dir outside of build
|
||||
shutil.move(str(windows_package_dir), str(llvm_dir))
|
||||
# rm -r build
|
||||
shutil.rmtree(str(build_dir))
|
||||
# mkdir build
|
||||
build_dir.mkdir()
|
||||
# move back all the subdiretories under cpack directory(bin/include/lib) to build dir
|
||||
moved_package_dir = llvm_dir.joinpath(packs_path[0].name)
|
||||
for sub_dir in moved_package_dir.iterdir():
|
||||
shutil.move(str(sub_dir), str(build_dir))
|
||||
moved_package_dir.rmdir()
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="build necessary LLVM libraries")
|
||||
parser.add_argument(
|
||||
"--platform",
|
||||
type=str,
|
||||
choices=["android", "arc", "darwin", "linux", "windows", "xtensa"],
|
||||
help="identify current platform",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--arch",
|
||||
nargs="+",
|
||||
type=str,
|
||||
choices=[
|
||||
"AArch64",
|
||||
"ARC",
|
||||
"ARM",
|
||||
"Mips",
|
||||
"RISCV",
|
||||
"WebAssembly",
|
||||
"X86",
|
||||
"Xtensa",
|
||||
],
|
||||
default=[],
|
||||
help="identify LLVM supported backends, separate by space, like '--arch ARM Mips X86'",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--project",
|
||||
nargs="+",
|
||||
type=str,
|
||||
default="",
|
||||
choices=["clang", "lldb"],
|
||||
help="identify extra LLVM projects, separate by space, like '--project clang lldb'",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--llvm-ver",
|
||||
action="store_true",
|
||||
help="return the version info of generated llvm libraries",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--use-clang",
|
||||
action="store_true",
|
||||
help="use clang instead of gcc",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--extra-cmake-flags",
|
||||
type=str,
|
||||
default="",
|
||||
help="custom extra cmake flags",
|
||||
)
|
||||
options = parser.parse_args()
|
||||
|
||||
# if the "platform" is not identified in the command line option,
|
||||
# detect it
|
||||
if not options.platform:
|
||||
if sys.platform.startswith("win32") or sys.platform.startswith("msys"):
|
||||
platform = "windows"
|
||||
elif sys.platform.startswith("darwin"):
|
||||
platform = "darwin"
|
||||
else:
|
||||
platform = "linux"
|
||||
else:
|
||||
platform = options.platform
|
||||
|
||||
llvm_repo_and_branch = {
|
||||
"arc": {
|
||||
"repo": "https://github.com/llvm/llvm-project.git",
|
||||
"repo_ssh": "git@github.com:llvm/llvm-project.git",
|
||||
"branch": "release/18.x",
|
||||
},
|
||||
"xtensa": {
|
||||
"repo": "https://github.com/espressif/llvm-project.git",
|
||||
"repo_ssh": "git@github.com:espressif/llvm-project.git",
|
||||
"branch": "xtensa_release_18.1.2",
|
||||
},
|
||||
"default": {
|
||||
"repo": "https://github.com/llvm/llvm-project.git",
|
||||
"repo_ssh": "git@github.com:llvm/llvm-project.git",
|
||||
"branch": "release/18.x",
|
||||
},
|
||||
}
|
||||
|
||||
# retrieve the real file
|
||||
current_file = pathlib.Path(__file__)
|
||||
if current_file.is_symlink():
|
||||
current_file = pathlib.Path(os.readlink(current_file))
|
||||
|
||||
current_dir = current_file.parent.resolve()
|
||||
deps_dir = current_dir.joinpath("../core/deps").resolve()
|
||||
|
||||
try:
|
||||
llvm_info = llvm_repo_and_branch.get(platform, llvm_repo_and_branch["default"])
|
||||
|
||||
if options.llvm_ver:
|
||||
commit_hash = query_llvm_version(llvm_info)
|
||||
print(commit_hash)
|
||||
return commit_hash is not None
|
||||
|
||||
repo_addr = llvm_info["repo"]
|
||||
if os.environ.get('USE_GIT_SSH') == "true":
|
||||
repo_addr = llvm_info["repo_ssh"]
|
||||
else:
|
||||
print("To use ssh for git clone, run: export USE_GIT_SSH=true")
|
||||
|
||||
llvm_dir = clone_llvm(deps_dir, repo_addr, llvm_info["branch"])
|
||||
if (
|
||||
build_llvm(
|
||||
llvm_dir, platform, options.arch, options.project, options.use_clang,
|
||||
options.extra_cmake_flags
|
||||
)
|
||||
is not None
|
||||
):
|
||||
# TODO: repackage process may change in the future, this work for LLVM 15.x
|
||||
if "windows" == platform:
|
||||
repackage_llvm_windows(llvm_dir)
|
||||
else:
|
||||
repackage_llvm(llvm_dir)
|
||||
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(0 if main() else 1)
|
|
@ -1,710 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
string(TOUPPER ${WAMR_BUILD_TARGET} WAMR_BUILD_TARGET)
|
||||
|
||||
# Add definitions for the build target
|
||||
if (WAMR_BUILD_TARGET STREQUAL "X86_64")
|
||||
add_definitions(-DBUILD_TARGET_X86_64)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "AMD_64")
|
||||
add_definitions(-DBUILD_TARGET_AMD_64)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "X86_32")
|
||||
add_definitions(-DBUILD_TARGET_X86_32)
|
||||
elseif (WAMR_BUILD_TARGET MATCHES "ARM.*")
|
||||
if (WAMR_BUILD_TARGET MATCHES "(ARM.*)_VFP")
|
||||
add_definitions(-DBUILD_TARGET_ARM_VFP)
|
||||
add_definitions(-DBUILD_TARGET="${CMAKE_MATCH_1}")
|
||||
else ()
|
||||
add_definitions(-DBUILD_TARGET_ARM)
|
||||
add_definitions(-DBUILD_TARGET="${WAMR_BUILD_TARGET}")
|
||||
endif ()
|
||||
elseif (WAMR_BUILD_TARGET MATCHES "THUMB.*")
|
||||
if (WAMR_BUILD_TARGET MATCHES "(THUMB.*)_VFP")
|
||||
add_definitions(-DBUILD_TARGET_THUMB_VFP)
|
||||
add_definitions(-DBUILD_TARGET="${CMAKE_MATCH_1}")
|
||||
else ()
|
||||
add_definitions(-DBUILD_TARGET_THUMB)
|
||||
add_definitions(-DBUILD_TARGET="${WAMR_BUILD_TARGET}")
|
||||
endif ()
|
||||
elseif (WAMR_BUILD_TARGET MATCHES "AARCH64.*")
|
||||
add_definitions(-DBUILD_TARGET_AARCH64)
|
||||
add_definitions(-DBUILD_TARGET="${WAMR_BUILD_TARGET}")
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "MIPS")
|
||||
add_definitions(-DBUILD_TARGET_MIPS)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "XTENSA")
|
||||
add_definitions(-DBUILD_TARGET_XTENSA)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV64" OR WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64D")
|
||||
add_definitions(-DBUILD_TARGET_RISCV64_LP64D)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV64_LP64")
|
||||
add_definitions(-DBUILD_TARGET_RISCV64_LP64)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32" OR WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32D")
|
||||
add_definitions(-DBUILD_TARGET_RISCV32_ILP32D)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32F")
|
||||
add_definitions(-DBUILD_TARGET_RISCV32_ILP32F)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "RISCV32_ILP32")
|
||||
add_definitions(-DBUILD_TARGET_RISCV32_ILP32)
|
||||
elseif (WAMR_BUILD_TARGET STREQUAL "ARC")
|
||||
add_definitions(-DBUILD_TARGET_ARC)
|
||||
else ()
|
||||
message (FATAL_ERROR "-- WAMR build target isn't set")
|
||||
endif ()
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
add_definitions(-DBH_DEBUG=1)
|
||||
endif ()
|
||||
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64"
|
||||
OR WAMR_BUILD_TARGET MATCHES "AARCH64.*" OR WAMR_BUILD_TARGET MATCHES "RISCV64.*")
|
||||
if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
# Add -fPIC flag if build as 64-bit
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -fPIC")
|
||||
endif ()
|
||||
else ()
|
||||
include(CheckCCompilerFlag)
|
||||
Check_C_Compiler_Flag(-m32 M32_OK)
|
||||
if (M32_OK OR WAMR_BUILD_TARGET STREQUAL "X86_32")
|
||||
add_definitions (-m32)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_TARGET MATCHES "ARM.*")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -marm")
|
||||
elseif (WAMR_BUILD_TARGET MATCHES "THUMB.*")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mthumb")
|
||||
set (CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wa,-mthumb")
|
||||
endif ()
|
||||
|
||||
if (NOT WAMR_BUILD_INTERP EQUAL 1)
|
||||
if (NOT WAMR_BUILD_AOT EQUAL 1)
|
||||
message (FATAL_ERROR "-- WAMR Interpreter and AOT must be enabled at least one")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_FAST_JIT EQUAL 1)
|
||||
if (NOT WAMR_BUILD_LAZY_JIT EQUAL 0)
|
||||
# Enable Lazy JIT by default
|
||||
set (WAMR_BUILD_LAZY_JIT 1)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_JIT EQUAL 1)
|
||||
if (NOT WAMR_BUILD_LAZY_JIT EQUAL 0)
|
||||
# Enable Lazy JIT by default
|
||||
set (WAMR_BUILD_LAZY_JIT 1)
|
||||
endif ()
|
||||
if (NOT DEFINED LLVM_DIR)
|
||||
set (LLVM_SRC_ROOT "${WAMR_ROOT_DIR}/core/deps/llvm")
|
||||
set (LLVM_BUILD_ROOT "${LLVM_SRC_ROOT}/build")
|
||||
if (NOT EXISTS "${LLVM_BUILD_ROOT}")
|
||||
message (FATAL_ERROR "Cannot find LLVM dir: ${LLVM_BUILD_ROOT}")
|
||||
endif ()
|
||||
set (CMAKE_PREFIX_PATH "${LLVM_BUILD_ROOT};${CMAKE_PREFIX_PATH}")
|
||||
set (LLVM_DIR ${LLVM_BUILD_ROOT}/lib/cmake/llvm)
|
||||
endif ()
|
||||
find_package(LLVM REQUIRED CONFIG)
|
||||
include_directories(${LLVM_INCLUDE_DIRS})
|
||||
add_definitions(${LLVM_DEFINITIONS})
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
|
||||
|
||||
# Disable -Wredundant-move when building LLVM JIT
|
||||
include(CheckCXXCompilerFlag)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
check_cxx_compiler_flag("-Wredundant-move" CXX_SUPPORTS_REDUNDANT_MOVE_FLAG)
|
||||
if (CXX_SUPPORTS_REDUNDANT_MOVE_FLAG)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-redundant-move")
|
||||
endif ()
|
||||
# Enable exporting symbols after llvm-17, or LLVM JIT may run failed
|
||||
# with `llvm_orc_registerEHFrameSectionWrapper` symbol not found error
|
||||
if (${LLVM_PACKAGE_VERSION} VERSION_GREATER_EQUAL "17.0.0")
|
||||
set (CMAKE_ENABLE_EXPORTS 1)
|
||||
endif ()
|
||||
endif ()
|
||||
else ()
|
||||
unset (LLVM_AVAILABLE_LIBS)
|
||||
endif ()
|
||||
|
||||
# Version
|
||||
include (${WAMR_ROOT_DIR}/build-scripts/version.cmake)
|
||||
|
||||
# Package
|
||||
include (${WAMR_ROOT_DIR}/build-scripts/package.cmake)
|
||||
|
||||
# Sanitizers
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_SANITIZER)
|
||||
set(WAMR_BUILD_SANITIZER $ENV{WAMR_BUILD_SANITIZER})
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_SANITIZER)
|
||||
set(WAMR_BUILD_SANITIZER "")
|
||||
elseif (WAMR_BUILD_SANITIZER STREQUAL "ubsan")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=alignment" )
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
|
||||
elseif (WAMR_BUILD_SANITIZER STREQUAL "asan")
|
||||
if (NOT WAMR_BUILD_JIT EQUAL 1)
|
||||
set (ASAN_OPTIONS "verbosity=2 debug=true ")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=address -fno-sanitize-recover=all" )
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
||||
endif()
|
||||
elseif (WAMR_BUILD_SANITIZER STREQUAL "tsan")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=thread -fno-sanitize-recover=all" )
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
|
||||
elseif (WAMR_BUILD_SANITIZER STREQUAL "posan")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -fsanitize=pointer-overflow -fno-sanitize-recover=all" )
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=pointer-overflow")
|
||||
elseif (NOT (WAMR_BUILD_SANITIZER STREQUAL "") )
|
||||
message(SEND_ERROR "Unsupported sanitizer: ${WAMR_BUILD_SANITIZER}")
|
||||
endif()
|
||||
|
||||
if (WAMR_BUILD_LINUX_PERF EQUAL 1)
|
||||
if (NOT WAMR_BUILD_JIT AND NOT WAMR_BUILD_AOT)
|
||||
message(WARNING "only support perf in aot and llvm-jit")
|
||||
set(WAMR_BUILD_LINUX_PERF 0)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_SHRUNK_MEMORY)
|
||||
# Enable shrunk memory by default
|
||||
set (WAMR_BUILD_SHRUNK_MEMORY 1)
|
||||
endif ()
|
||||
|
||||
########################################
|
||||
# Default values
|
||||
########################################
|
||||
if (NOT DEFINED WAMR_BUILD_BULK_MEMORY)
|
||||
set (WAMR_BUILD_BULK_MEMORY 1)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_EXCE_HANDLING)
|
||||
set (WAMR_BUILD_EXCE_HANDLING 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_GC)
|
||||
set (WAMR_BUILD_GC 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_MEMORY64)
|
||||
set (WAMR_BUILD_MEMORY64 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_MULTI_MEMORY)
|
||||
set (WAMR_BUILD_MULTI_MEMORY 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_SHARED_MEMORY)
|
||||
set(WAMR_BUILD_SHARED_MEMORY 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_STRINGREF)
|
||||
set(WAMR_BUILD_STRINGREF 0)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED WAMR_BUILD_TAIL_CALL)
|
||||
set (WAMR_BUILD_TAIL_CALL 0)
|
||||
endif ()
|
||||
|
||||
########################################
|
||||
# Compilation options to marco
|
||||
########################################
|
||||
|
||||
message ("-- Build Configurations:")
|
||||
message (" Build as target ${WAMR_BUILD_TARGET}")
|
||||
message (" Build for platform ${WAMR_BUILD_PLATFORM}")
|
||||
message (" CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
|
||||
message (" BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
|
||||
################## running mode ##################
|
||||
if (WAMR_BUILD_INTERP EQUAL 1)
|
||||
message (" WAMR Interpreter enabled")
|
||||
else ()
|
||||
message (" WAMR Interpreter disabled")
|
||||
endif ()
|
||||
if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1))
|
||||
add_definitions (-DWASM_ENABLE_FAST_INTERP=1)
|
||||
message (" Fast interpreter enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_FAST_INTERP=0)
|
||||
message (" Fast interpreter disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_AOT EQUAL 1)
|
||||
message (" WAMR AOT enabled")
|
||||
else ()
|
||||
message (" WAMR AOT disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_FAST_JIT EQUAL 1)
|
||||
if (WAMR_BUILD_LAZY_JIT EQUAL 1)
|
||||
add_definitions("-DWASM_ENABLE_LAZY_JIT=1")
|
||||
message (" WAMR Fast JIT enabled with Lazy Compilation")
|
||||
else ()
|
||||
message (" WAMR Fast JIT enabled with Eager Compilation")
|
||||
endif ()
|
||||
else ()
|
||||
message (" WAMR Fast JIT disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_JIT EQUAL 1)
|
||||
add_definitions("-DWASM_ENABLE_JIT=1")
|
||||
if (WAMR_BUILD_LAZY_JIT EQUAL 1)
|
||||
add_definitions("-DWASM_ENABLE_LAZY_JIT=1")
|
||||
message (" WAMR LLVM ORC JIT enabled with Lazy Compilation")
|
||||
else ()
|
||||
message (" WAMR LLVM ORC JIT enabled with Eager Compilation")
|
||||
endif ()
|
||||
else ()
|
||||
message (" WAMR LLVM ORC JIT disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_FAST_JIT EQUAL 1 AND WAMR_BUILD_JIT EQUAL 1
|
||||
AND WAMR_BUILD_LAZY_JIT EQUAL 1)
|
||||
message (" Multi-tier JIT enabled")
|
||||
endif ()
|
||||
################## test modes ##################
|
||||
if (WAMR_BUILD_SPEC_TEST EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_SPEC_TEST=1)
|
||||
message (" spec test compatible mode is on")
|
||||
endif ()
|
||||
if (WAMR_BUILD_WASI_TEST EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_WASI_TEST=1)
|
||||
message (" wasi test compatible mode is on")
|
||||
endif ()
|
||||
################## native ##################
|
||||
if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1)
|
||||
message (" Libc builtin enabled")
|
||||
else ()
|
||||
message (" Libc builtin disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LIBC_UVWASI EQUAL 1)
|
||||
message (" Libc WASI enabled with uvwasi implementation\n"
|
||||
" WANRING:: uvwasi does not currently provide the comprehensive\n"
|
||||
" file system security properties provided by some WASI runtimes.\n"
|
||||
" Full support for secure file system sandboxing may or may not\n"
|
||||
" be implemented in future. In the mean time, DO NOT RELY ON IT\n"
|
||||
" TO RUN UNTRUSTED CODE.")
|
||||
elseif (WAMR_BUILD_LIBC_WASI EQUAL 1)
|
||||
message (" Libc WASI enabled")
|
||||
else ()
|
||||
message (" Libc WASI disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_THREAD_MGR EQUAL 1)
|
||||
message (" Thread manager enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LIB_PTHREAD EQUAL 1)
|
||||
message (" Lib pthread enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE EQUAL 1)
|
||||
message (" Lib pthread semaphore enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1)
|
||||
message (" Lib wasi-threads enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LIBC_EMCC EQUAL 1)
|
||||
message (" Libc emcc enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LIB_RATS EQUAL 1)
|
||||
message (" Lib rats enabled")
|
||||
endif()
|
||||
if ((WAMR_BUILD_LIB_SIMDE EQUAL 1))
|
||||
message (" Lib simde enabled")
|
||||
endif()
|
||||
################## WAMR features ##################
|
||||
if (WAMR_BUILD_MULTI_MODULE EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_MULTI_MODULE=1)
|
||||
message (" Multiple modules enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_MULTI_MODULE=0)
|
||||
message (" Multiple modules disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_BULK_MEMORY EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_BULK_MEMORY=1)
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_BULK_MEMORY=0)
|
||||
endif ()
|
||||
if (WAMR_BUILD_SHARED_MEMORY EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1)
|
||||
message (" Shared memory enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_SHARED_MEMORY=0)
|
||||
endif ()
|
||||
if (WAMR_BUILD_SHARED_HEAP EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_SHARED_HEAP=1)
|
||||
message (" Shared heap enabled")
|
||||
endif()
|
||||
|
||||
if (WAMR_ENABLE_COPY_CALLSTACK EQUAL 1)
|
||||
add_definitions (-DWAMR_ENABLE_COPY_CALLSTACK=1)
|
||||
message(" Copy callstack enabled")
|
||||
else ()
|
||||
add_definitions (-DWAMR_ENABLE_COPY_CALLSTACK=0)
|
||||
message(" Copy callstack disabled")
|
||||
endif()
|
||||
|
||||
if (WAMR_BUILD_MEMORY64 EQUAL 1)
|
||||
# if native is 32-bit or cross-compiled to 32-bit
|
||||
if (NOT WAMR_BUILD_TARGET MATCHES ".*64.*")
|
||||
message (FATAL_ERROR "-- Memory64 is only available on the 64-bit platform/target")
|
||||
endif()
|
||||
add_definitions (-DWASM_ENABLE_MEMORY64=1)
|
||||
set (WAMR_DISABLE_HW_BOUND_CHECK 1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_MULTI_MEMORY EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_MULTI_MEMORY=1)
|
||||
set (WAMR_BUILD_DEBUG_INTERP 0)
|
||||
endif ()
|
||||
if (WAMR_BUILD_MINI_LOADER EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_MINI_LOADER=1)
|
||||
message (" WASM mini loader enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_MINI_LOADER=0)
|
||||
endif ()
|
||||
if (WAMR_DISABLE_HW_BOUND_CHECK EQUAL 1)
|
||||
add_definitions (-DWASM_DISABLE_HW_BOUND_CHECK=1)
|
||||
add_definitions (-DWASM_DISABLE_STACK_HW_BOUND_CHECK=1)
|
||||
message (" Hardware boundary check disabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_DISABLE_HW_BOUND_CHECK=0)
|
||||
if (WAMR_DISABLE_STACK_HW_BOUND_CHECK EQUAL 1)
|
||||
add_definitions (-DWASM_DISABLE_STACK_HW_BOUND_CHECK=1)
|
||||
message (" Hardware boundary check for native stack disabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_DISABLE_STACK_HW_BOUND_CHECK=0)
|
||||
endif ()
|
||||
endif ()
|
||||
if (WAMR_DISABLE_WAKEUP_BLOCKING_OP EQUAL 1)
|
||||
add_definitions (-DWASM_DISABLE_WAKEUP_BLOCKING_OP=1)
|
||||
message (" Wakeup of blocking operations disabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_DISABLE_WAKEUP_BLOCKING_OP=0)
|
||||
message (" Wakeup of blocking operations enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_SIMD EQUAL 1)
|
||||
if (WAMR_BUILD_TARGET MATCHES "RISCV64.*")
|
||||
set(SIMD_ENABLED 0)
|
||||
message (" SIMD disabled due to not supported on target RISCV64")
|
||||
else()
|
||||
set(SIMD_ENABLED 1)
|
||||
message (" SIMD enabled")
|
||||
endif ()
|
||||
add_definitions(-DWASM_ENABLE_SIMD=${SIMD_ENABLED})
|
||||
endif ()
|
||||
if (WAMR_BUILD_AOT_STACK_FRAME EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_AOT_STACK_FRAME=1)
|
||||
message (" AOT stack frame enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_MEMORY_PROFILING EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_MEMORY_PROFILING=1)
|
||||
message (" Memory profiling enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_PERF_PROFILING EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_PERF_PROFILING=1)
|
||||
message (" Performance profiling enabled")
|
||||
endif ()
|
||||
if (DEFINED WAMR_APP_THREAD_STACK_SIZE_MAX)
|
||||
add_definitions (-DAPP_THREAD_STACK_SIZE_MAX=${WAMR_APP_THREAD_STACK_SIZE_MAX})
|
||||
endif ()
|
||||
if (WAMR_BUILD_CUSTOM_NAME_SECTION EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_CUSTOM_NAME_SECTION=1)
|
||||
message (" Custom name section enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_DUMP_CALL_STACK=1)
|
||||
message (" Dump call stack enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_TAIL_CALL EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_TAIL_CALL=1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_REF_TYPES EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_REF_TYPES=1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_GC EQUAL 1)
|
||||
if (WAMR_TEST_GC EQUAL 1)
|
||||
message(" GC testing enabled")
|
||||
endif()
|
||||
endif ()
|
||||
if (WAMR_BUILD_GC EQUAL 1 AND WAMR_BUILD_GC_PERF_PROFILING EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_GC_PERF_PROFILING=1)
|
||||
message (" GC performance profiling enabled")
|
||||
else ()
|
||||
message (" GC performance profiling disabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_STRINGREF EQUAL 1)
|
||||
if (NOT DEFINED WAMR_STRINGREF_IMPL_SOURCE)
|
||||
message (" Using WAMR builtin implementation for stringref")
|
||||
else ()
|
||||
message (" Using custom implementation for stringref")
|
||||
endif()
|
||||
endif ()
|
||||
if (WAMR_BUILD_PERF_PROFILING EQUAL 1 OR
|
||||
WAMR_BUILD_DUMP_CALL_STACK EQUAL 1 OR
|
||||
WAMR_BUILD_GC EQUAL 1)
|
||||
# Enable AOT/JIT stack frame when perf-profiling, dump-call-stack
|
||||
# or GC is enabled
|
||||
if (WAMR_BUILD_AOT EQUAL 1 OR WAMR_BUILD_JIT EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_AOT_STACK_FRAME=1)
|
||||
endif ()
|
||||
endif ()
|
||||
if (WAMR_BUILD_EXCE_HANDLING EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_EXCE_HANDLING=1)
|
||||
add_definitions (-DWASM_ENABLE_TAGS=1)
|
||||
message (" Exception Handling enabled")
|
||||
endif ()
|
||||
if (DEFINED WAMR_BH_VPRINTF)
|
||||
add_definitions (-DBH_VPRINTF=${WAMR_BH_VPRINTF})
|
||||
endif ()
|
||||
if (DEFINED WAMR_BH_LOG)
|
||||
add_definitions (-DBH_LOG=${WAMR_BH_LOG})
|
||||
endif ()
|
||||
if (WAMR_DISABLE_APP_ENTRY EQUAL 1)
|
||||
message (" WAMR application entry functions excluded")
|
||||
endif ()
|
||||
if (WAMR_BUILD_DEBUG_INTERP EQUAL 1)
|
||||
message (" Debug Interpreter enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_DEBUG_AOT EQUAL 1)
|
||||
message (" Debug AOT enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_DYNAMIC_AOT_DEBUG EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_DYNAMIC_AOT_DEBUG=1)
|
||||
message (" Dynamic AOT debug enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LOAD_CUSTOM_SECTION EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_LOAD_CUSTOM_SECTION=1)
|
||||
message (" Load custom section enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_GLOBAL_HEAP_POOL EQUAL 1)
|
||||
add_definitions(-DWASM_ENABLE_GLOBAL_HEAP_POOL=1)
|
||||
message (" Global heap pool enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_GLOBAL_HEAP_SIZE GREATER 0)
|
||||
add_definitions (-DWASM_GLOBAL_HEAP_SIZE=${WAMR_BUILD_GLOBAL_HEAP_SIZE})
|
||||
message (" Custom global heap size: " ${WAMR_BUILD_GLOBAL_HEAP_SIZE})
|
||||
else ()
|
||||
# Spec test requires more heap pool size
|
||||
if (WAMR_BUILD_SPEC_TEST EQUAL 1)
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "linux-sgx")
|
||||
math(EXPR WAMR_BUILD_GLOBAL_HEAP_SIZE "100 * 1024 * 1024")
|
||||
else ()
|
||||
math(EXPR WAMR_BUILD_GLOBAL_HEAP_SIZE "300 * 1024 * 1024")
|
||||
endif ()
|
||||
add_definitions (-DWASM_GLOBAL_HEAP_SIZE=${WAMR_BUILD_GLOBAL_HEAP_SIZE})
|
||||
else ()
|
||||
# By default, the global heap size is of 10 MB
|
||||
math(EXPR WAMR_BUILD_GLOBAL_HEAP_SIZE "10 * 1024 * 1024")
|
||||
add_definitions (-DWASM_GLOBAL_HEAP_SIZE=${WAMR_BUILD_GLOBAL_HEAP_SIZE})
|
||||
endif ()
|
||||
endif ()
|
||||
if (WAMR_BUILD_STACK_GUARD_SIZE GREATER 0)
|
||||
add_definitions (-DWASM_STACK_GUARD_SIZE=${WAMR_BUILD_STACK_GUARD_SIZE})
|
||||
message (" Custom stack guard size: " ${WAMR_BUILD_STACK_GUARD_SIZE})
|
||||
endif ()
|
||||
if (WAMR_BUILD_SGX_IPFS EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_SGX_IPFS=1)
|
||||
message (" SGX IPFS enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_WASI_NN EQUAL 1)
|
||||
message (" WASI-NN enabled")
|
||||
add_definitions (-DWASM_ENABLE_WASI_NN=1)
|
||||
# Variant backends
|
||||
if (NOT WAMR_BUILD_WASI_NN_TFLITE EQUAL 1 AND
|
||||
NOT WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1 AND
|
||||
NOT WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1)
|
||||
message (FATAL_ERROR " Need to select a backend for WASI-NN")
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_WASI_NN_TFLITE EQUAL 1)
|
||||
message (" WASI-NN: backend tflite enabled")
|
||||
add_definitions (-DWASM_ENABLE_WASI_NN_TFLITE)
|
||||
endif ()
|
||||
if (WAMR_BUILD_WASI_NN_OPENVINO EQUAL 1)
|
||||
message (" WASI-NN: backend openvino enabled")
|
||||
add_definitions (-DWASM_ENABLE_WASI_NN_OPENVINO)
|
||||
endif ()
|
||||
if (WAMR_BUILD_WASI_NN_LLAMACPP EQUAL 1)
|
||||
message (" WASI-NN: backend llamacpp enabled")
|
||||
add_definitions (-DWASM_ENABLE_WASI_NN_LLAMACPP)
|
||||
endif ()
|
||||
# Variant devices
|
||||
if (WAMR_BUILD_WASI_NN_ENABLE_GPU EQUAL 1)
|
||||
message (" WASI-NN: GPU enabled")
|
||||
add_definitions (-DWASM_ENABLE_WASI_NN_GPU=1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_WASI_NN_ENABLE_EXTERNAL_DELEGATE EQUAL 1)
|
||||
message (" WASI-NN: External Delegation enabled")
|
||||
add_definitions (-DWASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE=1)
|
||||
endif ()
|
||||
if (DEFINED WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH)
|
||||
add_definitions (-DWASM_WASI_NN_EXTERNAL_DELEGATE_PATH="${WAMR_BUILD_WASI_NN_EXTERNAL_DELEGATE_PATH}")
|
||||
endif ()
|
||||
if (WAMR_BUILD_WASI_EPHEMERAL_NN EQUAL 1)
|
||||
message (" WASI-NN: use 'wasi_ephemeral_nn' instead of 'wasi-nn'")
|
||||
add_definitions (-DWASM_ENABLE_WASI_EPHEMERAL_NN=1)
|
||||
endif()
|
||||
endif ()
|
||||
if (WAMR_BUILD_ALLOC_WITH_USER_DATA EQUAL 1)
|
||||
add_definitions(-DWASM_MEM_ALLOC_WITH_USER_DATA=1)
|
||||
endif()
|
||||
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_WASM_CACHE=1)
|
||||
message (" Wasm files cache enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_MODULE_INST_CONTEXT EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_MODULE_INST_CONTEXT=1)
|
||||
message (" Module instance context enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_GC_HEAP_VERIFY EQUAL 1)
|
||||
add_definitions (-DBH_ENABLE_GC_VERIFY=1)
|
||||
message (" GC heap verification enabled")
|
||||
endif ()
|
||||
if ("$ENV{COLLECT_CODE_COVERAGE}" STREQUAL "1" OR COLLECT_CODE_COVERAGE EQUAL 1)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||
add_definitions (-DCOLLECT_CODE_COVERAGE)
|
||||
message (" Collect code coverage enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_STATIC_PGO EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_STATIC_PGO=1)
|
||||
message (" AOT static PGO enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_TARGET STREQUAL "X86_64"
|
||||
AND WAMR_BUILD_PLATFORM STREQUAL "linux")
|
||||
if (WAMR_DISABLE_WRITE_GS_BASE EQUAL 1)
|
||||
# disabled by user
|
||||
set (DISABLE_WRITE_GS_BASE 1)
|
||||
elseif (WAMR_DISABLE_WRITE_GS_BASE EQUAL 0)
|
||||
# enabled by user
|
||||
set (DISABLE_WRITE_GS_BASE 0)
|
||||
elseif (CMAKE_CROSSCOMPILING)
|
||||
# disabled in cross compilation environment
|
||||
set (DISABLE_WRITE_GS_BASE 1)
|
||||
else ()
|
||||
# auto-detected by the compiler
|
||||
set (TEST_WRGSBASE_SOURCE "${CMAKE_BINARY_DIR}/test_wrgsbase.c")
|
||||
file (WRITE "${TEST_WRGSBASE_SOURCE}" "
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
int main() {
|
||||
uint64_t value;
|
||||
asm volatile (\"wrgsbase %0\" : : \"r\"(value));
|
||||
printf(\"WRGSBASE instruction is available.\\n\");
|
||||
return 0;
|
||||
}")
|
||||
# Try to compile and run the test program
|
||||
try_run (TEST_WRGSBASE_RESULT
|
||||
TEST_WRGSBASE_COMPILED
|
||||
${CMAKE_BINARY_DIR}/test_wrgsbase
|
||||
SOURCES ${TEST_WRGSBASE_SOURCE}
|
||||
CMAKE_FLAGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
)
|
||||
#message("${TEST_WRGSBASE_COMPILED}, ${TEST_WRGSBASE_RESULT}")
|
||||
if (TEST_WRGSBASE_RESULT EQUAL 0)
|
||||
set (DISABLE_WRITE_GS_BASE 0)
|
||||
else ()
|
||||
set (DISABLE_WRITE_GS_BASE 1)
|
||||
endif ()
|
||||
endif ()
|
||||
if (DISABLE_WRITE_GS_BASE EQUAL 1)
|
||||
add_definitions (-DWASM_DISABLE_WRITE_GS_BASE=1)
|
||||
message (" Write linear memory base addr to x86 GS register disabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_DISABLE_WRITE_GS_BASE=0)
|
||||
message (" Write linear memory base addr to x86 GS register enabled")
|
||||
endif ()
|
||||
endif ()
|
||||
if (WAMR_CONFIGURABLE_BOUNDS_CHECKS EQUAL 1)
|
||||
add_definitions (-DWASM_CONFIGURABLE_BOUNDS_CHECKS=1)
|
||||
message (" Configurable bounds checks enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_LINUX_PERF EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_LINUX_PERF=1)
|
||||
message (" Linux perf support enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_AOT EQUAL 1 OR WAMR_BUILD_JIT EQUAL 1)
|
||||
if (NOT DEFINED WAMR_BUILD_QUICK_AOT_ENTRY)
|
||||
# Enable quick aot/jit entries by default
|
||||
set (WAMR_BUILD_QUICK_AOT_ENTRY 1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_QUICK_AOT_ENTRY EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_QUICK_AOT_ENTRY=1)
|
||||
message (" Quick AOT/JIT entries enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_QUICK_AOT_ENTRY=0)
|
||||
message (" Quick AOT/JIT entries disabled")
|
||||
endif ()
|
||||
else ()
|
||||
# Disable quick aot/jit entries for interp and fast-jit
|
||||
add_definitions (-DWASM_ENABLE_QUICK_AOT_ENTRY=0)
|
||||
endif ()
|
||||
if (WAMR_BUILD_AOT EQUAL 1)
|
||||
if (NOT DEFINED WAMR_BUILD_AOT_INTRINSICS)
|
||||
# Enable aot intrinsics by default
|
||||
set (WAMR_BUILD_AOT_INTRINSICS 1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_AOT_INTRINSICS EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_AOT_INTRINSICS=1)
|
||||
message (" AOT intrinsics enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_AOT_INTRINSICS=0)
|
||||
message (" AOT intrinsics disabled")
|
||||
endif ()
|
||||
else ()
|
||||
# Disable aot intrinsics for interp, fast-jit and llvm-jit
|
||||
add_definitions (-DWASM_ENABLE_AOT_INTRINSICS=0)
|
||||
endif ()
|
||||
if (WAMR_BUILD_ALLOC_WITH_USAGE EQUAL 1)
|
||||
add_definitions(-DWASM_MEM_ALLOC_WITH_USAGE=1)
|
||||
endif()
|
||||
if (NOT WAMR_BUILD_SANITIZER STREQUAL "")
|
||||
message (" Sanitizer ${WAMR_BUILD_SANITIZER} enabled")
|
||||
endif ()
|
||||
if (WAMR_BUILD_SHRUNK_MEMORY EQUAL 1)
|
||||
add_definitions (-DWASM_ENABLE_SHRUNK_MEMORY=1)
|
||||
message (" Shrunk memory enabled")
|
||||
else ()
|
||||
add_definitions (-DWASM_ENABLE_SHRUNK_MEMORY=0)
|
||||
message (" Shrunk memory disabled")
|
||||
endif()
|
||||
if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1)
|
||||
message (" AOT validator enabled")
|
||||
add_definitions (-DWASM_ENABLE_AOT_VALIDATOR=1)
|
||||
endif ()
|
||||
if (WAMR_BUILD_INSTRUCTION_METERING EQUAL 1)
|
||||
message (" Instruction metering enabled")
|
||||
add_definitions (-DWASM_ENABLE_INSTRUCTION_METERING=1)
|
||||
endif ()
|
||||
|
||||
########################################
|
||||
# Show Phase4 Wasm proposals status.
|
||||
########################################
|
||||
|
||||
message (
|
||||
"-- About Wasm Proposals:\n"
|
||||
" Always-on:\n"
|
||||
" \"Multi-value\"\n"
|
||||
" \"Non-trapping float-to-int conversions\"\n"
|
||||
" \"Sign-extension operators\"\n"
|
||||
" \"WebAssembly C and C++ API\"\n"
|
||||
" Configurable. 0 is OFF. 1 is ON:\n"
|
||||
" \"Bulk Memory Operation\" via WAMR_BUILD_BULK_MEMORY: ${WAMR_BUILD_BULK_MEMORY}\n"
|
||||
" \"Fixed-width SIMD\" via WAMR_BUILD_SIMD: ${WAMR_BUILD_SIMD}\n"
|
||||
" \"Garbage collection\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n"
|
||||
" \"Legacy Exception handling\" via WAMR_BUILD_EXCE_HANDLING: ${WAMR_BUILD_EXCE_HANDLING}\n"
|
||||
" \"Memory64\" via WAMR_BUILD_MEMORY64: ${WAMR_BUILD_MEMORY64}\n"
|
||||
" \"Multiple memories\" via WAMR_BUILD_MULTI_MEMORY: ${WAMR_BUILD_MULTI_MEMORY}\n"
|
||||
" \"Reference Types\" via WAMR_BUILD_REF_TYPES: ${WAMR_BUILD_REF_TYPES}\n"
|
||||
" \"Reference-Typed Strings\" via WAMR_BUILD_STRINGREF: ${WAMR_BUILD_STRINGREF}\n"
|
||||
" \"Tail call\" via WAMR_BUILD_TAIL_CALL: ${WAMR_BUILD_TAIL_CALL}\n"
|
||||
" \"Threads\" via WAMR_BUILD_SHARED_MEMORY: ${WAMR_BUILD_SHARED_MEMORY}\n"
|
||||
" \"Typed Function References\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n"
|
||||
" Unsupported (>= Phase4):\n"
|
||||
" \"Branch Hinting\"\n"
|
||||
" \"Custom Annotation Syntax in the Text Format\"\n"
|
||||
" \"Exception handling\"\n"
|
||||
" \"Extended Constant Expressions\"\n"
|
||||
" \"Import/Export of Mutable Globals\"\n"
|
||||
" \"JS String Builtins\"\n"
|
||||
" \"Relaxed SIMD\"\n"
|
||||
)
|
|
@ -1,31 +0,0 @@
|
|||
# wasm-micro-runtime as ESP-IDF component
|
||||
|
||||
You can build an ESP-IDF project with wasm-micro-runtime as a component:
|
||||
|
||||
- Make sure you have the ESP-IDF properly installed and setup
|
||||
- In particular have the following paths set:
|
||||
- `WAMR_PATH` to point to your wasm-micro-runtime repository
|
||||
- `IDF_PATH` to point to your ESP-IDF
|
||||
- `source $IDF_PATH/export.sh`
|
||||
- Create a new project, e.g.: `idf.py create-project wamr-hello`
|
||||
- In the newly created project folder edit the `CMakeList.txt`:
|
||||
|
||||
```
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set (COMPONENTS ${IDF_TARGET} main freertos esptool_py wamr)
|
||||
|
||||
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{WAMR_PATH}/build-scripts/esp-idf")
|
||||
|
||||
project(wamr-hello)
|
||||
```
|
||||
- Develop your project in it's `main` component folder.
|
||||
|
||||
You can find an example [here](../../product-mini/platforms/esp-idf).
|
||||
|
||||
- Set target platform: `idf.py set-target esp32c3`
|
||||
- Build: `idf.py build`
|
||||
- Flash: `idf.py flash`
|
||||
- Check the output: `idf.py monitor`
|
|
@ -1,111 +0,0 @@
|
|||
# Copyright (C) 2021 Intel Corporation and others. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# Set WAMR's build options
|
||||
if (NOT CMAKE_BUILD_EARLY_EXPANSION)
|
||||
|
||||
if (CONFIG_IDF_TARGET_ARCH_RISCV)
|
||||
if (CONFIG_IDF_TARGET_ESP32P4)
|
||||
set (WAMR_BUILD_TARGET "RISCV32_ILP32F")
|
||||
else ()
|
||||
set (WAMR_BUILD_TARGET "RISCV32_ILP32")
|
||||
endif ()
|
||||
elseif (CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
set (WAMR_BUILD_TARGET "XTENSA")
|
||||
else ()
|
||||
message (FATAL_ERROR "Arch ${CONFIG_IDF_TARGET_ARCH} is not supported")
|
||||
endif ()
|
||||
|
||||
set (WAMR_BUILD_PLATFORM "esp-idf")
|
||||
|
||||
if (CONFIG_WAMR_BUILD_DEBUG)
|
||||
set (CMAKE_BUILD_TYPE Debug)
|
||||
else ()
|
||||
set (CMAKE_BUILD_TYPE Release)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_INTERP)
|
||||
set (WAMR_BUILD_INTERP 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_INTERP_FAST)
|
||||
set (WAMR_BUILD_FAST_INTERP 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_AOT)
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_LIBC_BUILTIN)
|
||||
set (WAMR_BUILD_LIBC_BUILTIN 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_INTERP_LOADER_MINI)
|
||||
set (WAMR_BUILD_MINI_LOADER 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_MULTI_MODULE)
|
||||
set (WAMR_BUILD_MULTI_MODULE 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_SHARED_MEMORY)
|
||||
set (WAMR_BUILD_SHARED_MEMORY 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_MEMORY_PROFILING)
|
||||
set (WAMR_BUILD_MEMORY_PROFILING 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_PERF_PROFILING)
|
||||
set (WAMR_BUILD_PERF_PROFILING 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_REF_TYPES)
|
||||
set (WAMR_BUILD_REF_TYPES 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_LIBC_WASI)
|
||||
set (WAMR_BUILD_LIBC_WASI 1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_LIB_PTHREAD)
|
||||
set (WAMR_BUILD_LIB_PTHREAD 1)
|
||||
endif ()
|
||||
|
||||
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../../..)
|
||||
include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
|
||||
|
||||
list (APPEND srcs "${WAMR_RUNTIME_LIB_SOURCE}"
|
||||
"${PLATFORM_SHARED_SOURCE}")
|
||||
|
||||
set (include_dirs "${IWASM_DIR}/include"
|
||||
"${UTILS_SHARED_DIR}"
|
||||
"${PLATFORM_SHARED_DIR}"
|
||||
"${PLATFORM_SHARED_DIR}/../include"
|
||||
"${IWASM_COMMON_DIR}")
|
||||
endif ()
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS ${include_dirs}
|
||||
REQUIRES pthread lwip esp_timer
|
||||
KCONFIG ${CMAKE_CURRENT_LIST_DIR}/Kconfig)
|
||||
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
||||
|
||||
if (CONFIG_IDF_TARGET_ARCH_RISCV)
|
||||
if (CONFIG_IDF_TARGET_ESP32P4)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_RISCV32_ILP32F=1)
|
||||
else ()
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_RISCV32_ILP32=1)
|
||||
endif ()
|
||||
elseif (CONFIG_IDF_TARGET_ARCH_XTENSA)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC -DBUILD_TARGET_XTENSA=1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_AOT)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC -DWASM_ENABLE_AOT=1)
|
||||
endif ()
|
||||
|
||||
if (CONFIG_WAMR_ENABLE_INTERP)
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC -DWASM_ENABLE_INTERP=1)
|
||||
endif ()
|
|
@ -1,77 +0,0 @@
|
|||
menu "WASM Micro Runtime"
|
||||
choice WAMR_BUILD_TYPE
|
||||
prompt "Build type"
|
||||
default WAMR_BUILD_RELEASE
|
||||
|
||||
config WAMR_BUILD_RELEASE
|
||||
bool "Release"
|
||||
|
||||
config WAMR_BUILD_DEBUG
|
||||
bool "Debug"
|
||||
endchoice
|
||||
|
||||
config WAMR_ENABLE_AOT
|
||||
bool "AOT"
|
||||
default y
|
||||
|
||||
menuconfig WAMR_ENABLE_INTERP
|
||||
bool "Interpreter"
|
||||
default y
|
||||
|
||||
if WAMR_ENABLE_INTERP
|
||||
|
||||
choice WAMR_INTERP_MODE
|
||||
prompt "Interpreter mode"
|
||||
default WAMR_INTERP_FAST
|
||||
|
||||
config WAMR_INTERP_CLASSIC
|
||||
bool "Classic"
|
||||
|
||||
config WAMR_INTERP_FAST
|
||||
bool "Fast"
|
||||
endchoice
|
||||
|
||||
choice WAMR_INTERP_LOADER_MODE
|
||||
prompt "Loader mode"
|
||||
default WAMR_INTERP_LOADER_NORMAL
|
||||
|
||||
config WAMR_INTERP_LOADER_NORMAL
|
||||
bool "Normal"
|
||||
|
||||
config WAMR_INTERP_LOADER_MINI
|
||||
bool "Mini"
|
||||
endchoice
|
||||
endif
|
||||
|
||||
config WAMR_ENABLE_LIB_PTHREAD
|
||||
bool "Lib pthread"
|
||||
default y
|
||||
|
||||
config WAMR_ENABLE_LIBC_BUILTIN
|
||||
bool "Libc builtin"
|
||||
default y
|
||||
|
||||
config WAMR_ENABLE_LIBC_WASI
|
||||
bool "Libc WASI"
|
||||
default y
|
||||
|
||||
config WAMR_ENABLE_MEMORY_PROFILING
|
||||
bool "Memory profiling"
|
||||
default n
|
||||
|
||||
config WAMR_ENABLE_MULTI_MODULE
|
||||
bool "Multi module"
|
||||
default n
|
||||
|
||||
config WAMR_ENABLE_PERF_PROFILING
|
||||
bool "Performance profiling"
|
||||
default n
|
||||
|
||||
config WAMR_ENABLE_REF_TYPES
|
||||
bool "Reference types"
|
||||
default n
|
||||
|
||||
config WAMR_ENABLE_SHARED_MEMORY
|
||||
bool "Shared memory"
|
||||
default n
|
||||
endmenu
|
|
@ -1,41 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
message(STATUS "involving boringssl...")
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
ExternalProject_Add(boringssl
|
||||
PREFIX external/boringssl
|
||||
# follow envoy, which tracks BoringSSL, which tracks Chromium
|
||||
# https://github.com/envoyproxy/envoy/blob/main/bazel/repository_locations.bzl#L112
|
||||
# chromium-105.0.5195.37 (linux/beta)
|
||||
URL https://github.com/google/boringssl/archive/098695591f3a2665fccef83a3732ecfc99acdcdd.tar.gz
|
||||
URL_HASH SHA256=e141448cf6f686b6e9695f6b6459293fd602c8d51efe118a83106752cf7e1280
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP NEW
|
||||
# SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../external/boringssl
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/src/boringssl-build/libssl.a
|
||||
${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/
|
||||
&& ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/src/boringssl-build/libcrypto.a
|
||||
${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/
|
||||
&& ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/src/boringssl/src/include/openssl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/openssl
|
||||
)
|
||||
|
||||
add_library(boringssl_ssl STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
boringssl_ssl
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/libssl.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/
|
||||
)
|
||||
add_dependencies(boringssl_ssl boringssl)
|
||||
|
||||
add_library(boringssl_crypto STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
boringssl_crypto
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/libcrypto.a
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/external/boringssl/
|
||||
)
|
||||
add_dependencies(boringssl_crypto boringssl)
|
File diff suppressed because it is too large
Load Diff
|
@ -1,30 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
set(_WAMR_BUILD_SCRIPTS_DIR "${CMAKE_CURRENT_LIST_DIR}")
|
||||
|
||||
function(install_iwasm_package)
|
||||
install (EXPORT iwasmTargets
|
||||
FILE iwasmTargets.cmake
|
||||
NAMESPACE iwasm::
|
||||
DESTINATION lib/cmake/iwasm
|
||||
)
|
||||
|
||||
include (CMakePackageConfigHelpers)
|
||||
configure_package_config_file (${_WAMR_BUILD_SCRIPTS_DIR}/iwasmConfig.cmake.in
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfig.cmake"
|
||||
INSTALL_DESTINATION lib/cmake/iwasm
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfigVersion.cmake"
|
||||
VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
|
||||
install (FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfigVersion.cmake"
|
||||
DESTINATION lib/cmake/iwasm
|
||||
)
|
||||
endfunction()
|
|
@ -1 +0,0 @@
|
|||
requests==2.32.4
|
|
@ -1,231 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
if (NOT DEFINED WAMR_ROOT_DIR)
|
||||
set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../)
|
||||
endif ()
|
||||
if (NOT DEFINED SHARED_DIR)
|
||||
set (SHARED_DIR ${WAMR_ROOT_DIR}/core/shared)
|
||||
endif ()
|
||||
if (NOT DEFINED IWASM_DIR)
|
||||
set (IWASM_DIR ${WAMR_ROOT_DIR}/core/iwasm)
|
||||
endif ()
|
||||
if (NOT DEFINED DEPS_DIR)
|
||||
set (DEPS_DIR ${WAMR_ROOT_DIR}/core/deps)
|
||||
endif ()
|
||||
if (NOT DEFINED SHARED_PLATFORM_CONFIG)
|
||||
# CMake file for platform configuration. The PLATFORM_SHARED_SOURCE variable
|
||||
# should point to a list of platform-specfic source files to compile.
|
||||
set (SHARED_PLATFORM_CONFIG ${SHARED_DIR}/platform/${WAMR_BUILD_PLATFORM}/shared_platform.cmake)
|
||||
endif ()
|
||||
|
||||
if (DEFINED EXTRA_SDK_INCLUDE_PATH)
|
||||
message(STATUS, "EXTRA_SDK_INCLUDE_PATH = ${EXTRA_SDK_INCLUDE_PATH} ")
|
||||
include_directories (
|
||||
${EXTRA_SDK_INCLUDE_PATH}
|
||||
)
|
||||
endif ()
|
||||
|
||||
# Set default options
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
|
||||
# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
|
||||
if (NOT DEFINED WAMR_BUILD_TARGET)
|
||||
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
|
||||
set (WAMR_BUILD_TARGET "AARCH64")
|
||||
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
|
||||
set (WAMR_BUILD_TARGET "RISCV64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
# Build as X86_64 by default in 64-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_64")
|
||||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
# Build as X86_32 by default in 32-bit platform
|
||||
set (WAMR_BUILD_TARGET "X86_32")
|
||||
else ()
|
||||
message(SEND_ERROR "Unsupported build target platform!")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
################ optional according to settings ################
|
||||
if (WAMR_BUILD_FAST_JIT EQUAL 1 OR WAMR_BUILD_JIT EQUAL 1)
|
||||
# Enable classic interpreter if Fast JIT or LLVM JIT is enabled
|
||||
set (WAMR_BUILD_INTERP 1)
|
||||
set (WAMR_BUILD_FAST_INTERP 0)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_INTERP EQUAL 1)
|
||||
include (${IWASM_DIR}/interpreter/iwasm_interp.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_FAST_JIT EQUAL 1)
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
message ("Fast JIT currently not supported on Windows")
|
||||
set (WAMR_BUILD_FAST_JIT 0)
|
||||
else ()
|
||||
include (${IWASM_DIR}/fast-jit/iwasm_fast_jit.cmake)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_JIT EQUAL 1)
|
||||
# Enable AOT if LLVM JIT is enabled
|
||||
set (WAMR_BUILD_AOT 1)
|
||||
include (${IWASM_DIR}/compilation/iwasm_compl.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_AOT EQUAL 1)
|
||||
include (${IWASM_DIR}/aot/iwasm_aot.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_STRINGREF EQUAL 1)
|
||||
set (WAMR_BUILD_GC 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_GC EQUAL 1)
|
||||
include (${IWASM_DIR}/common/gc/iwasm_gc.cmake)
|
||||
# Enable the dependent feature if GC is enabled
|
||||
set (WAMR_BUILD_REF_TYPES 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/libc-builtin/libc_builtin.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIBC_UVWASI EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/libc-uvwasi/libc_uvwasi.cmake)
|
||||
set (WAMR_BUILD_MODULE_INST_CONTEXT 1)
|
||||
elseif (WAMR_BUILD_LIBC_WASI EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/libc-wasi/libc_wasi.cmake)
|
||||
set (WAMR_BUILD_MODULE_INST_CONTEXT 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE EQUAL 1)
|
||||
# Enable the dependent feature if lib pthread semaphore is enabled
|
||||
set (WAMR_BUILD_LIB_PTHREAD 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_WASI_NN EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/wasi-nn/cmake/wasi_nn.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIB_PTHREAD EQUAL 1)
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
set (WAMR_BUILD_LIB_PTHREAD_SEMAPHORE 0)
|
||||
message ("Lib pthread semaphore currently not supported on Windows")
|
||||
endif ()
|
||||
include (${IWASM_DIR}/libraries/lib-pthread/lib_pthread.cmake)
|
||||
# Enable the dependent feature if lib pthread is enabled
|
||||
set (WAMR_BUILD_THREAD_MGR 1)
|
||||
set (WAMR_BUILD_BULK_MEMORY 1)
|
||||
set (WAMR_BUILD_SHARED_MEMORY 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIB_WASI_THREADS EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/lib-wasi-threads/lib_wasi_threads.cmake)
|
||||
# Enable the dependent feature if lib wasi threads is enabled
|
||||
set (WAMR_BUILD_THREAD_MGR 1)
|
||||
set (WAMR_BUILD_BULK_MEMORY 1)
|
||||
set (WAMR_BUILD_SHARED_MEMORY 1)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_SHARED_HEAP EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/shared-heap/shared_heap.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_DEBUG_INTERP EQUAL 1)
|
||||
set (WAMR_BUILD_THREAD_MGR 1)
|
||||
include (${IWASM_DIR}/libraries/debug-engine/debug_engine.cmake)
|
||||
|
||||
if (WAMR_BUILD_FAST_INTERP EQUAL 1)
|
||||
set (WAMR_BUILD_FAST_INTERP 0)
|
||||
message(STATUS
|
||||
"Debugger doesn't work with fast interpreter, switch to classic interpreter")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_THREAD_MGR EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/thread-mgr/thread_mgr.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIBC_EMCC EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/libc-emcc/libc_emcc.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_LIB_RATS EQUAL 1)
|
||||
include (${IWASM_DIR}/libraries/lib-rats/lib_rats.cmake)
|
||||
endif ()
|
||||
|
||||
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
|
||||
include (${WAMR_ROOT_DIR}/build-scripts/involve_boringssl.cmake)
|
||||
endif ()
|
||||
|
||||
####################### Common sources #######################
|
||||
if (NOT MSVC)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -ffunction-sections -fdata-sections \
|
||||
-Wall -Wno-unused-parameter -Wno-pedantic")
|
||||
endif ()
|
||||
|
||||
# include the build config template file
|
||||
include (${CMAKE_CURRENT_LIST_DIR}/config_common.cmake)
|
||||
|
||||
if (WAMR_BUILD_SIMD EQUAL 1 AND WAMR_BUILD_FAST_INTERP EQUAL 1)
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
message(STATUS "SIMDe doesnt support platform " ${WAMR_BUILD_PLATFORM})
|
||||
set(WAMR_BUILD_SIMDE 0)
|
||||
else()
|
||||
include (${IWASM_DIR}/libraries/simde/simde.cmake)
|
||||
set (WAMR_BUILD_SIMDE 1)
|
||||
endif()
|
||||
else()
|
||||
set(WAMR_BUILD_SIMDE 0)
|
||||
endif ()
|
||||
|
||||
include_directories (${IWASM_DIR}/include)
|
||||
|
||||
file (GLOB header
|
||||
${IWASM_DIR}/include/*.h
|
||||
)
|
||||
LIST (APPEND RUNTIME_LIB_HEADER_LIST ${header})
|
||||
|
||||
if (WAMR_BUILD_PLATFORM STREQUAL "windows")
|
||||
enable_language (ASM_MASM)
|
||||
else()
|
||||
enable_language (ASM)
|
||||
endif()
|
||||
|
||||
# it will expose the runtime APIs.
|
||||
# you'll use the following command to check the exported APIs
|
||||
# dumpbin.exe /EXPORTS xxx
|
||||
if (MSVC)
|
||||
add_compile_definitions(COMPILING_WASM_RUNTIME_API=1)
|
||||
endif ()
|
||||
|
||||
include (${SHARED_PLATFORM_CONFIG})
|
||||
include (${SHARED_DIR}/mem-alloc/mem_alloc.cmake)
|
||||
include (${IWASM_DIR}/common/iwasm_common.cmake)
|
||||
include (${SHARED_DIR}/utils/shared_utils.cmake)
|
||||
|
||||
|
||||
set (source_all
|
||||
${PLATFORM_SHARED_SOURCE}
|
||||
${MEM_ALLOC_SHARED_SOURCE}
|
||||
${UTILS_SHARED_SOURCE}
|
||||
${LIBC_BUILTIN_SOURCE}
|
||||
${LIBC_WASI_SOURCE}
|
||||
${WASI_NN_SOURCES}
|
||||
${IWASM_COMMON_SOURCE}
|
||||
${IWASM_INTERP_SOURCE}
|
||||
${IWASM_AOT_SOURCE}
|
||||
${IWASM_COMPL_SOURCE}
|
||||
${IWASM_FAST_JIT_SOURCE}
|
||||
${IWASM_GC_SOURCE}
|
||||
${LIB_WASI_THREADS_SOURCE}
|
||||
${LIB_PTHREAD_SOURCE}
|
||||
${THREAD_MGR_SOURCE}
|
||||
${LIBC_EMCC_SOURCE}
|
||||
${LIB_RATS_SOURCE}
|
||||
${DEBUG_ENGINE_SOURCE}
|
||||
${LIB_SHARED_HEAP_SOURCE}
|
||||
)
|
||||
|
||||
set (WAMR_RUNTIME_LIB_SOURCE ${source_all})
|
|
@ -1,28 +0,0 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
if(NOT WAMR_ROOT_DIR)
|
||||
# if from wamr-compiler
|
||||
set(WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
endif()
|
||||
|
||||
set(WAMR_VERSION_MAJOR 2)
|
||||
set(WAMR_VERSION_MINOR 3)
|
||||
set(WAMR_VERSION_PATCH 1)
|
||||
|
||||
message("-- WAMR version: ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}")
|
||||
|
||||
# Configure the version header file
|
||||
configure_file(
|
||||
${WAMR_ROOT_DIR}/core/version.h.in
|
||||
${WAMR_ROOT_DIR}/core/version.h
|
||||
)
|
||||
|
||||
# Set the library version and SOVERSION
|
||||
function(set_version_info target)
|
||||
set_target_properties(${target}
|
||||
PROPERTIES
|
||||
VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}
|
||||
SOVERSION ${WAMR_VERSION_MAJOR}
|
||||
)
|
||||
endfunction()
|
|
@ -1,34 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
readonly CURRENT_PATH=$(dirname "$(realpath "$0")")
|
||||
readonly ROOT=$(realpath "${CURRENT_PATH}/..")
|
||||
readonly VARIANT=$(lsb_release -c | awk '{print $2}')
|
||||
|
||||
docker build \
|
||||
--memory=4G --cpu-quota=50000 \
|
||||
-t wamr_dev_${VARIANT}:0.1 -f "${ROOT}"/.devcontainer/Dockerfile "${ROOT}"/.devcontainer \
|
||||
&& docker run --rm -it \
|
||||
--cap-add=SYS_PTRACE \
|
||||
--cpus=".5" \
|
||||
--memory=4G \
|
||||
--mount type=bind,src="${ROOT}",dst=/workspaces \
|
||||
--name wamr_build_env \
|
||||
--security-opt=seccomp=unconfined \
|
||||
wamr_dev_${VARIANT}:0.1 \
|
||||
/bin/bash -c "\
|
||||
pwd \
|
||||
&& pushd product-mini/platforms/linux \
|
||||
&& rm -rf build \
|
||||
&& mkdir build \
|
||||
&& pushd build \
|
||||
&& cmake .. \
|
||||
&& make \
|
||||
&& popd \
|
||||
&& popd \
|
||||
&& echo 'Copying the binary ...' \
|
||||
&& rm -rf build_out \
|
||||
&& mkdir build_out \
|
||||
&& cp product-mini/platforms/linux/build/iwasm build_out/iwasm"
|
|
@ -1,330 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
import argparse
|
||||
import re
|
||||
from pathlib import Path
|
||||
import re
|
||||
import shlex
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
CLANG_FORMAT_CMD = "clang-format-14"
|
||||
GIT_CLANG_FORMAT_CMD = "git-clang-format-14"
|
||||
|
||||
# glob style patterns
|
||||
EXCLUDE_PATHS = [
|
||||
"**/.git/*",
|
||||
"**/.github/*",
|
||||
"**/.vscode/*",
|
||||
"**/build/*",
|
||||
"**/build-scripts/*",
|
||||
"**/ci/*",
|
||||
"**/core/deps/*",
|
||||
"**/doc/*",
|
||||
"**/samples/wasm-c-api/src/*.*",
|
||||
"**/samples/workload/*",
|
||||
"**/test-tools/wasi-sdk/*",
|
||||
"**/tests/wamr-test-suites/workspace/*",
|
||||
]
|
||||
|
||||
C_SUFFIXES = [".c", ".cc", ".cpp", ".h"]
|
||||
INVALID_DIR_NAME_SEGMENT = r"([a-zA-Z0-9]+\_[a-zA-Z0-9]+)"
|
||||
INVALID_FILE_NAME_SEGMENT = r"([a-zA-Z0-9]+\-[a-zA-Z0-9]+)"
|
||||
|
||||
|
||||
def locate_command(command: str) -> bool:
|
||||
if not shutil.which(command):
|
||||
print(f"Command '{command}'' not found")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def is_excluded(path: str) -> bool:
|
||||
path = Path(path).resolve()
|
||||
for exclude_path in EXCLUDE_PATHS:
|
||||
if path.match(exclude_path):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def pre_flight_check(root: Path) -> bool:
|
||||
def check_aspell(root):
|
||||
return True
|
||||
|
||||
def check_clang_format(root: Path) -> bool:
|
||||
if not locate_command(CLANG_FORMAT_CMD):
|
||||
return False
|
||||
|
||||
# Quick syntax check for .clang-format
|
||||
try:
|
||||
subprocess.check_output(
|
||||
shlex.split(f"{CLANG_FORMAT_CMD} --dump-config"), cwd=root
|
||||
)
|
||||
except subprocess.CalledProcessError:
|
||||
print(f"Might have a typo in .clang-format")
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_git_clang_format() -> bool:
|
||||
return locate_command(GIT_CLANG_FORMAT_CMD)
|
||||
|
||||
return check_aspell(root) and check_clang_format(root) and check_git_clang_format()
|
||||
|
||||
|
||||
def run_clang_format(file_path: Path, root: Path) -> bool:
|
||||
try:
|
||||
subprocess.check_call(
|
||||
shlex.split(
|
||||
f"{CLANG_FORMAT_CMD} --style=file --Werror --dry-run {file_path}"
|
||||
),
|
||||
cwd=root,
|
||||
)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
print(f"{file_path} failed the check of {CLANG_FORMAT_CMD}")
|
||||
return False
|
||||
|
||||
|
||||
def run_clang_format_diff(root: Path, commits: str) -> bool:
|
||||
"""
|
||||
Use `clang-format-14` or `git-clang-format-14` to check code format of
|
||||
the PR, with a commit range specified. It is required to format the
|
||||
code before committing the PR, or it might fail to pass the CI check:
|
||||
|
||||
1. Install clang-format-14.0.0
|
||||
|
||||
You can download the package from
|
||||
https://github.com/llvm/llvm-project/releases
|
||||
and install it.
|
||||
|
||||
For Debian/Ubuntu, we can probably use
|
||||
`sudo apt-get install clang-format-14`.
|
||||
|
||||
Homebrew has it as a part of llvm@14.
|
||||
```shell
|
||||
brew install llvm@14
|
||||
/usr/local/opt/llvm@14/bin/clang-format
|
||||
```
|
||||
|
||||
2. Format the C/C++ source file
|
||||
``` shell
|
||||
cd path/to/wamr/root
|
||||
clang-format-14 --style file -i path/to/file
|
||||
```
|
||||
|
||||
The code wrapped by `/* clang-format off */` and `/* clang-format on */`
|
||||
will not be formatted, you shall use them when the formatted code is not
|
||||
readable or friendly:
|
||||
|
||||
``` cc
|
||||
/* clang-format off */
|
||||
code snippets
|
||||
/* clang-format on */
|
||||
```
|
||||
|
||||
"""
|
||||
try:
|
||||
before, after = commits.split("..")
|
||||
after = after if after else "HEAD"
|
||||
COMMAND = (
|
||||
f"{GIT_CLANG_FORMAT_CMD} -v --binary "
|
||||
f"{shutil.which(CLANG_FORMAT_CMD)} --style file "
|
||||
f"--extensions c,cpp,h --diff {before} {after}"
|
||||
)
|
||||
|
||||
p = subprocess.Popen(
|
||||
shlex.split(COMMAND),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=None,
|
||||
stdin=None,
|
||||
universal_newlines=True,
|
||||
)
|
||||
|
||||
stdout, _ = p.communicate()
|
||||
if not stdout.startswith("diff --git"):
|
||||
return True
|
||||
|
||||
diff_content = stdout.split("\n")
|
||||
found = False
|
||||
for summary in [x for x in diff_content if x.startswith("diff --git")]:
|
||||
# b/path/to/file -> path/to/file
|
||||
with_invalid_format = re.split(r"\s+", summary)[-1][2:]
|
||||
if not is_excluded(with_invalid_format):
|
||||
print(f"--- {with_invalid_format} failed on code style checking.")
|
||||
found = True
|
||||
else:
|
||||
return not found
|
||||
except subprocess.subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
|
||||
def run_aspell(file_path: Path, root: Path) -> bool:
|
||||
return True
|
||||
|
||||
|
||||
def check_dir_name(path: Path, root: Path) -> bool:
|
||||
m = re.search(INVALID_DIR_NAME_SEGMENT, str(path.relative_to(root).parent))
|
||||
if m:
|
||||
print(f"--- found a character '_' in {m.groups()} in {path}")
|
||||
|
||||
return not m
|
||||
|
||||
|
||||
def check_file_name(path: Path) -> bool:
|
||||
"""
|
||||
file names should not contain any character '-'
|
||||
|
||||
but some names are well known and use '-' as the separator, e.g.:
|
||||
- docker-compose
|
||||
- package-lock
|
||||
- vite-env.d
|
||||
"""
|
||||
if path.stem in [
|
||||
"docker-compose",
|
||||
"package-lock",
|
||||
"vite-env.d",
|
||||
"osv-scanner",
|
||||
]:
|
||||
return True
|
||||
|
||||
m = re.search(INVALID_FILE_NAME_SEGMENT, path.stem)
|
||||
if m:
|
||||
print(f"--- found a character '-' in {m.groups()} in {path}")
|
||||
|
||||
return not m
|
||||
|
||||
|
||||
def parse_commits_range(root: Path, commits: str) -> list:
|
||||
GIT_LOG_CMD = f"git log --pretty='%H' {commits}"
|
||||
try:
|
||||
ret = subprocess.check_output(
|
||||
shlex.split(GIT_LOG_CMD), cwd=root, universal_newlines=True
|
||||
)
|
||||
return [x for x in ret.split("\n") if x]
|
||||
except subprocess.CalledProcessError:
|
||||
print(f"can not parse any commit from the range {commits}")
|
||||
return []
|
||||
|
||||
|
||||
def analysis_new_item_name(root: Path, commit: str) -> bool:
|
||||
"""
|
||||
For any file name in the repo, it is required to use '_' to replace '-'.
|
||||
|
||||
For any directory name in the repo, it is required to use '-' to replace '_'.
|
||||
"""
|
||||
GIT_SHOW_CMD = f"git show --oneline --name-status --diff-filter A {commit}"
|
||||
try:
|
||||
invalid_items = True
|
||||
output = subprocess.check_output(
|
||||
shlex.split(GIT_SHOW_CMD), cwd=root, universal_newlines=True
|
||||
)
|
||||
if not output:
|
||||
return True
|
||||
|
||||
NEW_FILE_PATTERN = "^A\s+(\S+)"
|
||||
for line_no, line in enumerate(output.split("\n")):
|
||||
# bypass the first line, usually it is the commit description
|
||||
if line_no == 0:
|
||||
continue
|
||||
|
||||
if not line:
|
||||
continue
|
||||
|
||||
match = re.match(NEW_FILE_PATTERN, line)
|
||||
if not match:
|
||||
continue
|
||||
|
||||
new_item = match.group(1)
|
||||
new_item = Path(new_item).resolve()
|
||||
|
||||
if new_item.is_file():
|
||||
if not check_file_name(new_item):
|
||||
invalid_items = False
|
||||
continue
|
||||
|
||||
new_item = new_item.parent
|
||||
|
||||
if not check_dir_name(new_item, root):
|
||||
invalid_items = False
|
||||
continue
|
||||
else:
|
||||
return invalid_items
|
||||
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
|
||||
|
||||
def process_entire_pr(root: Path, commits: str) -> bool:
|
||||
if not commits:
|
||||
print("Please provide a commits range")
|
||||
return False
|
||||
|
||||
commit_list = parse_commits_range(root, commits)
|
||||
if not commit_list:
|
||||
print(f"Quit since there is no commit to check with")
|
||||
return True
|
||||
|
||||
print(f"there are {len(commit_list)} commits in the PR")
|
||||
|
||||
found = False
|
||||
if not analysis_new_item_name(root, commits):
|
||||
print(f"{analysis_new_item_name.__doc__}")
|
||||
found = True
|
||||
|
||||
if not run_clang_format_diff(root, commits):
|
||||
print(f"{run_clang_format_diff.__doc__}")
|
||||
found = True
|
||||
|
||||
return not found
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Check if change meets all coding guideline requirements"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-c", "--commits", default=None, help="Commit range in the form: a..b"
|
||||
)
|
||||
options = parser.parse_args()
|
||||
|
||||
wamr_root = Path(__file__).parent.joinpath("..").resolve()
|
||||
|
||||
if not pre_flight_check(wamr_root):
|
||||
return False
|
||||
|
||||
return process_entire_pr(wamr_root, options.commits)
|
||||
|
||||
|
||||
# run with python3 -m unitest ci/coding_guidelines_check.py
|
||||
class TestCheck(unittest.TestCase):
|
||||
def test_check_dir_name_failed(self):
|
||||
root = Path("/root/Workspace/")
|
||||
new_file_path = root.joinpath("core/shared/platform/esp_idf/espid_memmap.c")
|
||||
self.assertFalse(check_dir_name(new_file_path, root))
|
||||
|
||||
def test_check_dir_name_pass(self):
|
||||
root = Path("/root/Workspace/")
|
||||
new_file_path = root.joinpath("core/shared/platform/esp-idf/espid_memmap.c")
|
||||
self.assertTrue(check_dir_name(new_file_path, root))
|
||||
|
||||
def test_check_file_name_failed(self):
|
||||
new_file_path = Path(
|
||||
"/root/Workspace/core/shared/platform/esp-idf/espid-memmap.c"
|
||||
)
|
||||
self.assertFalse(check_file_name(new_file_path))
|
||||
|
||||
def test_check_file_name_pass(self):
|
||||
new_file_path = Path(
|
||||
"/root/Workspace/core/shared/platform/esp-idf/espid_memmap.c"
|
||||
)
|
||||
self.assertTrue(check_file_name(new_file_path))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(0 if main() else 1)
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# This is a sample of pre-commit hook that can be used to make your code fit the WAMR CI code style requirements.
|
||||
# You need to have clang-format-12 installed to use this hook.
|
||||
# To add this pre-commit hook, copy it to <path_to_wamr>/.git/hooks/pre-commit
|
||||
# (you don't need any extensions here)
|
||||
|
||||
# Function to check if a file has a C or C++ extension
|
||||
|
||||
is_c_or_cpp_file() {
|
||||
file="$1"
|
||||
if [[ "$filename" =~ \.(h|c|cpp)$ ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Loop through staged files and apply command "abc" to C and C++ files
|
||||
for staged_file in $(git diff --cached --name-only); do
|
||||
if is_c_or_cpp_file "$staged_file"; then
|
||||
clang-format-12 -Werror --style file --dry-run "$staged_file" 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Issues are found in $staged_file. Applying the fix"
|
||||
clang-format-12 --style file -i "$staged_file"
|
||||
fi
|
||||
git add "$staged_file" # Add the modified file back to staging
|
||||
fi
|
||||
done
|
15
ci/setup.sh
15
ci/setup.sh
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
# This script executes some commands to make your onboarding with WAMR easier.
|
||||
# For example, setting pre-commit hook that will make your code complaint with the
|
||||
# code style requirements checked in WAMR CI
|
||||
|
||||
echo "Copy the pre-commit hook to your hooks folder"
|
||||
cp pre_commit_hook_sample ../.git/hooks/pre-commit
|
||||
|
||||
# Feel free to propose your commands to this script to make developing WAMR easier
|
||||
|
||||
echo "Setup is done"
|
|
@ -1,128 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2023 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
import argparse
|
||||
import time
|
||||
from pathlib import Path
|
||||
import subprocess, shlex
|
||||
|
||||
SCRIPT_DIR = Path(__file__).parent.resolve()
|
||||
REPO_ROOT_DIR = SCRIPT_DIR.parent
|
||||
SAMPLE_CODE_FILE = REPO_ROOT_DIR / 'product-mini/app-samples/hello-world/main.c'
|
||||
WASM_OUT_FILE = SCRIPT_DIR / 'out.wasm'
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Validate the customized lldb with sample code"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-l", "--lldb", dest='lldb', default='lldb', help="path to lldb executable"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-w", "--wamr", dest='wamr', default='iwasm', help="path to iwasm executable"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-p", "--port", dest='port', default='1234', help="debug server listen port"
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", dest='verbose', action='store_true', default=False, help="display lldb stdout"
|
||||
)
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
lldb_command_epilogue = '-o q'
|
||||
|
||||
test_cases = {
|
||||
'run_to_exit': '-o c',
|
||||
'func_breakpoint': '-o "b main" -o c -o c',
|
||||
'line_breakpoint': '-o "b main.c:12" -o c -o c',
|
||||
'break_on_unknown_func': '-o "b not_a_func" -o c',
|
||||
'watch_point': '-o "b main" -o c -o "watchpoint set variable buf" -o c -o "fr v buf" -o c',
|
||||
}
|
||||
|
||||
# Step1: Build wasm module with debug information
|
||||
build_cmd = f'/opt/wasi-sdk/bin/clang -g -O0 -o {WASM_OUT_FILE} {SAMPLE_CODE_FILE}'
|
||||
try:
|
||||
print(f'building wasm module ...', end='', flush=True)
|
||||
subprocess.check_call(shlex.split(build_cmd))
|
||||
print(f'\t OK')
|
||||
except subprocess.CalledProcessError:
|
||||
print("Failed to build wasm module with debug information")
|
||||
exit(1)
|
||||
|
||||
def print_process_output(p):
|
||||
try:
|
||||
outs, errs = p.communicate(timeout=2)
|
||||
print("stdout:")
|
||||
print(outs)
|
||||
print("stderr:")
|
||||
print(errs)
|
||||
except subprocess.TimeoutExpired:
|
||||
print("Failed to get process output")
|
||||
|
||||
# Step2: Launch WAMR in debug mode and validate lldb commands
|
||||
|
||||
iteration = 0
|
||||
for case, cmd in test_cases.items():
|
||||
lldb_command_prologue = f'{options.lldb} -o "process connect -p wasm connect://127.0.0.1:{int(options.port) + iteration}"'
|
||||
wamr_cmd = f'{options.wamr} -g=127.0.0.1:{int(options.port) + iteration} {WASM_OUT_FILE}'
|
||||
iteration += 1
|
||||
|
||||
has_error = False
|
||||
print(f'validating case [{case}] ...', end='', flush=True)
|
||||
lldb_cmd = f'{lldb_command_prologue} {cmd} {lldb_command_epilogue}'
|
||||
|
||||
wamr_process = subprocess.Popen(shlex.split(
|
||||
wamr_cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||
|
||||
time.sleep(0.1)
|
||||
if (wamr_process.poll() != None):
|
||||
print("\nWAMR doesn't wait for lldb connection")
|
||||
print_process_output(wamr_process)
|
||||
exit(1)
|
||||
|
||||
lldb_process = subprocess.Popen(shlex.split(
|
||||
lldb_cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
|
||||
|
||||
if (options.verbose):
|
||||
while (lldb_process.poll() is None):
|
||||
print(lldb_process.stdout.read(), end='', flush=True)
|
||||
|
||||
try:
|
||||
if (lldb_process.wait(5) != 0):
|
||||
print(f"\nFailed to validate case [{case}]")
|
||||
print_process_output(lldb_process)
|
||||
has_error = True
|
||||
|
||||
if wamr_process.wait(2) != 0:
|
||||
print("\nWAMR process doesn't exit normally")
|
||||
print_process_output(wamr_process)
|
||||
has_error = True
|
||||
|
||||
except subprocess.TimeoutExpired:
|
||||
print(f"\nFailed to validate case [{case}]")
|
||||
print("wamr output:")
|
||||
print_process_output(wamr_process)
|
||||
print("lldb output:")
|
||||
print_process_output(lldb_process)
|
||||
has_error = True
|
||||
finally:
|
||||
if (lldb_process.poll() == None):
|
||||
print(f'\nterminating lldb process [{lldb_process.pid}]')
|
||||
lldb_process.kill()
|
||||
if (wamr_process.poll() == None):
|
||||
print(f'terminating wamr process [{wamr_process.pid}]')
|
||||
wamr_process.kill()
|
||||
|
||||
if (has_error):
|
||||
exit(1)
|
||||
|
||||
print(f'\t OK')
|
||||
|
||||
# wait 100ms to ensure the socket is closed
|
||||
time.sleep(0.1)
|
||||
|
||||
print('Validate lldb success')
|
||||
exit(0)
|
397
core/app-mgr/app-manager/app_manager.c
Normal file
397
core/app-mgr/app-manager/app_manager.c
Normal file
|
@ -0,0 +1,397 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "app_manager.h"
|
||||
#include "app_manager_host.h"
|
||||
#include "bh_queue.h"
|
||||
#include "bh_memory.h"
|
||||
#include "bh_thread.h"
|
||||
#include "attr_container.h"
|
||||
#include "event.h"
|
||||
#include "watchdog.h"
|
||||
#include "coap_ext.h"
|
||||
|
||||
/* Queue of app manager */
|
||||
static bh_queue *g_app_mgr_queue;
|
||||
|
||||
void*
|
||||
get_app_manager_queue()
|
||||
{
|
||||
return g_app_mgr_queue;
|
||||
}
|
||||
|
||||
void app_manager_post_applets_update_event()
|
||||
{
|
||||
module_data *m_data;
|
||||
attr_container_t *attr_cont;
|
||||
request_t msg;
|
||||
int num = 0, i = 0;
|
||||
char *url = "/applets";
|
||||
|
||||
if (!event_is_registered(url))
|
||||
return;
|
||||
|
||||
if (!(attr_cont = attr_container_create("All Applets"))) {
|
||||
app_manager_printf(
|
||||
"Post applets update event failed: allocate memory failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
|
||||
m_data = module_data_list;
|
||||
while (m_data) {
|
||||
num++;
|
||||
m_data = m_data->next;
|
||||
}
|
||||
|
||||
if (!(attr_container_set_int(&attr_cont, "num", num))) {
|
||||
app_manager_printf(
|
||||
"Post applets update event failed: set attr container key failed.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
m_data = module_data_list;
|
||||
while (m_data) {
|
||||
char buf[32];
|
||||
i++;
|
||||
snprintf(buf, sizeof(buf), "%s%d", "applet", i);
|
||||
if (!(attr_container_set_string(&attr_cont, buf, m_data->module_name))) {
|
||||
app_manager_printf(
|
||||
"Post applets update event failed: set attr applet name key failed.");
|
||||
goto fail;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s%d", "heap", i);
|
||||
if (!(attr_container_set_int(&attr_cont, buf, m_data->heap_size))) {
|
||||
app_manager_printf(
|
||||
"Post applets update event failed: set attr heap key failed.");
|
||||
goto fail;
|
||||
}
|
||||
m_data = m_data->next;
|
||||
}
|
||||
|
||||
memset(&msg, 0, sizeof(msg));
|
||||
msg.url = url;
|
||||
msg.action = COAP_EVENT;
|
||||
msg.payload = (char*) attr_cont;
|
||||
send_request_to_host(&msg);
|
||||
|
||||
app_manager_printf("Post applets update event success!\n");
|
||||
attr_container_dump(attr_cont);
|
||||
|
||||
fail: vm_mutex_unlock(&module_data_list_lock);
|
||||
attr_container_destroy(attr_cont);
|
||||
}
|
||||
|
||||
static int get_applets_count()
|
||||
{
|
||||
module_data *m_data;
|
||||
int num = 0;
|
||||
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
|
||||
m_data = module_data_list;
|
||||
while (m_data) {
|
||||
num++;
|
||||
m_data = m_data->next;
|
||||
}
|
||||
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
/* Query fw apps info if name = NULL, otherwise query specify app */
|
||||
static bool app_manager_query_applets(request_t *msg, const char *name)
|
||||
{
|
||||
module_data *m_data;
|
||||
attr_container_t *attr_cont;
|
||||
int num = 0, i = 0, len;
|
||||
bool ret = false, found = false;
|
||||
response_t response[1] = { 0 };
|
||||
|
||||
attr_cont = attr_container_create("Applets Info");
|
||||
if (!attr_cont) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applets failed: allocate memory failed.");
|
||||
return false;
|
||||
}
|
||||
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
|
||||
m_data = module_data_list;
|
||||
while (m_data) {
|
||||
num++;
|
||||
m_data = m_data->next;
|
||||
}
|
||||
|
||||
if (name == NULL && !(attr_container_set_int(&attr_cont, "num", num))) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applets failed: set attr container key failed.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
m_data = module_data_list;
|
||||
while (m_data) {
|
||||
char buf[32];
|
||||
|
||||
if (name == NULL) {
|
||||
i++;
|
||||
snprintf(buf, sizeof(buf), "%s%d", "applet", i);
|
||||
if (!(attr_container_set_string(&attr_cont, buf,
|
||||
m_data->module_name))) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applets failed: set attr container key failed.");
|
||||
goto fail;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "%s%d", "heap", i);
|
||||
if (!(attr_container_set_int(&attr_cont, buf, m_data->heap_size))) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applets failed: set attr container heap key failed.");
|
||||
goto fail;
|
||||
}
|
||||
} else if (!strcmp(name, m_data->module_name)) {
|
||||
found = true;
|
||||
if (!(attr_container_set_string(&attr_cont, "name",
|
||||
m_data->module_name))) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applet failed: set attr container key failed.");
|
||||
goto fail;
|
||||
}
|
||||
if (!(attr_container_set_int(&attr_cont, "heap", m_data->heap_size))) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applet failed: set attr container heap key failed.");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
m_data = m_data->next;
|
||||
}
|
||||
|
||||
if (name != NULL && !found) {
|
||||
SEND_ERR_RESPONSE(msg->mid,
|
||||
"Query Applet failed: the app is not found.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
len = attr_container_get_serialize_length(attr_cont);
|
||||
|
||||
make_response_for_request(msg, response);
|
||||
set_response(response, CONTENT_2_05,
|
||||
FMT_ATTR_CONTAINER, (char*) attr_cont, len);
|
||||
send_response_to_host(response);
|
||||
|
||||
ret = true;
|
||||
app_manager_printf("Query Applets success!\n");
|
||||
attr_container_dump(attr_cont);
|
||||
|
||||
fail: vm_mutex_unlock(&module_data_list_lock);
|
||||
attr_container_destroy(attr_cont);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void applet_mgt_reqeust_handler(request_t *request, void *unused)
|
||||
{
|
||||
bh_message_t msg;
|
||||
/* deep copy, but not use app self heap, but use global heap */
|
||||
request_t *req = clone_request(request);
|
||||
|
||||
if (!req)
|
||||
return;
|
||||
|
||||
msg = bh_new_msg(RESTFUL_REQUEST, req, sizeof(*req), request_cleaner);
|
||||
if (!msg) {
|
||||
request_cleaner(req);
|
||||
return;
|
||||
}
|
||||
|
||||
bh_post_msg2(get_app_manager_queue(), msg);
|
||||
}
|
||||
|
||||
/* return -1 for error */
|
||||
static int get_module_type(char *kv_str)
|
||||
{
|
||||
int module_type = -1;
|
||||
char type_str[8] = { 0 };
|
||||
|
||||
find_key_value(kv_str, strlen(kv_str), "type", type_str,
|
||||
sizeof(type_str) - 1, '&');
|
||||
|
||||
if (strlen(type_str) == 0)
|
||||
module_type = Module_WASM_App;
|
||||
else if (strcmp(type_str, "jeff") == 0)
|
||||
module_type = Module_Jeff;
|
||||
else if (strcmp(type_str, "wasm") == 0)
|
||||
module_type = Module_WASM_App;
|
||||
else if (strcmp(type_str, "wasmlib") == 0)
|
||||
module_type = Module_WASM_Lib;
|
||||
|
||||
return module_type;
|
||||
}
|
||||
|
||||
#define APP_NAME_MAX_LEN 128
|
||||
|
||||
/* Queue callback of App Manager */
|
||||
|
||||
static void app_manager_queue_callback(void *message, void *arg)
|
||||
{
|
||||
request_t *request = (request_t *) bh_message_payload((bh_message_t)message);
|
||||
int mid = request->mid, module_type, offset;
|
||||
|
||||
(void)arg;
|
||||
|
||||
if ((offset = check_url_start(request->url, strlen(request->url), "/applet"))
|
||||
> 0) {
|
||||
module_type = get_module_type(request->url + offset);
|
||||
|
||||
if (module_type == -1) {
|
||||
SEND_ERR_RESPONSE(mid,
|
||||
"Applet Management failed: invalid module type.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Install Applet */
|
||||
if (request->action == COAP_PUT) {
|
||||
if (get_applets_count() >= MAX_APP_INSTALLATIONS) {
|
||||
SEND_ERR_RESPONSE(mid,
|
||||
"Install Applet failed: exceed max app installations.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!request->payload) {
|
||||
SEND_ERR_RESPONSE(mid,
|
||||
"Install Applet failed: invalid payload.");
|
||||
goto fail;
|
||||
}
|
||||
if (g_module_interfaces[module_type]
|
||||
&& g_module_interfaces[module_type]->module_install) {
|
||||
if (!g_module_interfaces[module_type]->module_install(request))
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
/* Uninstall Applet */
|
||||
else if (request->action == COAP_DELETE) {
|
||||
module_type = get_module_type(request->url + offset);
|
||||
if (module_type == -1) {
|
||||
SEND_ERR_RESPONSE(mid,
|
||||
"Uninstall Applet failed: invalid module type.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (g_module_interfaces[module_type]
|
||||
&& g_module_interfaces[module_type]->module_uninstall) {
|
||||
if (!g_module_interfaces[module_type]->module_uninstall(
|
||||
request))
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
/* Query Applets installed */
|
||||
else if (request->action == COAP_GET) {
|
||||
char name[APP_NAME_MAX_LEN] = { 0 };
|
||||
char *properties = request->url + offset;
|
||||
find_key_value(properties, strlen(properties), "name", name,
|
||||
sizeof(name) - 1, '&');
|
||||
if (strlen(name) > 0)
|
||||
app_manager_query_applets(request, name);
|
||||
else
|
||||
app_manager_query_applets(request, NULL);
|
||||
} else {
|
||||
SEND_ERR_RESPONSE(mid, "Invalid request of applet: invalid action");
|
||||
}
|
||||
}
|
||||
/* Event Register/Unregister */
|
||||
else if ((offset = check_url_start(request->url, strlen(request->url),
|
||||
"/event/")) > 0) {
|
||||
char url_buf[256] = { 0 };
|
||||
|
||||
strncpy(url_buf, request->url + offset, sizeof(url_buf) - 1);
|
||||
|
||||
if (!event_handle_event_request(request->action, url_buf, ID_HOST)) {
|
||||
SEND_ERR_RESPONSE(mid, "Handle event request failed.");
|
||||
goto fail;
|
||||
}
|
||||
send_error_response_to_host(mid, CONTENT_2_05, NULL); /* OK */
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < Module_Max; i++) {
|
||||
if (g_module_interfaces[i]
|
||||
&& g_module_interfaces[i]->module_handle_host_url) {
|
||||
if (g_module_interfaces[i]->module_handle_host_url(request))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fail:
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
static void module_interfaces_init()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < Module_Max; i++) {
|
||||
if (g_module_interfaces[i] && g_module_interfaces[i]->module_init)
|
||||
g_module_interfaces[i]->module_init();
|
||||
}
|
||||
}
|
||||
|
||||
void app_manager_startup(host_interface *interface)
|
||||
{
|
||||
module_interfaces_init();
|
||||
|
||||
/* Create queue of App Manager */
|
||||
g_app_mgr_queue = bh_queue_create();
|
||||
if (!g_app_mgr_queue)
|
||||
return;
|
||||
|
||||
if (!module_data_list_init())
|
||||
goto fail1;
|
||||
|
||||
if (!watchdog_startup())
|
||||
goto fail2;
|
||||
|
||||
/* Initialize Host */
|
||||
app_manager_host_init(interface);
|
||||
|
||||
am_register_resource("/app/", targeted_app_request_handler, ID_APP_MGR);
|
||||
|
||||
/*/app/ and /event/ are both processed by applet_mgt_reqeust_handler*/
|
||||
am_register_resource("/applet", applet_mgt_reqeust_handler, ID_APP_MGR);
|
||||
am_register_resource("/event/", applet_mgt_reqeust_handler, ID_APP_MGR);
|
||||
|
||||
app_manager_printf("App Manager started.\n");
|
||||
|
||||
/* Enter loop run */
|
||||
bh_queue_enter_loop_run(g_app_mgr_queue, app_manager_queue_callback, NULL);
|
||||
|
||||
fail2: module_data_list_destroy();
|
||||
|
||||
fail1: bh_queue_destroy(g_app_mgr_queue);
|
||||
}
|
||||
|
||||
#include "module_config.h"
|
||||
|
||||
module_interface *g_module_interfaces[Module_Max] = {
|
||||
#if ENABLE_MODULE_JEFF != 0
|
||||
&jeff_module_interface,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
|
||||
#if ENABLE_MODULE_WASM_APP != 0
|
||||
&wasm_app_module_interface,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
|
||||
#if ENABLE_MODULE_WASM_LIB != 0
|
||||
&wasm_lib_module_interface
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
};
|
92
core/app-mgr/app-manager/app_manager.h
Normal file
92
core/app-mgr/app-manager/app_manager.h
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef APP_MANAGER_H
|
||||
#define APP_MANAGER_H
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "bh_common.h"
|
||||
#include "bh_queue.h"
|
||||
#include "bh_types.h"
|
||||
#include "app_manager_export.h"
|
||||
#include "native_interface.h"
|
||||
#include "shared_utils.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __ZEPHYR__
|
||||
#define app_manager_printf printf
|
||||
#else
|
||||
#define app_manager_printf printk
|
||||
#endif
|
||||
|
||||
#define SEND_ERR_RESPONSE(mid, err_msg) do { \
|
||||
app_manager_printf("%s\n", err_msg); \
|
||||
send_error_response_to_host(mid, INTERNAL_SERVER_ERROR_5_00, err_msg); \
|
||||
} while (0)
|
||||
|
||||
extern module_interface *g_module_interfaces[Module_Max];
|
||||
|
||||
/* Lock of the module data list */
|
||||
extern korp_mutex module_data_list_lock;
|
||||
|
||||
/* Module data list */
|
||||
extern module_data *module_data_list;
|
||||
|
||||
void
|
||||
app_manager_add_module_data(module_data *m_data);
|
||||
|
||||
void
|
||||
app_manager_del_module_data(module_data *m_data);
|
||||
|
||||
bool
|
||||
module_data_list_init();
|
||||
|
||||
void
|
||||
module_data_list_destroy();
|
||||
|
||||
bool
|
||||
app_manager_is_interrupting_module(uint32 module_type, void *module_inst);
|
||||
|
||||
void release_module(module_data *m_data);
|
||||
|
||||
void
|
||||
module_data_list_remove(module_data *m_data);
|
||||
|
||||
void*
|
||||
app_manager_timer_create(void (*timer_callback)(void*),
|
||||
watchdog_timer *wd_timer);
|
||||
|
||||
void
|
||||
app_manager_timer_destroy(void *timer);
|
||||
|
||||
void
|
||||
app_manager_timer_start(void *timer, int timeout);
|
||||
|
||||
void
|
||||
app_manager_timer_stop(void *timer);
|
||||
|
||||
watchdog_timer*
|
||||
app_manager_get_wd_timer_from_timer_handle(void *timer);
|
||||
|
||||
int
|
||||
app_manager_signature_verify(const uint8_t *file, unsigned int file_len,
|
||||
const uint8_t *signature, unsigned int sig_size);
|
||||
|
||||
void targeted_app_request_handler(request_t *request, void *unused);
|
||||
|
||||
#if BEIHAI_ENABLE_TOOL_AGENT != 0
|
||||
void *
|
||||
app_manager_get_tool_agent_queue();
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
292
core/app-mgr/app-manager/app_manager_host.c
Normal file
292
core/app-mgr/app-manager/app_manager_host.c
Normal file
|
@ -0,0 +1,292 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "bh_common.h"
|
||||
#include "bh_types.h"
|
||||
#include "app_manager_host.h"
|
||||
#include "app_manager.h"
|
||||
#include "app_manager_export.h"
|
||||
#include "coap_ext.h"
|
||||
#include "bh_memory.h"
|
||||
#include "bh_thread.h"
|
||||
|
||||
/* host communication interface */
|
||||
static host_interface host_commu;
|
||||
|
||||
/* IMRTLink Two leading bytes */
|
||||
static unsigned char leadings[] = { (unsigned char) 0x12, (unsigned char) 0x34 };
|
||||
|
||||
/* IMRTLink Receiving Phase */
|
||||
typedef enum recv_phase_t {
|
||||
Phase_Non_Start, Phase_Leading, Phase_Type, Phase_Size, Phase_Payload
|
||||
} recv_phase_t;
|
||||
|
||||
/* IMRTLink Receive Context */
|
||||
typedef struct recv_context_t {
|
||||
recv_phase_t phase;
|
||||
bh_link_msg_t message;
|
||||
int size_in_phase;
|
||||
} recv_context_t;
|
||||
|
||||
/* Current IMRTLink receive context */
|
||||
static recv_context_t recv_ctx;
|
||||
|
||||
/* Lock for device write */
|
||||
static korp_mutex host_lock;
|
||||
|
||||
static bool enable_log = false;
|
||||
|
||||
static bool is_little_endian()
|
||||
{
|
||||
long i = 0x01020304;
|
||||
unsigned char* c = (unsigned char*) &i;
|
||||
return (*c == 0x04) ? true : false;
|
||||
}
|
||||
|
||||
static void exchange32(uint8* pData)
|
||||
{
|
||||
uint8 value = *pData;
|
||||
*pData = *(pData + 3);
|
||||
*(pData + 3) = value;
|
||||
|
||||
value = *(pData + 1);
|
||||
*(pData + 1) = *(pData + 2);
|
||||
*(pData + 2) = value;
|
||||
}
|
||||
|
||||
/* return:
|
||||
* 1: complete message received
|
||||
* 0: incomplete message received
|
||||
*/
|
||||
static int on_imrt_link_byte_arrive(unsigned char ch, recv_context_t *ctx)
|
||||
{
|
||||
if (ctx->phase == Phase_Non_Start) {
|
||||
ctx->message.payload_size = 0;
|
||||
|
||||
if (ctx->message.payload) {
|
||||
bh_free(ctx->message.payload);
|
||||
ctx->message.payload = NULL;
|
||||
}
|
||||
|
||||
if (ch == leadings[0]) {
|
||||
if (enable_log)
|
||||
app_manager_printf("##On byte arrive: got leading 0\n");
|
||||
ctx->phase = Phase_Leading;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else if (ctx->phase == Phase_Leading) {
|
||||
if (ch == leadings[1]) {
|
||||
if (enable_log)
|
||||
app_manager_printf("##On byte arrive: got leading 1\n");
|
||||
ctx->phase = Phase_Type;
|
||||
} else
|
||||
ctx->phase = Phase_Non_Start;
|
||||
|
||||
return 0;
|
||||
} else if (ctx->phase == Phase_Type) {
|
||||
if (ctx->size_in_phase++ == 0) {
|
||||
if (enable_log)
|
||||
app_manager_printf("##On byte arrive: got type 0\n");
|
||||
ctx->message.message_type = ch;
|
||||
} else {
|
||||
if (enable_log)
|
||||
app_manager_printf("##On byte arrive: got type 1\n");
|
||||
ctx->message.message_type |= (ch << 8);
|
||||
ctx->message.message_type = ntohs(ctx->message.message_type);
|
||||
ctx->phase = Phase_Size;
|
||||
ctx->size_in_phase = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else if (ctx->phase == Phase_Size) {
|
||||
unsigned char *p = (unsigned char *) &ctx->message.payload_size;
|
||||
|
||||
if (enable_log)
|
||||
app_manager_printf("##On byte arrive: got payload_size, byte %d\n",
|
||||
ctx->size_in_phase);
|
||||
p[ctx->size_in_phase++] = ch;
|
||||
|
||||
if (ctx->size_in_phase == sizeof(ctx->message.payload_size)) {
|
||||
#ifndef __ZEPHYR__
|
||||
ctx->message.payload_size = ntohl(ctx->message.payload_size);
|
||||
#else
|
||||
if (is_little_endian())
|
||||
exchange32((uint8*)&ctx->message.payload_size);
|
||||
#endif
|
||||
ctx->phase = Phase_Payload;
|
||||
|
||||
if (enable_log)
|
||||
app_manager_printf("##On byte arrive: payload_size: %d\n",
|
||||
ctx->message.payload_size);
|
||||
if (ctx->message.payload) {
|
||||
bh_free(ctx->message.payload);
|
||||
ctx->message.payload = NULL;
|
||||
}
|
||||
|
||||
/* message completion */
|
||||
if (ctx->message.payload_size == 0) {
|
||||
ctx->phase = Phase_Non_Start;
|
||||
if (enable_log)
|
||||
app_manager_printf(
|
||||
"##On byte arrive: receive end, payload_size is 0.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ctx->message.payload_size > 1024 * 1024) {
|
||||
ctx->phase = Phase_Non_Start;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ctx->message.message_type != INSTALL_WASM_BYTECODE_APP) {
|
||||
ctx->message.payload = (char *) bh_malloc(
|
||||
ctx->message.payload_size);
|
||||
if (!ctx->message.payload) {
|
||||
ctx->phase = Phase_Non_Start;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ctx->phase = Phase_Payload;
|
||||
ctx->size_in_phase = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else if (ctx->phase == Phase_Payload) {
|
||||
if (ctx->message.message_type == INSTALL_WASM_BYTECODE_APP) {
|
||||
int received_size;
|
||||
module_on_install_request_byte_arrive_func module_on_install =
|
||||
g_module_interfaces[Module_WASM_App]->module_on_install;
|
||||
|
||||
ctx->size_in_phase++;
|
||||
|
||||
if (module_on_install != NULL) {
|
||||
if (module_on_install(ch, ctx->message.payload_size,
|
||||
&received_size)) {
|
||||
if (received_size == ctx->message.payload_size) {
|
||||
/* whole wasm app received */
|
||||
ctx->phase = Phase_Non_Start;
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
/* receive or handle fail */
|
||||
ctx->phase = Phase_Non_Start;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
ctx->phase = Phase_Non_Start;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
ctx->message.payload[ctx->size_in_phase++] = ch;
|
||||
|
||||
if (ctx->size_in_phase == ctx->message.payload_size) {
|
||||
ctx->phase = Phase_Non_Start;
|
||||
if (enable_log)
|
||||
app_manager_printf(
|
||||
"##On byte arrive: receive end, payload_size is %d.\n",
|
||||
ctx->message.payload_size);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aee_host_msg_callback(void *msg, uint16_t msg_len)
|
||||
{
|
||||
unsigned char *p = msg, *p_end = p + msg_len;
|
||||
|
||||
/*app_manager_printf("App Manager receive %d bytes from Host\n", msg_len);*/
|
||||
|
||||
for (; p < p_end; p++) {
|
||||
int ret = on_imrt_link_byte_arrive(*p, &recv_ctx);
|
||||
|
||||
if (ret == 1) {
|
||||
if (recv_ctx.message.payload) {
|
||||
int msg_type = recv_ctx.message.message_type;
|
||||
|
||||
if (msg_type == REQUEST_PACKET) {
|
||||
request_t request;
|
||||
memset(&request, 0, sizeof(request));
|
||||
|
||||
if (!unpack_request(recv_ctx.message.payload,
|
||||
recv_ctx.message.payload_size, &request))
|
||||
continue;
|
||||
|
||||
request.sender = ID_HOST;
|
||||
|
||||
am_dispatch_request(&request);
|
||||
} else {
|
||||
printf("unexpected host msg type: %d\n", msg_type);
|
||||
}
|
||||
|
||||
bh_free(recv_ctx.message.payload);
|
||||
recv_ctx.message.payload = NULL;
|
||||
recv_ctx.message.payload_size = 0;
|
||||
}
|
||||
|
||||
memset(&recv_ctx, 0, sizeof(recv_ctx));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool app_manager_host_init(host_interface *interface)
|
||||
{
|
||||
vm_mutex_init(&host_lock);
|
||||
memset(&recv_ctx, 0, sizeof(recv_ctx));
|
||||
|
||||
host_commu.init = interface->init;
|
||||
host_commu.send = interface->send;
|
||||
host_commu.destroy = interface->destroy;
|
||||
|
||||
if (host_commu.init != NULL)
|
||||
return host_commu.init();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int app_manager_host_send_msg(int msg_type, const unsigned char *buf, int size)
|
||||
{
|
||||
/* send an IMRT LINK message contains the buf as payload */
|
||||
if (host_commu.send != NULL) {
|
||||
int size_s = size, n;
|
||||
char header[16];
|
||||
|
||||
vm_mutex_lock(&host_lock);
|
||||
/* leading bytes */
|
||||
bh_memcpy_s(header, 2, leadings, 2);
|
||||
|
||||
/* message type */
|
||||
// todo: check if use network byte order!!!
|
||||
*((uint16*) (header + 2)) = htons(msg_type);
|
||||
|
||||
/* payload length */
|
||||
if (is_little_endian())
|
||||
exchange32((uint8*) &size_s);
|
||||
|
||||
bh_memcpy_s(header + 4, 4, &size_s, 4);
|
||||
n = host_commu.send(NULL, header, 8);
|
||||
if (n != 8) {
|
||||
vm_mutex_unlock(&host_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* payload */
|
||||
n = host_commu.send(NULL, buf, size);
|
||||
vm_mutex_unlock(&host_lock);
|
||||
|
||||
printf("sent %d bytes to host\n", n);
|
||||
return n;
|
||||
} else {
|
||||
printf("no send api provided\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
24
core/app-mgr/app-manager/app_manager_host.h
Normal file
24
core/app-mgr/app-manager/app_manager_host.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _APP_MANAGER_HOST_H_
|
||||
#define _APP_MANAGER_HOST_H_
|
||||
|
||||
#include "wasm_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define HOST_MODE_AON 1
|
||||
#define HOST_MODE_UART 2
|
||||
#define HOST_MODE_TEST 3
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
12
core/app-mgr/app-manager/app_mgr.cmake
Normal file
12
core/app-mgr/app-manager/app_mgr.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
set (__APP_MGR_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include_directories(${__APP_MGR_DIR})
|
||||
|
||||
|
||||
file (GLOB source_all ${__APP_MGR_DIR}/*.c ${__APP_MGR_DIR}/platform/${TARGET_PLATFORM}/*.c)
|
||||
|
||||
set (APP_MGR_SOURCE ${source_all})
|
||||
|
115
core/app-mgr/app-manager/ble_msg.c
Normal file
115
core/app-mgr/app-manager/ble_msg.c
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#define BLUETOOTH_INTERFACE_ADVERTISMENT_DATA_LENGTH 31
|
||||
/* ble_device_info */
|
||||
typedef struct ble_device_info {
|
||||
|
||||
/* address type */
|
||||
uint8_t address_type;
|
||||
/* MAC of Device */
|
||||
uint8_t mac[6];
|
||||
/* security level */
|
||||
uint8_t security_level;
|
||||
/* signal strength */
|
||||
int8_t rssi;
|
||||
/* uuid_16_type */
|
||||
int8_t uuid_16_type;
|
||||
/* uuid_32_type */
|
||||
int8_t uuid_32_type;
|
||||
/* uuid_128_type */
|
||||
int8_t uuid_128_type;
|
||||
/* error code */
|
||||
uint8_t error_code;
|
||||
/* scan response length*/
|
||||
uint16_t adv_data_len;
|
||||
/* advertisement data */
|
||||
uint8_t *adv_data;
|
||||
/* scan response length*/
|
||||
uint16_t scan_response_len;
|
||||
/* scan response */
|
||||
uint8_t *scan_response;
|
||||
/* next device */
|
||||
struct ble_device_info *next;
|
||||
/* private data length */
|
||||
int private_data_length;
|
||||
/* private data */
|
||||
uint8_t *private_data;
|
||||
/* value handle*/
|
||||
uint16_t value_handle;
|
||||
/* ccc handle*/
|
||||
uint16_t ccc_handle;
|
||||
|
||||
}ble_device_info;
|
||||
|
||||
/* BLE message sub type */
|
||||
typedef enum BLE_SUB_EVENT_TYPE {
|
||||
BLE_SUB_EVENT_DISCOVERY,
|
||||
BLE_SUB_EVENT_CONNECTED,
|
||||
BLE_SUB_EVENT_DISCONNECTED,
|
||||
BLE_SUB_EVENT_NOTIFICATION,
|
||||
BLE_SUB_EVENT_INDICATION,
|
||||
BLE_SUB_EVENT_PASSKEYENTRY,
|
||||
BLE_SUB_EVENT_SECURITY_LEVEL_CHANGE
|
||||
}BLE_SUB_EVENT_TYPE;
|
||||
|
||||
/* Queue message, for BLE Event */
|
||||
typedef struct bh_queue_ble_sub_msg_t {
|
||||
/* message type, should be one of QUEUE_MSG_TYPE */
|
||||
BLE_SUB_EVENT_TYPE type;
|
||||
/* payload size */
|
||||
/*uint32_t payload_size;*/
|
||||
char payload[1];
|
||||
}bh_queue_ble_sub_msg_t;
|
||||
|
||||
static void
|
||||
app_instance_free_ble_msg(char *msg)
|
||||
{
|
||||
bh_queue_ble_sub_msg_t *ble_msg = (bh_queue_ble_sub_msg_t *)msg;
|
||||
ble_device_info *dev_info;
|
||||
|
||||
dev_info = (ble_device_info *) ble_msg->payload;
|
||||
|
||||
if (dev_info->scan_response != NULL)
|
||||
bh_free(dev_info->scan_response);
|
||||
|
||||
if (dev_info->private_data != NULL)
|
||||
bh_free(dev_info->private_data);
|
||||
|
||||
if (dev_info->adv_data != NULL)
|
||||
bh_free(dev_info->adv_data);
|
||||
|
||||
if (dev_info != NULL)
|
||||
bh_free(dev_info);
|
||||
}
|
||||
|
||||
static void
|
||||
app_instance_queue_free_callback(bh_message_t queue_msg)
|
||||
{
|
||||
|
||||
char * payload = (char *)bh_message_payload(queue_msg);
|
||||
if(payload == NULL)
|
||||
return;
|
||||
|
||||
switch (bh_message_type(queue_msg))
|
||||
{
|
||||
/*
|
||||
case SENSOR_EVENT: {
|
||||
bh_sensor_event_t *sensor_event = (bh_sensor_event_t *) payload;
|
||||
attr_container_t *event = sensor_event->event;
|
||||
attr_container_destroy(event);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
case BLE_EVENT: {
|
||||
app_instance_free_ble_msg(payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
15
core/app-mgr/app-manager/coding_rule.txt
Normal file
15
core/app-mgr/app-manager/coding_rule.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
Coding rules:
|
||||
|
||||
1. module implementation can include the export head files of associated runtime
|
||||
|
||||
2. app manager only call access the module implementation through the interface API
|
||||
|
||||
3. module implementation can call the app manager API from following files:
|
||||
- util.c
|
||||
- message.c
|
||||
|
||||
4. platform API: To define it
|
||||
|
||||
5. Any platform dependent implementation of app manager should be implemented in the
|
||||
platform specific source file, such as app_mgr_zephyr.c
|
||||
|
193
core/app-mgr/app-manager/event.c
Normal file
193
core/app-mgr/app-manager/event.c
Normal file
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "event.h"
|
||||
|
||||
#include "app_manager.h"
|
||||
#include "bh_memory.h"
|
||||
#include "coap_ext.h"
|
||||
|
||||
typedef struct _subscribe {
|
||||
struct _subscribe * next;
|
||||
uint32 subscriber_id;
|
||||
} subscribe_t;
|
||||
|
||||
typedef struct _event {
|
||||
struct _event *next;
|
||||
int subscriber_size;
|
||||
subscribe_t * subscribers;
|
||||
char url[1]; /* event url */
|
||||
} event_reg_t;
|
||||
|
||||
event_reg_t *g_events = NULL;
|
||||
|
||||
static bool find_subscriber(event_reg_t * reg, uint32 id, bool remove_found)
|
||||
{
|
||||
subscribe_t* c = reg->subscribers;
|
||||
subscribe_t * prev = NULL;
|
||||
while (c) {
|
||||
subscribe_t * next = c->next;
|
||||
if (c->subscriber_id == id) {
|
||||
if (remove_found) {
|
||||
if (prev)
|
||||
prev->next = next;
|
||||
else
|
||||
reg->subscribers = next;
|
||||
|
||||
bh_free(c);
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
prev = c;
|
||||
c = next;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool check_url(const char *url)
|
||||
{
|
||||
if (*url == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool am_register_event(const char *url, uint32_t reg_client)
|
||||
{
|
||||
event_reg_t *current = g_events;
|
||||
|
||||
app_manager_printf("am_register_event adding url:(%s)\n", url);
|
||||
|
||||
if (!check_url(url)) {
|
||||
app_manager_printf("am_register_event: invaild url:(%s)\n", url);
|
||||
return false;
|
||||
}
|
||||
while (current) {
|
||||
if (strcmp(url, current->url) == 0)
|
||||
break;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
if (current == NULL) {
|
||||
if (NULL
|
||||
== (current = (event_reg_t *) bh_malloc(
|
||||
offsetof(event_reg_t, url) + strlen(url) + 1))) {
|
||||
app_manager_printf("am_register_event: malloc fail\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
memset(current, 0, sizeof(event_reg_t));
|
||||
bh_strcpy_s(current->url, strlen(url) + 1, url);
|
||||
current->next = g_events;
|
||||
g_events = current;
|
||||
}
|
||||
|
||||
if (find_subscriber(current, reg_client, false)) {
|
||||
return true;
|
||||
} else {
|
||||
subscribe_t * s = (subscribe_t*) bh_malloc(sizeof(subscribe_t));
|
||||
if (s == NULL)
|
||||
return false;
|
||||
|
||||
memset(s, 0, sizeof(subscribe_t));
|
||||
s->subscriber_id = reg_client;
|
||||
s->next = current->subscribers;
|
||||
current->subscribers = s;
|
||||
app_manager_printf("client: %d registered event (%s)\n", reg_client,
|
||||
url);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// @url: NULL means the client wants to unregister all its subscribed items
|
||||
bool am_unregister_event(const char *url, uint32_t reg_client)
|
||||
{
|
||||
event_reg_t *current = g_events, *pre = NULL;
|
||||
|
||||
while (current != NULL) {
|
||||
if (url == NULL || strcmp(current->url, url) == 0) {
|
||||
event_reg_t * next = current->next;
|
||||
if (find_subscriber(current, reg_client, true)) {
|
||||
app_manager_printf("client: %d deregistered event (%s)\n",
|
||||
reg_client, current->url);
|
||||
}
|
||||
|
||||
// remove the registration if no client subscribe it
|
||||
if (current->subscribers == NULL) {
|
||||
app_manager_printf("unregister for event deleted url:(%s)\n",
|
||||
current->url);
|
||||
if (pre)
|
||||
pre->next = next;
|
||||
else
|
||||
g_events = next;
|
||||
bh_free(current);
|
||||
current = next;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
pre = current;
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool event_handle_event_request(uint8_t code, const char *event_url,
|
||||
uint32_t reg_client)
|
||||
{
|
||||
if (code == COAP_PUT) { /* register */
|
||||
return am_register_event(event_url, reg_client);
|
||||
} else if (code == COAP_DELETE) { /* unregister */
|
||||
return am_unregister_event(event_url, reg_client);
|
||||
} else {
|
||||
/* invalid request */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void am_publish_event(request_t * event)
|
||||
{
|
||||
bh_assert(event->action == COAP_EVENT);
|
||||
|
||||
event_reg_t *current = g_events;
|
||||
while (current) {
|
||||
if (0 == strcmp(event->url, current->url)) {
|
||||
subscribe_t* c = current->subscribers;
|
||||
while (c) {
|
||||
if (c->subscriber_id == ID_HOST) {
|
||||
send_request_to_host(event);
|
||||
} else {
|
||||
module_request_handler
|
||||
(event, (void *)(uintptr_t)c->subscriber_id);
|
||||
}
|
||||
c = c->next;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
current = current->next;
|
||||
}
|
||||
}
|
||||
|
||||
bool event_is_registered(const char *event_url)
|
||||
{
|
||||
event_reg_t *current = g_events;
|
||||
|
||||
while (current != NULL) {
|
||||
if (strcmp(current->url, event_url) == 0) {
|
||||
return true;
|
||||
}
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
41
core/app-mgr/app-manager/event.h
Normal file
41
core/app-mgr/app-manager/event.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _EVENT_H_
|
||||
#define _EVENT_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Handle event request from host agent
|
||||
*
|
||||
* @param code the coap packet code
|
||||
* @param event_url the event url
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
bool
|
||||
event_handle_event_request(uint8_t code, const char *event_url,
|
||||
uint32_t register);
|
||||
|
||||
/**
|
||||
* Test whether the event is registered
|
||||
*
|
||||
* @param event_url the event url
|
||||
*
|
||||
* @return true for registered, false for not registered
|
||||
*/
|
||||
bool
|
||||
event_is_registered(const char *event_url);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _EVENT_H_ */
|
87
core/app-mgr/app-manager/message.c
Normal file
87
core/app-mgr/app-manager/message.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "app_manager.h"
|
||||
#include "app_manager_host.h"
|
||||
#include "event.h"
|
||||
#include "attr_container.h"
|
||||
#include "bh_memory.h"
|
||||
#include "coap_ext.h"
|
||||
|
||||
#if 0
|
||||
bool send_coap_packet_to_host(coap_packet_t * packet)
|
||||
{
|
||||
int size;
|
||||
uint8_t *buf;
|
||||
|
||||
size = coap_serialize_message_tcp(&packet, &buf);
|
||||
if (!buf || size == 0)
|
||||
return false;
|
||||
|
||||
app_manager_host_send_msg(buf, size);
|
||||
bh_free(buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool send_request_to_host(request_t *msg)
|
||||
{
|
||||
if (COAP_EVENT == msg->action && !event_is_registered(msg->url)) {
|
||||
app_manager_printf("Event is not registered\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
int size;
|
||||
char * packet = pack_request(msg, &size);
|
||||
if (packet == NULL)
|
||||
return false;
|
||||
|
||||
app_manager_host_send_msg(REQUEST_PACKET, packet, size);
|
||||
|
||||
free_req_resp_packet(packet);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool send_response_to_host(response_t *response)
|
||||
{
|
||||
int size;
|
||||
char * packet = pack_response(response, &size);
|
||||
if (packet == NULL)
|
||||
return false;
|
||||
|
||||
app_manager_host_send_msg(RESPONSE_PACKET, packet, size);
|
||||
|
||||
free_req_resp_packet(packet);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool send_error_response_to_host(int mid, int status, const char *msg)
|
||||
{
|
||||
int payload_len = 0;
|
||||
attr_container_t *payload = NULL;
|
||||
response_t response[1] = { 0 };
|
||||
|
||||
if (msg) {
|
||||
payload = attr_container_create("");
|
||||
if (payload) {
|
||||
attr_container_set_string(&payload, "error message", msg);
|
||||
payload_len = attr_container_get_serialize_length(payload);
|
||||
}
|
||||
}
|
||||
|
||||
set_response(response, status,
|
||||
FMT_ATTR_CONTAINER, (const char *)payload, payload_len);
|
||||
response->mid = mid;
|
||||
|
||||
send_response_to_host(response);
|
||||
|
||||
if (payload)
|
||||
attr_container_destroy(payload);
|
||||
return true;
|
||||
}
|
||||
|
23
core/app-mgr/app-manager/module_config.h
Normal file
23
core/app-mgr/app-manager/module_config.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_CONFIG_H_
|
||||
#define _MODULE_CONFIG_H_
|
||||
|
||||
#define ENABLE_MODULE_JEFF 0
|
||||
#define ENABLE_MODULE_WASM_APP 1
|
||||
#define ENABLE_MODULE_WASM_LIB 1
|
||||
|
||||
#ifdef ENABLE_MODULE_JEFF
|
||||
#include "module_jeff.h"
|
||||
#endif
|
||||
#ifdef ENABLE_MODULE_WASM_APP
|
||||
#include "module_wasm_app.h"
|
||||
#endif
|
||||
#ifdef ENABLE_MODULE_WASM_LIB
|
||||
#include "module_wasm_lib.h"
|
||||
#endif
|
||||
|
||||
#endif /* _MODULE_CONFIG_H_ */
|
1733
core/app-mgr/app-manager/module_jeff.c
Normal file
1733
core/app-mgr/app-manager/module_jeff.c
Normal file
File diff suppressed because it is too large
Load Diff
29
core/app-mgr/app-manager/module_jeff.h
Normal file
29
core/app-mgr/app-manager/module_jeff.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_JEFF_H_
|
||||
#define _MODULE_JEFF_H_
|
||||
|
||||
#include "app_manager.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern module_interface jeff_module_interface;
|
||||
|
||||
/* sensor event */
|
||||
typedef struct bh_sensor_event_t {
|
||||
/* Java sensor object */
|
||||
void *sensor;
|
||||
/* event of attribute container from context core */
|
||||
void *event;
|
||||
} bh_sensor_event_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _MODULE_JEFF_H_ */
|
221
core/app-mgr/app-manager/module_utils.c
Normal file
221
core/app-mgr/app-manager/module_utils.c
Normal file
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "app_manager.h"
|
||||
#include "app_manager_host.h"
|
||||
#include "bh_queue.h"
|
||||
#include "bh_memory.h"
|
||||
#include "bh_thread.h"
|
||||
#include "attr_container.h"
|
||||
#include "event.h"
|
||||
#include "watchdog.h"
|
||||
#include "coap_ext.h"
|
||||
|
||||
/* Lock of the module data list */
|
||||
korp_mutex module_data_list_lock;
|
||||
|
||||
/* Module data list */
|
||||
module_data *module_data_list;
|
||||
|
||||
bool module_data_list_init()
|
||||
{
|
||||
module_data_list = NULL;
|
||||
return !vm_mutex_init(&module_data_list_lock) ? true : false;
|
||||
}
|
||||
|
||||
void module_data_list_destroy()
|
||||
{
|
||||
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
if (module_data_list) {
|
||||
while (module_data_list) {
|
||||
module_data *p = module_data_list->next;
|
||||
bh_free(module_data_list);
|
||||
module_data_list = p;
|
||||
}
|
||||
}
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
vm_mutex_destroy(&module_data_list_lock);
|
||||
}
|
||||
|
||||
static void module_data_list_add(module_data *m_data)
|
||||
{
|
||||
static uint32 module_id_max = 1;
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
// reserve some special ID
|
||||
// TODO: check the new id is not already occupied!
|
||||
if (module_id_max == 0xFFFFFFF0)
|
||||
module_id_max = 1;
|
||||
m_data->id = module_id_max++;
|
||||
if (!module_data_list) {
|
||||
module_data_list = m_data;
|
||||
} else {
|
||||
/* Set as head */
|
||||
m_data->next = module_data_list;
|
||||
module_data_list = m_data;
|
||||
}
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
}
|
||||
|
||||
void module_data_list_remove(module_data *m_data)
|
||||
{
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
if (module_data_list) {
|
||||
if (module_data_list == m_data)
|
||||
module_data_list = module_data_list->next;
|
||||
else {
|
||||
/* Search and remove it */
|
||||
module_data *p = module_data_list;
|
||||
|
||||
while (p && p->next != m_data)
|
||||
p = p->next;
|
||||
if (p && p->next == m_data)
|
||||
p->next = p->next->next;
|
||||
}
|
||||
}
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
}
|
||||
|
||||
module_data*
|
||||
module_data_list_lookup(const char *module_name)
|
||||
{
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
if (module_data_list) {
|
||||
module_data *p = module_data_list;
|
||||
|
||||
while (p) {
|
||||
/* Search by module name */
|
||||
if (!strcmp(module_name, p->module_name)) {
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
return p;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
module_data*
|
||||
module_data_list_lookup_id(unsigned int module_id)
|
||||
{
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
if (module_data_list) {
|
||||
module_data *p = module_data_list;
|
||||
|
||||
while (p) {
|
||||
/* Search by module name */
|
||||
if (module_id == p->id) {
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
return p;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
module_data *
|
||||
app_manager_get_module_data(uint32 module_type, void *module_inst)
|
||||
{
|
||||
if (module_type < Module_Max
|
||||
&& g_module_interfaces[module_type]
|
||||
&& g_module_interfaces[module_type]->module_get_module_data)
|
||||
return g_module_interfaces[module_type]->module_get_module_data(module_inst);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void*
|
||||
app_manager_get_module_queue(uint32 module_type, void *module_inst)
|
||||
{
|
||||
module_data *m_data = app_manager_get_module_data(module_type, module_inst);
|
||||
return m_data ? m_data->queue : NULL;
|
||||
}
|
||||
|
||||
const char*
|
||||
app_manager_get_module_name(uint32 module_type, void *module_inst)
|
||||
{
|
||||
module_data *m_data = app_manager_get_module_data(module_type, module_inst);
|
||||
return m_data ? m_data->module_name : NULL;
|
||||
}
|
||||
|
||||
unsigned int app_manager_get_module_id(uint32 module_type, void *module_inst)
|
||||
{
|
||||
module_data *m_data = app_manager_get_module_data(module_type, module_inst);
|
||||
return m_data ? m_data->id : ID_NONE;
|
||||
}
|
||||
|
||||
void*
|
||||
app_manager_get_module_heap(uint32 module_type, void *module_inst)
|
||||
{
|
||||
module_data *m_data = app_manager_get_module_data(module_type, module_inst);
|
||||
return m_data ? m_data->heap : NULL;
|
||||
}
|
||||
|
||||
module_data*
|
||||
app_manager_lookup_module_data(const char *name)
|
||||
{
|
||||
return module_data_list_lookup(name);
|
||||
}
|
||||
|
||||
void app_manager_add_module_data(module_data *m_data)
|
||||
{
|
||||
module_data_list_add(m_data);
|
||||
}
|
||||
|
||||
void app_manager_del_module_data(module_data *m_data)
|
||||
{
|
||||
module_data_list_remove(m_data);
|
||||
|
||||
release_module(m_data);
|
||||
}
|
||||
|
||||
bool app_manager_is_interrupting_module(uint32 module_type, void *module_inst)
|
||||
{
|
||||
module_data *m_data = app_manager_get_module_data(module_type, module_inst);
|
||||
return m_data ? m_data->wd_timer.is_interrupting : false;
|
||||
}
|
||||
|
||||
extern void destroy_module_timer_ctx(unsigned int module_id);
|
||||
|
||||
void release_module(module_data *m_data)
|
||||
{
|
||||
watchdog_timer_destroy(&m_data->wd_timer);
|
||||
|
||||
#ifdef HEAP_ENABLED /* TODO */
|
||||
if(m_data->heap) gc_destroy_for_instance(m_data->heap);
|
||||
#endif
|
||||
|
||||
if (m_data->queue)
|
||||
bh_queue_destroy(m_data->queue);
|
||||
|
||||
m_data->timer_ctx = NULL;
|
||||
|
||||
destroy_module_timer_ctx(m_data->id);
|
||||
|
||||
bh_free(m_data);
|
||||
}
|
||||
|
||||
int check_modules_timer_expiry()
|
||||
{
|
||||
vm_mutex_lock(&module_data_list_lock);
|
||||
module_data *p = module_data_list;
|
||||
int ms_to_expiry = -1;
|
||||
|
||||
while (p) {
|
||||
|
||||
int next = get_expiry_ms(p->timer_ctx);
|
||||
if (next != -1) {
|
||||
if (ms_to_expiry == -1 || ms_to_expiry > next)
|
||||
ms_to_expiry = next;
|
||||
}
|
||||
|
||||
p = p->next;
|
||||
}
|
||||
vm_mutex_unlock(&module_data_list_lock);
|
||||
return ms_to_expiry;
|
||||
}
|
||||
|
1057
core/app-mgr/app-manager/module_wasm_app.c
Normal file
1057
core/app-mgr/app-manager/module_wasm_app.c
Normal file
File diff suppressed because it is too large
Load Diff
87
core/app-mgr/app-manager/module_wasm_app.h
Normal file
87
core/app-mgr/app-manager/module_wasm_app.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_WASM_APP_H_
|
||||
#define _MODULE_WASM_APP_H_
|
||||
|
||||
#include "bh_queue.h"
|
||||
#include "app_manager_export.h"
|
||||
#include "wasm_export.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SECTION_TYPE_USER 0
|
||||
#define SECTION_TYPE_TYPE 1
|
||||
#define SECTION_TYPE_IMPORT 2
|
||||
#define SECTION_TYPE_FUNC 3
|
||||
#define SECTION_TYPE_TABLE 4
|
||||
#define SECTION_TYPE_MEMORY 5
|
||||
#define SECTION_TYPE_GLOBAL 6
|
||||
#define SECTION_TYPE_EXPORT 7
|
||||
#define SECTION_TYPE_START 8
|
||||
#define SECTION_TYPE_ELEM 9
|
||||
#define SECTION_TYPE_CODE 10
|
||||
#define SECTION_TYPE_DATA 11
|
||||
|
||||
enum {
|
||||
WASM_Msg_Start = BASE_EVENT_MAX,
|
||||
TIMER_EVENT_WASM,
|
||||
SENSOR_EVENT_WASM,
|
||||
CONNECTION_EVENT_WASM,
|
||||
WIDGET_EVENT_WASM,
|
||||
WASM_Msg_End = WASM_Msg_Start + 100
|
||||
};
|
||||
|
||||
typedef struct wasm_data {
|
||||
/* for easily access the containing wasm module */
|
||||
wasm_module_t wasm_module;
|
||||
wasm_module_inst_t wasm_module_inst;
|
||||
/* Permissions of the WASM app */
|
||||
char *perms;
|
||||
/*thread list mapped with this WASM module */
|
||||
korp_tid thread_id;
|
||||
/* for easily access the containing module data */
|
||||
module_data* m_data;
|
||||
/* section list of wasm bytecode */
|
||||
wasm_section_list_t sections;
|
||||
} wasm_data;
|
||||
|
||||
/* sensor event */
|
||||
typedef struct _sensor_event_data {
|
||||
uint32 sensor_id;
|
||||
|
||||
int data_fmt;
|
||||
/* event of attribute container from context core */
|
||||
void *data;
|
||||
} sensor_event_data_t;
|
||||
|
||||
/* WASM App File */
|
||||
typedef struct wasm_app_file {
|
||||
/* magics */
|
||||
int magic;
|
||||
/* current version */
|
||||
int version;
|
||||
/* WASM section list */
|
||||
wasm_section_list_t sections;
|
||||
/* Last WASM section in the list */
|
||||
wasm_section_t *section_end;
|
||||
} wasm_app_file_t;
|
||||
|
||||
extern module_interface wasm_app_module_interface;
|
||||
|
||||
typedef void (*message_type_handler_t)(module_data *m_data, bh_message_t msg);
|
||||
extern bool wasm_register_msg_callback(int msg_type,
|
||||
message_type_handler_t message_handler);
|
||||
|
||||
typedef void (*resource_cleanup_handler_t)(uint32 module_id);
|
||||
extern bool wasm_register_cleanup_callback(resource_cleanup_handler_t handler);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _MODULE_WASM_APP_H_ */
|
49
core/app-mgr/app-manager/module_wasm_lib.c
Normal file
49
core/app-mgr/app-manager/module_wasm_lib.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
|
||||
#include "module_wasm_lib.h"
|
||||
|
||||
static bool wasm_lib_module_init(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool wasm_lib_module_install(request_t *msg)
|
||||
{
|
||||
(void) msg;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool wasm_lib_module_uninstall(request_t *msg)
|
||||
{
|
||||
(void) msg;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void wasm_lib_module_watchdog_kill(module_data *m_data)
|
||||
{
|
||||
(void) m_data;
|
||||
}
|
||||
|
||||
static bool wasm_lib_module_handle_host_url(void *queue_msg)
|
||||
{
|
||||
(void) queue_msg;
|
||||
return false;
|
||||
}
|
||||
|
||||
static module_data*
|
||||
wasm_lib_module_get_module_data(void *inst)
|
||||
{
|
||||
(void) inst;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
module_interface wasm_lib_module_interface = { wasm_lib_module_init,
|
||||
wasm_lib_module_install, wasm_lib_module_uninstall,
|
||||
wasm_lib_module_watchdog_kill, wasm_lib_module_handle_host_url,
|
||||
wasm_lib_module_get_module_data,
|
||||
NULL };
|
||||
|
21
core/app-mgr/app-manager/module_wasm_lib.h
Normal file
21
core/app-mgr/app-manager/module_wasm_lib.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_WASM_LIB_H_
|
||||
#define _MODULE_WASM_LIB_H_
|
||||
|
||||
#include "app_manager.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern module_interface wasm_lib_module_interface;
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _MODULE_WASM_LIB_H_ */
|
43
core/app-mgr/app-manager/platform/linux/app_mgr_linux.c
Normal file
43
core/app-mgr/app-manager/platform/linux/app_mgr_linux.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "app_manager.h"
|
||||
|
||||
void*
|
||||
app_manager_timer_create(void (*timer_callback)(void*),
|
||||
watchdog_timer *wd_timer)
|
||||
{
|
||||
/* TODO */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void app_manager_timer_destroy(void *timer)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
void app_manager_timer_start(void *timer, int timeout)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
void app_manager_timer_stop(void *timer)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
watchdog_timer *
|
||||
app_manager_get_wd_timer_from_timer_handle(void *timer)
|
||||
{
|
||||
/* TODO */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int app_manager_signature_verify(const uint8_t *file, unsigned int file_len,
|
||||
const uint8_t *signature, unsigned int sig_size)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
61
core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c
Normal file
61
core/app-mgr/app-manager/platform/zephyr/app_mgr_zephyr.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "app_manager.h"
|
||||
#include "bh_platform.h"
|
||||
#include "bh_memory.h"
|
||||
#include <autoconf.h>
|
||||
#include <zephyr.h>
|
||||
#include <kernel.h>
|
||||
#if 0
|
||||
#include <sigverify.h>
|
||||
#endif
|
||||
typedef struct k_timer_watchdog {
|
||||
struct k_timer timer;
|
||||
watchdog_timer *wd_timer;
|
||||
} k_timer_watchdog;
|
||||
|
||||
void*
|
||||
app_manager_timer_create(void (*timer_callback)(void*),
|
||||
watchdog_timer *wd_timer)
|
||||
{
|
||||
struct k_timer_watchdog *timer = bh_malloc(sizeof(struct k_timer_watchdog));
|
||||
|
||||
if (timer) {
|
||||
k_timer_init(&timer->timer, (void (*)(struct k_timer*)) timer_callback,
|
||||
NULL);
|
||||
timer->wd_timer = wd_timer;
|
||||
}
|
||||
|
||||
return timer;
|
||||
}
|
||||
|
||||
void app_manager_timer_destroy(void *timer)
|
||||
{
|
||||
bh_free(timer);
|
||||
}
|
||||
|
||||
void app_manager_timer_start(void *timer, int timeout)
|
||||
{
|
||||
k_timer_start(timer, timeout, 0);
|
||||
}
|
||||
|
||||
void app_manager_timer_stop(void *timer)
|
||||
{
|
||||
k_timer_stop(timer);
|
||||
}
|
||||
|
||||
watchdog_timer *
|
||||
app_manager_get_wd_timer_from_timer_handle(void *timer)
|
||||
{
|
||||
return ((k_timer_watchdog*) timer)->wd_timer;
|
||||
}
|
||||
#if 0
|
||||
int app_manager_signature_verify(const uint8_t *file, unsigned int file_len,
|
||||
const uint8_t *signature, unsigned int sig_size)
|
||||
{
|
||||
return signature_verify(file, file_len, signature, sig_size);
|
||||
}
|
||||
#endif
|
203
core/app-mgr/app-manager/resource_reg.c
Normal file
203
core/app-mgr/app-manager/resource_reg.c
Normal file
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
|
||||
#include "native_interface.h"
|
||||
#include "shared_utils.h"
|
||||
#include "app_manager.h"
|
||||
#include "app_manager_export.h"
|
||||
#include "attr_container.h"
|
||||
#include "coap_ext.h"
|
||||
|
||||
typedef struct _app_res_register {
|
||||
struct _app_res_register *next;
|
||||
char * url;
|
||||
void (*request_handler)(request_t *, void *);
|
||||
uint32 register_id;
|
||||
} app_res_register_t;
|
||||
|
||||
static app_res_register_t * g_resources = NULL;
|
||||
|
||||
void module_request_handler(request_t *request, void *user_data)
|
||||
{
|
||||
unsigned int mod_id = (unsigned int)(uintptr_t)user_data;
|
||||
bh_message_t msg;
|
||||
module_data *m_data;
|
||||
request_t *req;
|
||||
|
||||
/* Check module name */
|
||||
m_data = module_data_list_lookup_id(mod_id);
|
||||
if (!m_data) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_data->wd_timer.is_interrupting) {
|
||||
return;
|
||||
}
|
||||
|
||||
req = clone_request(request);
|
||||
if (!req) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set queue message and send to applet's queue */
|
||||
msg = bh_new_msg(RESTFUL_REQUEST, req, sizeof(*req), request_cleaner);
|
||||
if (!msg) {
|
||||
request_cleaner(req);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bh_post_msg2(m_data->queue, msg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
app_manager_printf("Send request to app %s success.\n",
|
||||
m_data->module_name);
|
||||
}
|
||||
|
||||
void targeted_app_request_handler(request_t *request, void *unused)
|
||||
{
|
||||
char applet_name[128] = { 0 };
|
||||
int offset;
|
||||
char *url = request->url;
|
||||
module_data *m_data;
|
||||
|
||||
offset = check_url_start(request->url, strlen(request->url), "/app/");
|
||||
|
||||
if (offset <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
strncpy(applet_name, request->url + offset, sizeof(applet_name) - 1);
|
||||
char *p = strrchr(applet_name, '/');
|
||||
if (p) {
|
||||
*p = 0;
|
||||
} else
|
||||
return;
|
||||
app_manager_printf("Send request to applet: %s\n", applet_name);
|
||||
|
||||
request->url = p + 1;
|
||||
|
||||
/* Check module name */
|
||||
m_data = module_data_list_lookup(applet_name);
|
||||
if (!m_data) {
|
||||
SEND_ERR_RESPONSE(request->mid,
|
||||
"Send request to applet failed: invalid applet name");
|
||||
goto end;
|
||||
}
|
||||
|
||||
module_request_handler(request, (void *)(uintptr_t)m_data->id);
|
||||
end: request->url = url;
|
||||
|
||||
}
|
||||
|
||||
void am_send_response(response_t *response)
|
||||
{
|
||||
module_data *m_data;
|
||||
|
||||
// if the receiver is not any of modules, just forward it to the host
|
||||
m_data = module_data_list_lookup_id(response->reciever);
|
||||
if (!m_data) {
|
||||
send_response_to_host(response);
|
||||
|
||||
} else {
|
||||
response_t * resp_for_send = clone_response(response);
|
||||
if (!resp_for_send) {
|
||||
return;
|
||||
}
|
||||
|
||||
bh_message_t msg = bh_new_msg(RESTFUL_RESPONSE, resp_for_send,
|
||||
sizeof(*resp_for_send), response_cleaner);
|
||||
if (!msg) {
|
||||
response_cleaner(resp_for_send);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bh_post_msg2(m_data->queue, msg)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void * am_dispatch_request(request_t *request)
|
||||
{
|
||||
app_res_register_t *r = g_resources;
|
||||
|
||||
while (r) {
|
||||
if (check_url_start(request->url, strlen(request->url), r->url) > 0) {
|
||||
r->request_handler(request, (void *)(uintptr_t)r->register_id);
|
||||
return r;
|
||||
}
|
||||
r = r->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool am_register_resource(const char *url,
|
||||
void (*request_handler)(request_t *, void *), uint32 register_id)
|
||||
{
|
||||
app_res_register_t * r = g_resources;
|
||||
int register_num = 0;
|
||||
|
||||
while (r) {
|
||||
if (strcmp(r->url, url) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (r->register_id == register_id)
|
||||
register_num++;
|
||||
|
||||
r = r->next;
|
||||
}
|
||||
|
||||
if (strlen(url) > RESOUCE_EVENT_URL_LEN_MAX)
|
||||
return false;
|
||||
|
||||
if (register_num >= RESOURCE_REGISTRATION_NUM_MAX)
|
||||
return false;
|
||||
|
||||
r = (app_res_register_t *) bh_malloc(sizeof(app_res_register_t));
|
||||
if (r == NULL)
|
||||
return false;
|
||||
|
||||
memset(r, 0, sizeof(*r));
|
||||
r->url = bh_strdup(url);
|
||||
if (r->url == NULL) {
|
||||
bh_free(r);
|
||||
return false;
|
||||
}
|
||||
|
||||
r->request_handler = request_handler;
|
||||
r->next = g_resources;
|
||||
r->register_id = register_id;
|
||||
g_resources = r;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void am_cleanup_registeration(uint32 register_id)
|
||||
{
|
||||
app_res_register_t * r = g_resources;
|
||||
app_res_register_t * prev = NULL;
|
||||
|
||||
while (r) {
|
||||
app_res_register_t *next = r->next;
|
||||
|
||||
if (register_id == r->register_id) {
|
||||
if (prev)
|
||||
prev->next = next;
|
||||
else
|
||||
g_resources = next;
|
||||
|
||||
bh_free(r->url);
|
||||
bh_free(r);
|
||||
} else
|
||||
/* if r is freed, should not change prev. Only set prev to r
|
||||
when r isn't freed. */
|
||||
prev = r;
|
||||
|
||||
r = next;
|
||||
}
|
||||
}
|
129
core/app-mgr/app-manager/watchdog.c
Normal file
129
core/app-mgr/app-manager/watchdog.c
Normal file
|
@ -0,0 +1,129 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#include "watchdog.h"
|
||||
#include "bh_queue.h"
|
||||
#include "bh_thread.h"
|
||||
#include "bh_memory.h"
|
||||
#include "jeff_export.h"
|
||||
|
||||
#define WATCHDOG_THREAD_PRIORITY 5
|
||||
|
||||
/* Queue of watchdog */
|
||||
static bh_queue *watchdog_queue;
|
||||
|
||||
#ifdef WATCHDOG_ENABLED /* TODO */
|
||||
static void watchdog_timer_callback(void *timer)
|
||||
{
|
||||
watchdog_timer *wd_timer = app_manager_get_wd_timer_from_timer_handle(
|
||||
timer);
|
||||
|
||||
watchdog_timer_stop(wd_timer);
|
||||
|
||||
vm_mutex_lock(&wd_timer->lock);
|
||||
|
||||
if (!wd_timer->is_stopped) {
|
||||
|
||||
wd_timer->is_interrupting = true;
|
||||
|
||||
bh_post_msg(watchdog_queue, WD_TIMEOUT, wd_timer->module_data,
|
||||
sizeof(module_data));
|
||||
}
|
||||
|
||||
vm_mutex_unlock(&wd_timer->lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool watchdog_timer_init(module_data *m_data)
|
||||
{
|
||||
#ifdef WATCHDOG_ENABLED /* TODO */
|
||||
watchdog_timer *wd_timer = &m_data->wd_timer;
|
||||
|
||||
if (0 != vm_mutex_init(&wd_timer->lock))
|
||||
return false;
|
||||
|
||||
if (!(wd_timer->timer_handle =
|
||||
app_manager_timer_create(watchdog_timer_callback, wd_timer))) {
|
||||
vm_mutex_destroy(&wd_timer->lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
wd_timer->module_data = m_data;
|
||||
wd_timer->is_interrupting = false;
|
||||
wd_timer->is_stopped = false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void watchdog_timer_destroy(watchdog_timer *wd_timer)
|
||||
{
|
||||
#ifdef WATCHDOG_ENABLED /* TODO */
|
||||
app_manager_timer_destroy(wd_timer->timer_handle);
|
||||
vm_mutex_destroy(&wd_timer->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
void watchdog_timer_start(watchdog_timer *wd_timer)
|
||||
{
|
||||
vm_mutex_lock(&wd_timer->lock);
|
||||
|
||||
wd_timer->is_interrupting = false;
|
||||
wd_timer->is_stopped = false;
|
||||
app_manager_timer_start(wd_timer->timer_handle,
|
||||
wd_timer->module_data->timeout);
|
||||
|
||||
vm_mutex_unlock(&wd_timer->lock);
|
||||
}
|
||||
|
||||
void watchdog_timer_stop(watchdog_timer *wd_timer)
|
||||
{
|
||||
app_manager_timer_stop(wd_timer->timer_handle);
|
||||
}
|
||||
|
||||
#ifdef WATCHDOG_ENABLED /* TODO */
|
||||
static void watchdog_queue_callback(void *queue_msg)
|
||||
{
|
||||
if (bh_message_type(queue_msg) == WD_TIMEOUT) {
|
||||
module_data *m_data = (module_data *) bh_message_payload(queue_msg);
|
||||
if (g_module_interfaces[m_data->module_type]
|
||||
&& g_module_interfaces[m_data->module_type]->module_watchdog_kill) {
|
||||
g_module_interfaces[m_data->module_type]->module_watchdog_kill(
|
||||
m_data);
|
||||
app_manager_post_applets_update_event();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WATCHDOG_ENABLED /* TODO */
|
||||
static void*
|
||||
watchdog_thread_routine(void *arg)
|
||||
{
|
||||
/* Enter loop run */
|
||||
bh_queue_enter_loop_run(watchdog_queue, watchdog_queue_callback);
|
||||
|
||||
(void) arg;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool watchdog_startup()
|
||||
{
|
||||
if (!(watchdog_queue = bh_queue_create())) {
|
||||
app_manager_printf(
|
||||
"App Manager start failed: create watchdog queue failed.\n");
|
||||
return false;
|
||||
}
|
||||
#if 0
|
||||
//todo: enable watchdog
|
||||
/* Start watchdog thread */
|
||||
if (!jeff_runtime_create_supervisor_thread_with_prio(watchdog_thread_routine, NULL,
|
||||
WATCHDOG_THREAD_PRIORITY)) {
|
||||
bh_queue_destroy(watchdog_queue);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
38
core/app-mgr/app-manager/watchdog.h
Normal file
38
core/app-mgr/app-manager/watchdog.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _WATCHDOG_H_
|
||||
#define _WATCHDOG_H_
|
||||
|
||||
#include "app_manager.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool
|
||||
watchdog_timer_init(module_data *module_data);
|
||||
|
||||
void
|
||||
watchdog_timer_destroy(watchdog_timer *wd_timer);
|
||||
|
||||
void
|
||||
watchdog_timer_start(watchdog_timer *wd_timer);
|
||||
|
||||
void
|
||||
watchdog_timer_stop(watchdog_timer *wd_timer);
|
||||
|
||||
watchdog_timer*
|
||||
app_manager_get_watchdog_timer(void *timer);
|
||||
|
||||
bool
|
||||
watchdog_startup();
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* _WATCHDOG_H_ */
|
296
core/app-mgr/app-mgr-shared/app_manager_export.h
Normal file
296
core/app-mgr/app-mgr-shared/app_manager_export.h
Normal file
|
@ -0,0 +1,296 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _APP_MANAGER_EXPORT_H_
|
||||
#define _APP_MANAGER_EXPORT_H_
|
||||
|
||||
#include "native_interface.h"
|
||||
#include "shared_utils.h"
|
||||
#include "bh_queue.h"
|
||||
#include "host_link.h"
|
||||
#include "runtime_timer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Special module IDs */
|
||||
#define ID_HOST -3
|
||||
#define ID_APP_MGR -2
|
||||
/* Invalid module ID */
|
||||
#define ID_NONE (uint32)-1
|
||||
|
||||
struct attr_container_t;
|
||||
|
||||
/* Queue message type */
|
||||
typedef enum QUEUE_MSG_TYPE {
|
||||
COAP_PARSED = LINK_MSG_TYPE_MAX + 1,
|
||||
RESTFUL_REQUEST,
|
||||
RESTFUL_RESPONSE,
|
||||
TIMER_EVENT = 5,
|
||||
SENSOR_EVENT = 6,
|
||||
GPIO_INTERRUPT_EVENT = 7,
|
||||
BLE_EVENT = 8,
|
||||
JDWP_REQUEST = 9,
|
||||
WD_TIMEOUT = 10,
|
||||
BASE_EVENT_MAX = 100
|
||||
|
||||
} QUEUE_MSG_TYPE;
|
||||
|
||||
typedef enum {
|
||||
Module_Jeff, Module_WASM_App, Module_WASM_Lib, Module_Max
|
||||
} Module_Type;
|
||||
|
||||
struct module_data;
|
||||
|
||||
/* Watchdog timer of module */
|
||||
typedef struct watchdog_timer {
|
||||
/* Timer handle of the platform */
|
||||
void *timer_handle;
|
||||
/* Module of the watchdog timer */
|
||||
struct module_data *module_data;
|
||||
/* Lock of the watchdog timer */
|
||||
korp_mutex lock;
|
||||
/* Flag indicates module is being interrupted by watchdog */
|
||||
bool is_interrupting;
|
||||
/* Flag indicates watchdog timer is stopped */
|
||||
bool is_stopped;
|
||||
} watchdog_timer;
|
||||
|
||||
typedef struct module_data {
|
||||
struct module_data *next;
|
||||
|
||||
/* ID of the module */
|
||||
uint32 id;
|
||||
|
||||
/* Type of the module */
|
||||
Module_Type module_type;
|
||||
|
||||
/* Heap of the module */
|
||||
void *heap;
|
||||
|
||||
/* Heap size of the module */
|
||||
int heap_size;
|
||||
|
||||
/* Module execution timeout in millisecond */
|
||||
int timeout;
|
||||
|
||||
/* Queue of the module */
|
||||
bh_queue *queue;
|
||||
|
||||
/* Watchdog timer of the module*/
|
||||
struct watchdog_timer wd_timer;
|
||||
|
||||
timer_ctx_t timer_ctx;
|
||||
|
||||
/* max timers number app can create */
|
||||
int timers;
|
||||
|
||||
/* Internal data of the module */
|
||||
void *internal_data;
|
||||
|
||||
/* Module name */
|
||||
char module_name[1];
|
||||
} module_data;
|
||||
|
||||
/* Module function types */
|
||||
typedef bool (*module_init_func)(void);
|
||||
typedef bool (*module_install_func)(request_t *msg);
|
||||
typedef bool (*module_uninstall_func)(request_t *msg);
|
||||
typedef void (*module_watchdog_kill_func)(module_data *module_data);
|
||||
typedef bool (*module_handle_host_url_func)(void *queue_msg);
|
||||
typedef module_data *(*module_get_module_data_func)(void *inst);
|
||||
|
||||
/**
|
||||
* @typedef module_on_install_request_byte_arrive_func
|
||||
*
|
||||
* @brief Define the signature of function to handle one byte of
|
||||
* module app install request for struct module_interface.
|
||||
*
|
||||
* @param ch the byte to be received and handled
|
||||
* @param total_size total size of the request
|
||||
* @param received_total_size currently received total size when the function return
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
typedef bool (*module_on_install_request_byte_arrive_func)(uint8 ch,
|
||||
int total_size, int *received_total_size);
|
||||
|
||||
/* Interfaces of each module */
|
||||
typedef struct module_interface {
|
||||
module_init_func module_init;
|
||||
module_install_func module_install;
|
||||
module_uninstall_func module_uninstall;
|
||||
module_watchdog_kill_func module_watchdog_kill;
|
||||
module_handle_host_url_func module_handle_host_url;
|
||||
module_get_module_data_func module_get_module_data;
|
||||
module_on_install_request_byte_arrive_func module_on_install;
|
||||
} module_interface;
|
||||
|
||||
/**
|
||||
* @typedef host_init_func
|
||||
* @brief Define the host initialize callback function signature for
|
||||
* struct host_interface.
|
||||
*
|
||||
* @return true if success, false if fail
|
||||
*/
|
||||
typedef bool (*host_init_func)(void);
|
||||
|
||||
/**
|
||||
* @typedef host_send_fun
|
||||
* @brief Define the host send callback function signature for
|
||||
* struct host_interface.
|
||||
*
|
||||
* @param buf data buffer to send.
|
||||
* @param size size of the data to send.
|
||||
*
|
||||
* @return size of the data sent in bytes
|
||||
*/
|
||||
typedef int (*host_send_fun)(void * ctx, const char *buf, int size);
|
||||
|
||||
/**
|
||||
* @typedef host_destroy_fun
|
||||
* @brief Define the host receive callback function signature for
|
||||
* struct host_interface.
|
||||
*
|
||||
*/
|
||||
typedef void (*host_destroy_fun)();
|
||||
|
||||
/* Interfaces of host communication */
|
||||
typedef struct host_interface {
|
||||
host_init_func init;
|
||||
host_send_fun send;
|
||||
host_destroy_fun destroy;
|
||||
} host_interface;
|
||||
|
||||
/**
|
||||
* Initialize communication with Host
|
||||
*
|
||||
* @param interface host communication interface
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
bool
|
||||
app_manager_host_init(host_interface *interface);
|
||||
|
||||
/**
|
||||
* Send message to Host
|
||||
*
|
||||
* @param buf buffer to send
|
||||
* @param size size of buffer
|
||||
*
|
||||
* @return size of buffer sent
|
||||
*/
|
||||
|
||||
/* Startup app manager */
|
||||
void
|
||||
app_manager_startup(host_interface *interface);
|
||||
|
||||
/* Get queue of current applet */
|
||||
void *
|
||||
app_manager_get_module_queue(uint32 module_type, void *module_inst);
|
||||
|
||||
/* Get applet name of current applet */
|
||||
const char *
|
||||
app_manager_get_module_name(uint32 module_type, void *module_inst);
|
||||
|
||||
/* Get heap of current applet */
|
||||
void *
|
||||
app_manager_get_module_heap(uint32 module_type, void *module_inst);
|
||||
|
||||
void*
|
||||
get_app_manager_queue();
|
||||
|
||||
module_data*
|
||||
app_manager_get_module_data(uint32 module_type, void *module_inst);
|
||||
|
||||
unsigned int
|
||||
app_manager_get_module_id(uint32 module_type, void *module_inst);
|
||||
|
||||
module_data*
|
||||
app_manager_lookup_module_data(const char *name);
|
||||
|
||||
module_data*
|
||||
module_data_list_lookup(const char *module_name);
|
||||
|
||||
module_data*
|
||||
module_data_list_lookup_id(unsigned int module_id);
|
||||
|
||||
void
|
||||
app_manager_post_applets_update_event();
|
||||
|
||||
bool
|
||||
am_register_resource(const char *url,
|
||||
void (*request_handler)(request_t *, void *), uint32 register_id);
|
||||
|
||||
void am_cleanup_registeration(uint32 register_id);
|
||||
|
||||
bool
|
||||
am_register_event(const char *url, uint32_t reg_client);
|
||||
|
||||
bool
|
||||
am_unregister_event(const char *url, uint32_t reg_client);
|
||||
|
||||
void am_publish_event(request_t * event);
|
||||
|
||||
void * am_dispatch_request(request_t *request);
|
||||
|
||||
void am_send_response(response_t *response);
|
||||
|
||||
void module_request_handler(request_t *request, void *user_data);
|
||||
|
||||
/**
|
||||
* Send request message to host
|
||||
*
|
||||
* @param msg the request or event message.
|
||||
* It is event when msg->action==COAP_EVENT
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
bool
|
||||
send_request_to_host(request_t *msg);
|
||||
|
||||
/**
|
||||
* Send response message to host
|
||||
*
|
||||
* @param msg the response message
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
bool
|
||||
send_response_to_host(response_t *msg);
|
||||
|
||||
/**
|
||||
* Send response with mid and code to host
|
||||
*
|
||||
* @param mid the message id of response
|
||||
* @param code the code/status of response
|
||||
* @param msg the detailed message
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
bool
|
||||
send_error_response_to_host(int mid, int code, const char *msg);
|
||||
|
||||
/**
|
||||
* Check whether the applet has the permission
|
||||
*
|
||||
* @param perm the permission needed to check
|
||||
*
|
||||
* @return true if success, false otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
app_manager_host_send_msg(int msg_type, const unsigned char *buf, int size);
|
||||
|
||||
bool
|
||||
bh_applet_check_permission(const char *perm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end of extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
12
core/app-mgr/app-mgr-shared/app_mgr_shared.cmake
Normal file
12
core/app-mgr/app-mgr-shared/app_mgr_shared.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
set (APP_MGR_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
include_directories(${APP_MGR_SHARED_DIR})
|
||||
|
||||
|
||||
file (GLOB_RECURSE source_all ${APP_MGR_SHARED_DIR}/*.c)
|
||||
|
||||
set (APP_MGR_SHARED_SOURCE ${source_all})
|
||||
|
31
core/app-mgr/app-mgr-shared/host_link.h
Normal file
31
core/app-mgr/app-mgr-shared/host_link.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef DEPS_APP_MGR_APP_MGR_SHARED_HOST_LINK_H_
|
||||
#define DEPS_APP_MGR_APP_MGR_SHARED_HOST_LINK_H_
|
||||
|
||||
typedef enum LINK_MSG_TYPE {
|
||||
COAP_TCP_RAW = 0,
|
||||
COAP_UDP_RAW = 1,
|
||||
REQUEST_PACKET,
|
||||
RESPONSE_PACKET,
|
||||
INSTALL_WASM_BYTECODE_APP,
|
||||
CBOR_GENERIC = 30,
|
||||
|
||||
LINK_MSG_TYPE_MAX = 50
|
||||
} LINK_MSG_TYPE;
|
||||
|
||||
/* Link message, or message between host and app manager */
|
||||
typedef struct bh_link_msg_t {
|
||||
/* 2 bytes leading */
|
||||
uint16_t leading_bytes;
|
||||
/* message type, must be COAP_TCP or COAP_UDP */
|
||||
uint16_t message_type;
|
||||
/* size of payload */
|
||||
uint32_t payload_size;
|
||||
char *payload;
|
||||
} bh_link_msg_t;
|
||||
|
||||
#endif /* DEPS_APP_MGR_APP_MGR_SHARED_HOST_LINK_H_ */
|
53
core/app-mgr/module.json
Normal file
53
core/app-mgr/module.json
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"name": "aee",
|
||||
"version": "0.0.1",
|
||||
"description": "aee",
|
||||
"type": "source",
|
||||
"category": "middleware",
|
||||
"arch": "x86, arc, posix",
|
||||
"includes": [
|
||||
"Beihai/classlib/include",
|
||||
"Beihai/runtime/include",
|
||||
"Beihai/runtime/platform/include",
|
||||
"Beihai/runtime/platform/zephyr",
|
||||
"Beihai/runtime/utils/coap/er-coap",
|
||||
"Beihai/runtime/utils/coap/extension",
|
||||
"iwasm/runtime/include",
|
||||
"iwasm/runtime/platform/include",
|
||||
"iwasm/runtime/platform/zephyr",
|
||||
"iwasm/runtime/vmcore_wasm"
|
||||
],
|
||||
"sources": [
|
||||
"Beihai/classlib/native/internal/*.c",
|
||||
"Beihai/classlib/native/*.c",
|
||||
"Beihai/runtime/gc/*.c",
|
||||
"Beihai/runtime/platform/zephyr/*.c",
|
||||
"Beihai/runtime/utils/*.c",
|
||||
"Beihai/runtime/utils/coap/er-coap/*.c",
|
||||
"Beihai/runtime/utils/coap/extension/*.c",
|
||||
"Beihai/runtime/vmcore_jeff/*.c",
|
||||
"app-manager/app-manager.c",
|
||||
"app-manager/app-manager-host.c",
|
||||
"app-manager/app_mgr_zephyr.c",
|
||||
"app-manager/event.c",
|
||||
"app-manager/message.c",
|
||||
"app-manager/module_jeff.c",
|
||||
"app-manager/module_wasm_lib.c",
|
||||
"app-manager/module_wasm_app.c",
|
||||
"app-manager/watchdog.c",
|
||||
"Beihai/products/iMRT/*.c",
|
||||
"iwasm/runtime/utils/*.c",
|
||||
"iwasm/runtime/platform/zephyr/*.c",
|
||||
"iwasm/runtime/vmcore_wasm/*.c",
|
||||
"iwasm/lib/lib-export\.c",
|
||||
"iwasm/lib/aee/*.c",
|
||||
"iwasm/products/zephyr/sample/src/*.c"
|
||||
],
|
||||
"compile_definitions": [
|
||||
"NVALGRIND",
|
||||
"__JLF__",
|
||||
"__ZEPHYR__"
|
||||
],
|
||||
"target": "aee",
|
||||
"dependencies": []
|
||||
}
|
723
core/config.h
723
core/config.h
|
@ -1,723 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*/
|
||||
|
||||
#ifndef _CONFIG_H_
|
||||
#define _CONFIG_H_
|
||||
|
||||
/* clang-format off */
|
||||
#if !defined(BUILD_TARGET_X86_64) \
|
||||
&& !defined(BUILD_TARGET_AMD_64) \
|
||||
&& !defined(BUILD_TARGET_AARCH64) \
|
||||
&& !defined(BUILD_TARGET_X86_32) \
|
||||
&& !defined(BUILD_TARGET_ARM) \
|
||||
&& !defined(BUILD_TARGET_ARM_VFP) \
|
||||
&& !defined(BUILD_TARGET_THUMB) \
|
||||
&& !defined(BUILD_TARGET_THUMB_VFP) \
|
||||
&& !defined(BUILD_TARGET_MIPS) \
|
||||
&& !defined(BUILD_TARGET_XTENSA) \
|
||||
&& !defined(BUILD_TARGET_RISCV64_LP64D) \
|
||||
&& !defined(BUILD_TARGET_RISCV64_LP64) \
|
||||
&& !defined(BUILD_TARGET_RISCV32_ILP32D) \
|
||||
&& !defined(BUILD_TARGET_RISCV32_ILP32F) \
|
||||
&& !defined(BUILD_TARGET_RISCV32_ILP32) \
|
||||
&& !defined(BUILD_TARGET_ARC)
|
||||
/* clang-format on */
|
||||
#if defined(__x86_64__) || defined(__x86_64)
|
||||
#define BUILD_TARGET_X86_64
|
||||
#elif defined(__amd64__) || defined(__amd64)
|
||||
#define BUILD_TARGET_AMD_64
|
||||
#elif defined(__aarch64__)
|
||||
#define BUILD_TARGET_AARCH64
|
||||
#elif defined(__i386__) || defined(__i386) || defined(i386)
|
||||
#define BUILD_TARGET_X86_32
|
||||
#elif defined(__thumb__)
|
||||
#define BUILD_TARGET_THUMB
|
||||
#define BUILD_TARGET "THUMBV4T"
|
||||
#elif defined(__arm__)
|
||||
#define BUILD_TARGET_ARM
|
||||
#define BUILD_TARGET "ARMV4T"
|
||||
#elif defined(__mips__) || defined(__mips) || defined(mips)
|
||||
#define BUILD_TARGET_MIPS
|
||||
#elif defined(__XTENSA__)
|
||||
#define BUILD_TARGET_XTENSA
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#define BUILD_TARGET_RISCV64_LP64D
|
||||
#elif defined(__riscv) && (__riscv_xlen == 32) && !defined(__riscv_flen)
|
||||
#define BUILD_TARGET_RISCV32_ILP32
|
||||
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 32)
|
||||
#define BUILD_TARGET_RISCV32_ILP32F
|
||||
#elif defined(__riscv) && (__riscv_xlen == 32) && (__riscv_flen == 64)
|
||||
#define BUILD_TARGET_RISCV32_ILP32D
|
||||
#elif defined(__arc__)
|
||||
#define BUILD_TARGET_ARC
|
||||
#else
|
||||
#error "Build target isn't set"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BH_DEBUG
|
||||
#define BH_DEBUG 0
|
||||
#endif
|
||||
|
||||
#define MEM_ALLOCATOR_EMS 0
|
||||
#define MEM_ALLOCATOR_TLSF 1
|
||||
|
||||
/* Default memory allocator */
|
||||
#define DEFAULT_MEM_ALLOCATOR MEM_ALLOCATOR_EMS
|
||||
|
||||
#ifndef WASM_ENABLE_INTERP
|
||||
#define WASM_ENABLE_INTERP 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_AOT
|
||||
#define WASM_ENABLE_AOT 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_DYNAMIC_AOT_DEBUG
|
||||
#define WASM_ENABLE_DYNAMIC_AOT_DEBUG 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WORD_ALIGN_READ
|
||||
#define WASM_ENABLE_WORD_ALIGN_READ 0
|
||||
#endif
|
||||
|
||||
#define AOT_MAGIC_NUMBER 0x746f6100
|
||||
#define AOT_CURRENT_VERSION 4
|
||||
|
||||
#ifndef WASM_ENABLE_JIT
|
||||
#define WASM_ENABLE_JIT 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LAZY_JIT
|
||||
#define WASM_ENABLE_LAZY_JIT 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ORC_JIT_BACKEND_THREAD_NUM
|
||||
/* The number of backend threads created by runtime */
|
||||
#define WASM_ORC_JIT_BACKEND_THREAD_NUM 4
|
||||
#endif
|
||||
|
||||
#if WASM_ORC_JIT_BACKEND_THREAD_NUM < 1
|
||||
#error "WASM_ORC_JIT_BACKEND_THREAD_NUM must be greater than 0"
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ORC_JIT_COMPILE_THREAD_NUM
|
||||
/* The number of compilation threads created by LLVM JIT */
|
||||
#define WASM_ORC_JIT_COMPILE_THREAD_NUM 4
|
||||
#endif
|
||||
|
||||
#if WASM_ORC_JIT_COMPILE_THREAD_NUM < 1
|
||||
#error "WASM_ORC_JIT_COMPILE_THREAD_NUM must be greater than 0"
|
||||
#endif
|
||||
|
||||
#if (WASM_ENABLE_AOT == 0) && (WASM_ENABLE_JIT != 0)
|
||||
/* LLVM JIT can only be enabled when AOT is enabled */
|
||||
#undef WASM_ENABLE_JIT
|
||||
#define WASM_ENABLE_JIT 0
|
||||
|
||||
#undef WASM_ENABLE_LAZY_JIT
|
||||
#define WASM_ENABLE_LAZY_JIT 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_FAST_JIT
|
||||
#define WASM_ENABLE_FAST_JIT 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_FAST_JIT_DUMP
|
||||
#define WASM_ENABLE_FAST_JIT_DUMP 0
|
||||
#endif
|
||||
|
||||
#ifndef FAST_JIT_DEFAULT_CODE_CACHE_SIZE
|
||||
#define FAST_JIT_DEFAULT_CODE_CACHE_SIZE 10 * 1024 * 1024
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WAMR_COMPILER
|
||||
#define WASM_ENABLE_WAMR_COMPILER 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LIBC_BUILTIN
|
||||
#define WASM_ENABLE_LIBC_BUILTIN 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LIBC_WASI
|
||||
#define WASM_ENABLE_LIBC_WASI 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_UVWASI
|
||||
#define WASM_ENABLE_UVWASI 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WASI_NN
|
||||
#define WASM_ENABLE_WASI_NN 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WASI_NN_GPU
|
||||
#define WASM_ENABLE_WASI_NN_GPU 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE
|
||||
#define WASM_ENABLE_WASI_NN_EXTERNAL_DELEGATE 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WASI_EPHEMERAL_NN
|
||||
#define WASM_ENABLE_WASI_EPHEMERAL_NN 0
|
||||
#endif
|
||||
|
||||
/* Default disable libc emcc */
|
||||
#ifndef WASM_ENABLE_LIBC_EMCC
|
||||
#define WASM_ENABLE_LIBC_EMCC 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LIB_RATS
|
||||
#define WASM_ENABLE_LIB_RATS 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LIB_PTHREAD
|
||||
#define WASM_ENABLE_LIB_PTHREAD 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LIB_PTHREAD_SEMAPHORE
|
||||
#define WASM_ENABLE_LIB_PTHREAD_SEMAPHORE 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_LIB_WASI_THREADS
|
||||
#define WASM_ENABLE_LIB_WASI_THREADS 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION
|
||||
#define WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION WASM_ENABLE_LIB_WASI_THREADS
|
||||
#elif WASM_ENABLE_HEAP_AUX_STACK_ALLOCATION == 0 \
|
||||
&& WASM_ENABLE_LIB_WASI_THREADS == 1
|
||||
#error "Heap aux stack allocation must be enabled for WASI threads"
|
||||
#endif
|
||||
|
||||
#ifndef WAMR_ENABLE_COPY_CALLSTACK
|
||||
#define WAMR_ENABLE_COPY_CALLSTACK 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_BASE_LIB
|
||||
#define WASM_ENABLE_BASE_LIB 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_APP_FRAMEWORK
|
||||
#define WASM_ENABLE_APP_FRAMEWORK 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_HAVE_MREMAP
|
||||
#define WASM_HAVE_MREMAP 0
|
||||
#endif
|
||||
|
||||
/* Bulk memory operation */
|
||||
#ifndef WASM_ENABLE_BULK_MEMORY
|
||||
#define WASM_ENABLE_BULK_MEMORY 0
|
||||
#endif
|
||||
|
||||
/* Shared memory */
|
||||
#ifndef WASM_ENABLE_SHARED_MEMORY
|
||||
#define WASM_ENABLE_SHARED_MEMORY 0
|
||||
#endif
|
||||
|
||||
/* Thread manager */
|
||||
#ifndef WASM_ENABLE_THREAD_MGR
|
||||
#define WASM_ENABLE_THREAD_MGR 0
|
||||
#endif
|
||||
|
||||
/* Source debugging */
|
||||
#ifndef WASM_ENABLE_DEBUG_INTERP
|
||||
#define WASM_ENABLE_DEBUG_INTERP 0
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
#ifndef DEBUG_EXECUTION_MEMORY_SIZE
|
||||
/* 0x85000 is the size required by lldb, if this is changed to a smaller value,
|
||||
* then the debugger will not be able to evaluate user expressions, other
|
||||
* functionality such as breakpoint and stepping are not influenced by this */
|
||||
#define DEBUG_EXECUTION_MEMORY_SIZE 0x85000
|
||||
#endif
|
||||
#endif /* end of WASM_ENABLE_DEBUG_INTERP != 0 */
|
||||
|
||||
#ifndef WASM_ENABLE_DEBUG_AOT
|
||||
#define WASM_ENABLE_DEBUG_AOT 0
|
||||
#endif
|
||||
|
||||
/* Custom sections */
|
||||
#ifndef WASM_ENABLE_LOAD_CUSTOM_SECTION
|
||||
#define WASM_ENABLE_LOAD_CUSTOM_SECTION 0
|
||||
#endif
|
||||
|
||||
/* WASM log system */
|
||||
#ifndef WASM_ENABLE_LOG
|
||||
#define WASM_ENABLE_LOG 1
|
||||
#endif
|
||||
|
||||
/* When this flag is set, WAMR will not automatically
|
||||
* initialize sockets on Windows platforms. The host
|
||||
* application is responsible for calling WSAStartup()
|
||||
* before executing WAMR code that uses sockets, and
|
||||
* calling WSACleanup() after.
|
||||
* This flag passes control of socket initialization from
|
||||
* WAMR to the host application. */
|
||||
#ifndef WASM_ENABLE_HOST_SOCKET_INIT
|
||||
#define WASM_ENABLE_HOST_SOCKET_INIT 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS
|
||||
#if defined(BUILD_TARGET_X86_32) || defined(BUILD_TARGET_X86_64) \
|
||||
|| defined(BUILD_TARGET_AARCH64)
|
||||
#define WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS 1
|
||||
#else
|
||||
#define WASM_CPU_SUPPORTS_UNALIGNED_ADDR_ACCESS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* WASM Interpreter labels-as-values feature */
|
||||
#ifndef WASM_ENABLE_LABELS_AS_VALUES
|
||||
#ifdef __GNUC__
|
||||
#define WASM_ENABLE_LABELS_AS_VALUES 1
|
||||
#else
|
||||
#define WASM_ENABLE_LABELS_AS_VALUES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Enable fast interpreter or not */
|
||||
#ifndef WASM_ENABLE_FAST_INTERP
|
||||
#define WASM_ENABLE_FAST_INTERP 0
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_FAST_INTERP != 0
|
||||
#define WASM_DEBUG_PREPROCESSOR 0
|
||||
#endif
|
||||
|
||||
/* Enable opcode counter or not */
|
||||
#ifndef WASM_ENABLE_OPCODE_COUNTER
|
||||
#define WASM_ENABLE_OPCODE_COUNTER 0
|
||||
#endif
|
||||
|
||||
/* Support a module with dependency, other modules */
|
||||
#ifndef WASM_ENABLE_MULTI_MODULE
|
||||
#define WASM_ENABLE_MULTI_MODULE 0
|
||||
#endif
|
||||
|
||||
/* Enable wasm mini loader or not */
|
||||
#ifndef WASM_ENABLE_MINI_LOADER
|
||||
#define WASM_ENABLE_MINI_LOADER 0
|
||||
#endif
|
||||
|
||||
/* Disable boundary check with hardware trap or not,
|
||||
* enable it by default if it is supported */
|
||||
#ifndef WASM_DISABLE_HW_BOUND_CHECK
|
||||
#define WASM_DISABLE_HW_BOUND_CHECK 0
|
||||
#endif
|
||||
|
||||
/* Disable native stack access boundary check with hardware
|
||||
* trap or not, enable it by default if it is supported */
|
||||
#ifndef WASM_DISABLE_STACK_HW_BOUND_CHECK
|
||||
#define WASM_DISABLE_STACK_HW_BOUND_CHECK 0
|
||||
#endif
|
||||
|
||||
/* Disable SIMD unless it is manually enabled somewhere */
|
||||
#ifndef WASM_ENABLE_SIMD
|
||||
#define WASM_ENABLE_SIMD 0
|
||||
#endif
|
||||
|
||||
/* Disable SIMDe (used in the fast interpreter for SIMD opcodes)
|
||||
unless used elsewhere */
|
||||
#ifndef WASM_ENABLE_SIMDE
|
||||
#define WASM_ENABLE_SIMDE 0
|
||||
#endif
|
||||
|
||||
/* GC performance profiling */
|
||||
#ifndef WASM_ENABLE_GC_PERF_PROFILING
|
||||
#define WASM_ENABLE_GC_PERF_PROFILING 0
|
||||
#endif
|
||||
|
||||
/* Memory profiling */
|
||||
#ifndef WASM_ENABLE_MEMORY_PROFILING
|
||||
#define WASM_ENABLE_MEMORY_PROFILING 0
|
||||
#endif
|
||||
|
||||
/* Memory tracing */
|
||||
#ifndef WASM_ENABLE_MEMORY_TRACING
|
||||
#define WASM_ENABLE_MEMORY_TRACING 0
|
||||
#endif
|
||||
|
||||
/* Performance profiling */
|
||||
#ifndef WASM_ENABLE_PERF_PROFILING
|
||||
#define WASM_ENABLE_PERF_PROFILING 0
|
||||
#endif
|
||||
|
||||
/* Dump call stack */
|
||||
#ifndef WASM_ENABLE_DUMP_CALL_STACK
|
||||
#define WASM_ENABLE_DUMP_CALL_STACK 0
|
||||
#endif
|
||||
|
||||
/* AOT stack frame */
|
||||
#ifndef WASM_ENABLE_AOT_STACK_FRAME
|
||||
#define WASM_ENABLE_AOT_STACK_FRAME 0
|
||||
#endif
|
||||
|
||||
/* Heap verification */
|
||||
#ifndef BH_ENABLE_GC_VERIFY
|
||||
#define BH_ENABLE_GC_VERIFY 0
|
||||
#endif
|
||||
|
||||
/* Heap corruption check, enabled by default */
|
||||
#ifndef BH_ENABLE_GC_CORRUPTION_CHECK
|
||||
#define BH_ENABLE_GC_CORRUPTION_CHECK 1
|
||||
#endif
|
||||
|
||||
/* Enable global heap pool if heap verification is enabled */
|
||||
#if BH_ENABLE_GC_VERIFY != 0
|
||||
#define WASM_ENABLE_GLOBAL_HEAP_POOL 1
|
||||
#endif
|
||||
|
||||
/* Global heap pool */
|
||||
#ifndef WASM_ENABLE_GLOBAL_HEAP_POOL
|
||||
#define WASM_ENABLE_GLOBAL_HEAP_POOL 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_SPEC_TEST
|
||||
#define WASM_ENABLE_SPEC_TEST 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WASI_TEST
|
||||
#define WASM_ENABLE_WASI_TEST 0
|
||||
#endif
|
||||
|
||||
/* Global heap pool size in bytes */
|
||||
#ifndef WASM_GLOBAL_HEAP_SIZE
|
||||
#define WASM_GLOBAL_HEAP_SIZE (10 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/* Default length of queue */
|
||||
#ifndef DEFAULT_QUEUE_LENGTH
|
||||
#define DEFAULT_QUEUE_LENGTH 50
|
||||
#endif
|
||||
|
||||
/* The max percentage of global heap that app memory space can grow */
|
||||
#ifndef APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT
|
||||
#define APP_MEMORY_MAX_GLOBAL_HEAP_PERCENT 1 / 3
|
||||
#endif
|
||||
|
||||
/* Default min/max heap size of each app */
|
||||
#ifndef APP_HEAP_SIZE_DEFAULT
|
||||
#define APP_HEAP_SIZE_DEFAULT (8 * 1024)
|
||||
#endif
|
||||
#define APP_HEAP_SIZE_MIN (256)
|
||||
/* The ems memory allocator supports maximal heap size 1GB,
|
||||
see ems_gc_internal.h */
|
||||
#define APP_HEAP_SIZE_MAX (1024 * 1024 * 1024)
|
||||
|
||||
/* Default min/max gc heap size of each app */
|
||||
#ifndef GC_HEAP_SIZE_DEFAULT
|
||||
#define GC_HEAP_SIZE_DEFAULT (128 * 1024)
|
||||
#endif
|
||||
#define GC_HEAP_SIZE_MIN (4 * 1024)
|
||||
#define GC_HEAP_SIZE_MAX (1024 * 1024 * 1024)
|
||||
|
||||
/* Default wasm stack size of each app */
|
||||
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
|
||||
#define DEFAULT_WASM_STACK_SIZE (16 * 1024)
|
||||
#else
|
||||
#define DEFAULT_WASM_STACK_SIZE (12 * 1024)
|
||||
#endif
|
||||
/* Min auxiliary stack size of each wasm thread */
|
||||
#define WASM_THREAD_AUX_STACK_SIZE_MIN (256)
|
||||
|
||||
/* Default/min native stack size of each app thread */
|
||||
#if !(defined(APP_THREAD_STACK_SIZE_DEFAULT) \
|
||||
&& defined(APP_THREAD_STACK_SIZE_MIN))
|
||||
#if defined(BH_PLATFORM_ZEPHYR) || defined(BH_PLATFORM_ALIOS_THINGS) \
|
||||
|| defined(BH_PLATFORM_ESP_IDF) || defined(BH_PLATFORM_OPENRTOS)
|
||||
#define APP_THREAD_STACK_SIZE_DEFAULT (6 * 1024)
|
||||
#define APP_THREAD_STACK_SIZE_MIN (4 * 1024)
|
||||
#elif defined(PTHREAD_STACK_DEFAULT) && defined(PTHREAD_STACK_MIN)
|
||||
#define APP_THREAD_STACK_SIZE_DEFAULT PTHREAD_STACK_DEFAULT
|
||||
#define APP_THREAD_STACK_SIZE_MIN PTHREAD_STACK_MIN
|
||||
#elif WASM_ENABLE_UVWASI != 0
|
||||
/* UVWASI requires larger native stack */
|
||||
#define APP_THREAD_STACK_SIZE_DEFAULT (64 * 1024)
|
||||
#define APP_THREAD_STACK_SIZE_MIN (48 * 1024)
|
||||
#else
|
||||
#define APP_THREAD_STACK_SIZE_DEFAULT (128 * 1024)
|
||||
#define APP_THREAD_STACK_SIZE_MIN (24 * 1024)
|
||||
#endif
|
||||
#endif /* end of !(defined(APP_THREAD_STACK_SIZE_DEFAULT) \
|
||||
&& defined(APP_THREAD_STACK_SIZE_MIN)) */
|
||||
|
||||
/* Max native stack size of each app thread */
|
||||
#if !defined(APP_THREAD_STACK_SIZE_MAX)
|
||||
#define APP_THREAD_STACK_SIZE_MAX (8 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
/* Reserved bytes to the native thread stack boundary, throw native
|
||||
* stack overflow exception if the guard boundary is reached
|
||||
*
|
||||
* WASM_STACK_GUARD_SIZE needs to be large enough for:
|
||||
*
|
||||
* - native functions
|
||||
*
|
||||
* w/o hw bound check, the overhead (aot_call_function etc) + the native
|
||||
* function itself. as of writing this, the former is about 1000 bytes
|
||||
* on macOS amd64.
|
||||
*
|
||||
* with hw bound check, theoretically, only needs to cover the logic to
|
||||
* set up the jmp_buf stack.
|
||||
*
|
||||
* - aot runtime functions
|
||||
* eg. aot_enlarge_memory.
|
||||
*
|
||||
* - w/o hw bound check, the interpreter loop
|
||||
*
|
||||
* the stack consumption heavily depends on compiler settings,
|
||||
* especially for huge functions like the classic interpreter's
|
||||
* wasm_interp_call_func_bytecode:
|
||||
*
|
||||
* 200 bytes (release build, macOS/amd64)
|
||||
* 2600 bytes (debug build, macOS/amd64)
|
||||
*
|
||||
* - platform-provided functions (eg. libc)
|
||||
*
|
||||
* the following are examples of the stack consumptions observed for
|
||||
* host APIs.
|
||||
*
|
||||
* snprintf: (used by eg. wasm_runtime_set_exception)
|
||||
* - about 1600 bytes on macOS/amd64
|
||||
* - about 2000 bytes on Ubuntu amd64 20.04
|
||||
*
|
||||
* gethostbyname:
|
||||
* - 3KB-6KB on macOS/amd64
|
||||
* - 10KB on Ubuntu amd64 20.04
|
||||
*
|
||||
* getaddrinfo:
|
||||
* - 4KB-17KB on macOS/amd64
|
||||
* - 12KB on Ubuntu amd64 20.04
|
||||
* - 0.3-1.5KB on NuttX/esp32s3
|
||||
*
|
||||
* - stack check wrapper functions generated by the aot compiler
|
||||
* (--stack-bounds-checks=1)
|
||||
*
|
||||
* wamrc issues a warning
|
||||
* "precheck functions themselves consume relatively large amount of stack"
|
||||
* when it detects wrapper functions requiring more than 1KB.
|
||||
*
|
||||
* - the ABI-defined red zone. eg. 128 bytes for SYSV x86-64 ABI.
|
||||
* cf. https://en.wikipedia.org/wiki/Red_zone_(computing)
|
||||
*
|
||||
* Note: on platforms with lazy function binding, don't forget to consider
|
||||
* the symbol resolution overhead on the first call. For example,
|
||||
* on Ubuntu amd64 20.04, it seems to consume about 1500 bytes.
|
||||
* For some reasons, macOS amd64 12.7.4 seems to resolve symbols eagerly.
|
||||
* (Observed with a binary with traditional non-chained fixups.)
|
||||
* The latest macOS seems to apply chained fixups in kernel on page-in time.
|
||||
* (thus it wouldn't consume userland stack.)
|
||||
*/
|
||||
#ifndef WASM_STACK_GUARD_SIZE
|
||||
#if WASM_ENABLE_UVWASI != 0
|
||||
/* UVWASI requires larger native stack */
|
||||
#define WASM_STACK_GUARD_SIZE (4096 * 6)
|
||||
#else
|
||||
/*
|
||||
* Use a larger default for platforms like macOS/Linux.
|
||||
*
|
||||
* For example, the classic interpreter loop which ended up with a trap
|
||||
* (wasm_runtime_set_exception) would consume about 2KB stack on x86-64
|
||||
* macOS. On Ubuntu amd64 20.04, it seems to consume a bit more.
|
||||
*
|
||||
* Although product-mini/platforms/nuttx always overrides
|
||||
* WASM_STACK_GUARD_SIZE, exclude NuttX here just in case.
|
||||
*/
|
||||
#if defined(__APPLE__) || (defined(__unix__) && !defined(__NuttX__))
|
||||
#if BH_DEBUG != 0 /* assumption: BH_DEBUG matches CMAKE_BUILD_TYPE=Debug */
|
||||
#define WASM_STACK_GUARD_SIZE (1024 * 5)
|
||||
#else
|
||||
#define WASM_STACK_GUARD_SIZE (1024 * 3)
|
||||
#endif
|
||||
#else
|
||||
/*
|
||||
* Otherwise, assume very small requirement for now.
|
||||
*
|
||||
* Embedders for very small devices likely fine-tune WASM_STACK_GUARD_SIZE
|
||||
* for their specific applications anyway.
|
||||
*/
|
||||
#define WASM_STACK_GUARD_SIZE 1024
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Guard page count for stack overflow check with hardware trap */
|
||||
#ifndef STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT
|
||||
#if defined(__APPLE__) && defined(__aarch64__)
|
||||
/* Note: on macOS/iOS arm64, the user page size is 16KB */
|
||||
#define STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT 1
|
||||
#else
|
||||
#define STACK_OVERFLOW_CHECK_GUARD_PAGE_COUNT 3
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Default wasm block address cache size and conflict list size */
|
||||
#ifndef BLOCK_ADDR_CACHE_SIZE
|
||||
#define BLOCK_ADDR_CACHE_SIZE 64
|
||||
#endif
|
||||
#define BLOCK_ADDR_CONFLICT_SIZE 2
|
||||
|
||||
/* Default max thread num per cluster. Can be overwrite by
|
||||
wasm_runtime_set_max_thread_num */
|
||||
#define CLUSTER_MAX_THREAD_NUM 4
|
||||
|
||||
#ifndef WASM_ENABLE_TAIL_CALL
|
||||
#define WASM_ENABLE_TAIL_CALL 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_CUSTOM_NAME_SECTION
|
||||
#define WASM_ENABLE_CUSTOM_NAME_SECTION 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_REF_TYPES
|
||||
#define WASM_ENABLE_REF_TYPES 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_GC
|
||||
#define WASM_ENABLE_GC 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_CONST_EXPR_STACK_SIZE
|
||||
#if WASM_ENABLE_GC != 0
|
||||
#define WASM_CONST_EXPR_STACK_SIZE 8
|
||||
#else
|
||||
#define WASM_CONST_EXPR_STACK_SIZE 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_STRINGREF
|
||||
#define WASM_ENABLE_STRINGREF 0
|
||||
#endif
|
||||
|
||||
#ifndef GC_REFTYPE_MAP_SIZE_DEFAULT
|
||||
#define GC_REFTYPE_MAP_SIZE_DEFAULT 64
|
||||
#endif
|
||||
|
||||
#ifndef GC_RTTOBJ_MAP_SIZE_DEFAULT
|
||||
#define GC_RTTOBJ_MAP_SIZE_DEFAULT 64
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_EXCE_HANDLING
|
||||
#define WASM_ENABLE_EXCE_HANDLING 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_TAGS
|
||||
#define WASM_ENABLE_TAGS 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_SGX_IPFS
|
||||
#define WASM_ENABLE_SGX_IPFS 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_MEM_ALLOC_WITH_USER_DATA
|
||||
#define WASM_MEM_ALLOC_WITH_USER_DATA 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_WASM_CACHE
|
||||
#define WASM_ENABLE_WASM_CACHE 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_STATIC_PGO
|
||||
#define WASM_ENABLE_STATIC_PGO 0
|
||||
#endif
|
||||
|
||||
/* Disable writing linear memory base address to GS segment register,
|
||||
by default only in linux x86-64, linear memory base addr is written
|
||||
to GS segment register before calling wasm/aot function. */
|
||||
#ifndef WASM_DISABLE_WRITE_GS_BASE
|
||||
#define WASM_DISABLE_WRITE_GS_BASE 0
|
||||
#endif
|
||||
|
||||
/* Configurable bounds checks */
|
||||
#ifndef WASM_CONFIGURABLE_BOUNDS_CHECKS
|
||||
#define WASM_CONFIGURABLE_BOUNDS_CHECKS 0
|
||||
#endif
|
||||
|
||||
/* Some chip cannot support external ram with rwx attr at the same time,
|
||||
it has to map it into 2 spaces of idbus and dbus, code in dbus can be
|
||||
read/written and read/executed in ibus. so there are 2 steps to execute
|
||||
the code, first, copy & do relocation in dbus space, and second execute
|
||||
it in ibus space, since in the 2 spaces the contents are the same,
|
||||
so we call it bus mirror.
|
||||
*/
|
||||
#ifndef WASM_MEM_DUAL_BUS_MIRROR
|
||||
#define WASM_MEM_DUAL_BUS_MIRROR 0
|
||||
#endif
|
||||
|
||||
/* The max number of module instance contexts. */
|
||||
#ifndef WASM_MAX_INSTANCE_CONTEXTS
|
||||
#define WASM_MAX_INSTANCE_CONTEXTS 8
|
||||
#endif
|
||||
|
||||
/* linux perf support */
|
||||
#ifndef WASM_ENABLE_LINUX_PERF
|
||||
#define WASM_ENABLE_LINUX_PERF 0
|
||||
#endif
|
||||
|
||||
/* Support registering quick AOT/JIT function entries of some func types
|
||||
to speed up the calling process of invoking the AOT/JIT functions of
|
||||
these types from the host embedder */
|
||||
#ifndef WASM_ENABLE_QUICK_AOT_ENTRY
|
||||
#define WASM_ENABLE_QUICK_AOT_ENTRY 1
|
||||
#endif
|
||||
|
||||
/* Support AOT intrinsic functions which can be called from the AOT code
|
||||
when `--disable-llvm-intrinsics` flag or
|
||||
`--enable-builtin-intrinsics=<intr1,intr2,...>` is used by wamrc to
|
||||
generate the AOT file */
|
||||
#ifndef WASM_ENABLE_AOT_INTRINSICS
|
||||
#define WASM_ENABLE_AOT_INTRINSICS 1
|
||||
#endif
|
||||
|
||||
/* Disable memory64 by default */
|
||||
#ifndef WASM_ENABLE_MEMORY64
|
||||
#define WASM_ENABLE_MEMORY64 0
|
||||
#endif
|
||||
|
||||
/* Disable multi-memory by default */
|
||||
#ifndef WASM_ENABLE_MULTI_MEMORY
|
||||
#define WASM_ENABLE_MULTI_MEMORY 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_TABLE_MAX_SIZE
|
||||
#define WASM_TABLE_MAX_SIZE 1024
|
||||
#endif
|
||||
|
||||
#ifndef WASM_MEM_ALLOC_WITH_USAGE
|
||||
#define WASM_MEM_ALLOC_WITH_USAGE 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_FUZZ_TEST
|
||||
#define WASM_ENABLE_FUZZ_TEST 0
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_FUZZ_TEST != 0
|
||||
#ifndef WASM_MEM_ALLOC_MAX_SIZE
|
||||
/* In oss-fuzz, the maximum RAM is ~2.5G */
|
||||
#define WASM_MEM_ALLOC_MAX_SIZE (2U * 1024 * 1024 * 1024)
|
||||
#endif
|
||||
#endif /* WASM_ENABLE_FUZZ_TEST != 0 */
|
||||
|
||||
#ifndef WASM_ENABLE_SHARED_HEAP
|
||||
#define WASM_ENABLE_SHARED_HEAP 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_SHRUNK_MEMORY
|
||||
#define WASM_ENABLE_SHRUNK_MEMORY 1
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_AOT_VALIDATOR
|
||||
#define WASM_ENABLE_AOT_VALIDATOR 0
|
||||
#endif
|
||||
|
||||
#ifndef WASM_ENABLE_INSTRUCTION_METERING
|
||||
#define WASM_ENABLE_INSTRUCTION_METERING 0
|
||||
#endif
|
||||
|
||||
#endif /* end of _CONFIG_H_ */
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
DEPS_ROOT=$(cd "$(dirname "$0")/" && pwd)
|
||||
cd ${DEPS_ROOT}
|
||||
|
||||
echo "Downloading tensorflow in ${PWD}..."
|
||||
|
||||
git clone https://github.com/tensorflow/tensorflow.git tensorflow-src \
|
||||
--branch v2.12.0
|
||||
|
||||
# NOTE: fixes this https://github.com/tensorflow/tensorflow/issues/59631
|
||||
cd tensorflow-src
|
||||
git cherry-pick 5115fa96d7c5b41451674892317be43e30b7c389
|
||||
|
||||
exit 0
|
|
@ -1,14 +0,0 @@
|
|||
# vmcore architecture
|
||||
- [WAMR memory model overview](https://bytecodealliance.github.io/wamr.dev/blog/the-wamr-memory-model/)
|
||||
|
||||
## Wasm function
|
||||
- [Wasm function architecture](./doc/wasm_function.MD)
|
||||
|
||||
## Exports
|
||||
- [Wasm export architecture](./doc/wasm_exports.MD)
|
||||
|
||||
## globals
|
||||
- [Wasm globals architecture](./doc/wasm_globals.MD)
|
||||
|
||||
## classic interpreter
|
||||
- [classic interpreter](./doc/classic_interpreter.MD)
|
|
@ -1,33 +0,0 @@
|
|||
#
|
||||
# Copyright (c) 2021, RT-Thread Development Team
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
from building import *
|
||||
import re
|
||||
Import('rtconfig')
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
src = Split('''
|
||||
aot_loader.c
|
||||
aot_runtime.c
|
||||
aot_intrinsic.c
|
||||
''')
|
||||
|
||||
if rtconfig.ARCH == 'arm':
|
||||
if re.match('^cortex-m.*', rtconfig.CPU):
|
||||
src += ['arch/aot_reloc_thumb.c']
|
||||
elif re.match('^cortex-a.*', rtconfig.CPU):
|
||||
src += ['arch/aot_reloc_arm.c']
|
||||
elif rtconfig.ARCH == 'ia32':
|
||||
src += ['arch/aot_reloc_x86_32.c']
|
||||
|
||||
CPPPATH = [cwd, cwd + '/../include']
|
||||
|
||||
CPPDEFINES = ['WASM_ENABLE_AOT=1']
|
||||
|
||||
group = DefineGroup('iwasm_aot', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
|
||||
|
||||
Return('group')
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user