Skip to content

Commit

Permalink
wasmedge
Browse files Browse the repository at this point in the history
Signed-off-by: turuslan <turuslan.devbox@gmail.com>
  • Loading branch information
turuslan committed Dec 26, 2023
1 parent da02798 commit 903e3c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if(NOT($ENV{CI}) OR NOT($ENV{GITHUB_ACTIONS}))
endif()
option(EXTERNAL_PROJECT "Build external project" ${_EXTERNAL_PROJECT_DEFAULT})

set(WASM_COMPILER WAVM CACHE STRING "WebAssembly compiler built into Kagome: one of [WAVM, WasmEdge]")
option(WASM_COMPILER "WebAssembly compiler built into Kagome: one of [WAVM, WasmEdge]" WAVM)

if (NOT ${WASM_COMPILER} MATCHES "^(WAVM|WasmEdge)$")
fatal_error("WASM_COMPILER is set to ${WASM_COMPILER} but should be one of [WAVM, WasmEdge]")
Expand Down
8 changes: 8 additions & 0 deletions core/runtime/wasm_edge/register_host_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ namespace kagome::runtime::wasm_edge {
WasmEdge_ValType get_wasm_type<int32_t>() {
return WasmEdge_ValType_I32;
}
template <>
WasmEdge_ValType get_wasm_type<uint32_t>() {
return WasmEdge_ValType_I32;
}

template <>
WasmEdge_ValType get_wasm_type<int64_t>() {
Expand Down Expand Up @@ -48,6 +52,10 @@ namespace kagome::runtime::wasm_edge {
int32_t get_wasm_value<int32_t>(WasmEdge_Value v) {
return WasmEdge_ValueGetI32(v);
}
template <>
uint32_t get_wasm_value<uint32_t>(WasmEdge_Value v) {
return WasmEdge_ValueGetI32(v);
}

template <typename Ret, typename... Args>
using HostApiMethod = Ret (host_api::HostApi::*)(Args...);
Expand Down

0 comments on commit 903e3c6

Please sign in to comment.