Skip to content

Commit

Permalink
[Docs] Update the build options doc.
Browse files Browse the repository at this point in the history
Signed-off-by: YiYing He <[email protected]>
  • Loading branch information
q82419 authored and hydai committed Aug 16, 2022
1 parent 576cee8 commit 2968674
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
37 changes: 28 additions & 9 deletions docs/book/en/src/extend/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,34 @@ mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_TESTS=ON .. && make -j
```


### If you don't want to build Ahead-of-Time runtime/compiler

If you don't need Ahead-of-Time runtime/compiler support, you can set the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` to `OFF`.

```bash
cmake -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=OFF ..
```
### Building Options

Developers can set the CMake options to customize the WasmEdge building.

1. `WASMEDGE_BUILD_TESTS`: build the WasmEdge tests. Default is `OFF`.
2. `WASMEDGE_BUILD_AOT_RUNTIME`: build with the Ahead-of-Time compiler supporting. Default is `ON`.
3. `WASMEDGE_BUILD_SHARED_LIB`: build the WasmEdge shared library (`libwasmedge_c.so`, `libwasmedge_c.dylib`, or `wasmedge_c.dll`). Default is `ON`.
- By default, the WasmEdge shared library will link to the LLVM shared library.
4. `WASMEDGE_BUILD_STATIC_LIB`: build the WasmEdge static library (`libwasmedge_c.a`, Linux and MacOS platforms, experimental). Default is `OFF`.
- If this option is set as `ON`, the option `WASMEDGE_FORCE_DISABLE_LTO` will forcefully be set as `ON`.
- If this option is set as `ON`, the `libz` and `libtinfo` on Linux platforms will be statically linked.
5. `WASMEDGE_BUILD_TOOLS`: build the `wasmedge` and `wasmedgec` tools. Default is `ON`.
- The `wasmedge` and `wasmedgec` tools will link to the WasmEdge shared library by default.
- The option `WASMEDGE_BUILD_SHARED_LIB` will forcefully be set as `ON` if the `WASMEDGE_BUILD_STATIC_LIB` is `OFF` and the `WASMEDGE_LINK_TOOLS_STATIC` is `OFF`.
- If this option is set as `ON` and `WASMEDGE_BUILD_AOT_RUNTIME` is set as `OFF`, the `wasmedgec` tool for the AOT compiler will not be built.
- If this option and the option `WASMEDGE_BUILD_STATIC_LIB` are both set as `ON`, the `WASMEDGE_LINK_LLVM_STATIC` will be set as `ON` and the `wasmedge` and `wasmedgec` tools will link to the WasmEdge static library so that be the standalone tools accordingly.
6. `WASMEDGE_BUILD_PLUGINS`: build the WasmEdge plugins. Default is `ON`.
7. `WASMEDGE_BUILD_EXAMPLE`: build the WasmEdge examples. Default is `OFF`.
8. `WASMEDGE_PLUGIN_WASI_NN_BACKEND`: build the WasmEdge WASI-NN plugin (Linux platforms only). Default is empty.
- This option is useless if the option `WASMEDGE_BUILD_PLUGINS` is set as `OFF`.
- To build the WASI-NN plugin with backend, please use `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=<backend_name>`.
- To build the WASI-NN plugin with multiple backends, please use `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=<backend_name1>,<backend_name2>`.
9. `WASMEDGE_PLUGIN_WASI_CRYPTO`: build the WasmEdge WASI-Crypto plugin (Linux platforms only). Default is `OFF`.
- This option is useless if the option `WASMEDGE_BUILD_PLUGINS` is set as `OFF`.
10. `WASMEDGE_FORCE_DISABLE_LTO`: forcefully turn off the link time optimization. Default is `OFF`.
11. `WASMEDGE_LINK_LLVM_STATIC`: link the LLVM and lld libraries statically (Linux and MacOS platforms only, experimental). Default is `OFF`.
12. `WASMEDGE_LINK_TOOLS_STATIC`: make the `wasmedge` and `wasmedgec` tools to link the WasmEdge library and LLVM libraries statically (Linux and MacOS platforms only, experimental). Default is `OFF`.
- If the option `WASMEDGE_BUILD_TOOLS` and this option are both set as `ON`, the `WASMEDGE_LINK_LLVM_STATIC` will be set as `ON`.

## Run built-in tests

Expand All @@ -138,4 +158,3 @@ LD_LIBRARY_PATH=$(pwd)/lib/api ctest
## Run applications

Next, follow [this guide](../index.md) to run WebAssembly bytecode programs in `wasmedge`.

4 changes: 2 additions & 2 deletions docs/book/en/src/extend/build_on_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ After the build is finished, you can find there are several wasmedge related too
2. `wasmedgec` is the ahead-of-time `WASM` compiler.
- `wasmedgec` compiles a general `WASM` file into a `dll` file.
- To disable building the ahead-of-time compiler, set the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` to `OFF`.
3. `libwasmedge_c.dll` is the WasmEdge C API shared library.
- `libwasmedge_c.dll` provides the C API for the ahead-of-time compiler and the WASM runtime.
3. `wasmedge_c.dll` is the WasmEdge C API shared library.
- `wasmedge_c.dll` provides the C API for the ahead-of-time compiler and the WASM runtime.
- The APIs related to the ahead-of-time compiler will always fail if the CMake option `WASMEDGE_BUILD_AOT_RUNTIME` is set to `OFF`.
- To disable building the shared library, set the CMake option `WASMEDGE_BUILD_SHARED_LIB` to `OFF`.

Expand Down
4 changes: 2 additions & 2 deletions docs/book/zh/src/extend/build_on_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ cmake -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_BUILD_AOT_RUNTIME=OFF ..
2. `wasmedgec` 是一个 AOT `WASM` 编译器。
- `wasmedgec` 将一个 `WASM` 格式的文件编译为`dll` 格式文件。
- 如果你不需要构建 AOT 编译器,可以将 CMake 选项 `WASMEDGE_BUILD_AOT_RUNTIME` 设置为 `OFF`
3. `libwasmedge_c.dll` 是 WasmEdge 的 C API 共享库.
- `libwasmedge_c.dll` 为 AOT 编译器和 WASM 运行时提供 C API。
3. `wasmedge_c.dll` 是 WasmEdge 的 C API 共享库.
- `wasmedge_c.dll` 为 AOT 编译器和 WASM 运行时提供 C API。
- CMake 选项 `WASMEDGE_BUILD_AOT_RUNTIME` 设置为 `OFF` 后,调用与 AOT 编译器相关的 API 只会返回失败值。
- 如果你不需要构建共享库,可以将 CMake 选项 `WASMEDGE_BUILD_SHARED_LIB` 设置为 `OFF`

Expand Down

0 comments on commit 2968674

Please sign in to comment.