Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-33154 Refactor WebAssembly Support #19375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/wasmembed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref/
8 changes: 6 additions & 2 deletions plugins/wasmembed/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ project(wasmembed)
if(WASMEMBED)
ADD_PLUGIN(wasmembed)
if(MAKE_WASMEMBED)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_subdirectory(component-model)

find_path(WASMTIME_CPP_API_INCLUDE_DIRS "wasmtime-cpp-api/wasmtime.hh"
PATHS ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}
)
Expand All @@ -21,6 +24,7 @@ if(WASMEMBED)
include_directories(
${WASMTIME_CPP_API_INCLUDE_DIRS}/wasmtime-c-api
${WASMTIME_CPP_API_INCLUDE_DIRS}/wasmtime-cpp-api

./../../system/include
./../../system/jlib
./../../rtl/eclrtl
Expand All @@ -37,12 +41,12 @@ if(WASMEMBED)
add_library(wasmembed SHARED
wasmembed.cpp
secure-enclave.cpp
abi.cpp
util.cpp
)

target_link_libraries(wasmembed
${WASMTIME_LIB}
component-model-cpp
eclrtl
jlib
)
Expand Down
269 changes: 0 additions & 269 deletions plugins/wasmembed/abi.cpp

This file was deleted.

10 changes: 0 additions & 10 deletions plugins/wasmembed/abi.hpp

This file was deleted.

2 changes: 2 additions & 0 deletions plugins/wasmembed/component-model/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
add_subdirectory(src)
add_subdirectory(test)
42 changes: 42 additions & 0 deletions plugins/wasmembed/component-model/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
project(component-model-cpp)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(SRC
boolean.cpp
boolean.hpp
context.hpp
context.cpp
float.hpp
float.cpp
integer.hpp
integer.cpp
list.hpp
list.cpp
load.hpp
load.cpp
string.hpp
string.cpp
traits.hpp
traits.cpp
util.hpp
util.cpp
)

add_library(${PROJECT_NAME} STATIC
${SRC}
)

target_link_libraries(${PROJECT_NAME}
)

target_compile_definitions(${PROJECT_NAME}
PRIVATE CMCPP_EXPORTS
)
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive->")

target_include_directories(
${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
)
19 changes: 19 additions & 0 deletions plugins/wasmembed/component-model/src/boolean.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "boolean.hpp"
#include "integer.hpp"
#include "util.hpp"

namespace cmcpp
{
namespace boolean
{
void store(CallContext &cx, const bool_t &v, offset ptr)
{
integer::store<uint8_t>(cx, v, ptr);
}

bool_t load(const CallContext &cx, uint32_t ptr)
{
return convert_int_to_bool(integer::load<uint8_t>(cx, ptr));
}
}
}
Loading
Loading