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

wasm2c: uvwasi support #2002

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ endif ()
option(BUILD_TESTS "Build GTest-based tests" ON)
option(USE_SYSTEM_GTEST "Use system GTest, instead of building" OFF)
option(BUILD_TOOLS "Build wabt commandline tools" ON)
option(BUILD_UVWASI "Build uvwasi for use by compiled applications" ON)
option(BUILD_FUZZ_TOOLS "Build tools that can repro fuzz bugs" OFF)
option(BUILD_LIBWASM "Build libwasm" ON)
option(USE_ASAN "Use address sanitizer" OFF)
Expand Down Expand Up @@ -353,6 +354,7 @@ set(WABT_LIBRARY_SRC
add_library(wabt STATIC ${WABT_LIBRARY_SRC})
add_library(wabt::wabt ALIAS wabt)


target_compile_features(wabt PUBLIC cxx_std_17)

if (WABT_INSTALL_RULES)
Expand Down Expand Up @@ -395,6 +397,10 @@ IF (NOT WIN32)
endif ()
endif ()

if (BUILD_UVWASI)
add_subdirectory("third_party/uvwasi" )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a WITH_WASI flag .. is there some reason we can't use use that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed to me like enabling the mostly not working wasi support in the interpreter, and allowing people to build their standalone apps with uvwasi were logically separate things. I'm not attached around the issue of wether this is enabled by default, so whatever makes sense just lmk.

endif ()

if (BUILD_FUZZ_TOOLS)
set(FUZZ_FLAGS "-fsanitize=fuzzer,address")
add_library(wabt-fuzz STATIC ${WABT_LIBRARY_SRC})
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Wabt has been compiled to JavaScript via emscripten. Some of the functionality i
| [threads][] | `--enable-threads` | | ✓ | ✓ | ✓ | ✓ | |
| [multi-value][] | `--disable-multi-value` | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| [tail-call][] | `--enable-tail-call` | | ✓ | ✓ | ✓ | ✓ | |
| [bulk memory][] | `--disable-bulk-memory` | ✓ | ✓ | ✓ | ✓ | ✓ | |
| [bulk memory][] | `--disable-bulk-memory` | ✓ | ✓ | ✓ | ✓ | ✓ | |
| [reference types][] | `--disable-reference-types` | ✓ | ✓ | ✓ | ✓ | ✓ | |
| [annotations][] | `--enable-annotations` | | | ✓ | | | |
| [memory64][] | `--enable-memory64` | | ✓ | ✓ | ✓ | ✓ | |
Expand Down
3 changes: 2 additions & 1 deletion scripts/gen-wasm2c-templates.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# https://stackoverflow.com/a/47801116
file(READ ${in} content)
set(content "const char* ${symbol} = R\"w2c_template(${content})w2c_template\";")
string(REGEX REPLACE "(.[^\n]*\n)" "R\"w2c_template(\\1)w2c_template\"\n" content "${content}")
set(content "const char* ${symbol} = ${content};")
file(WRITE ${out} "${content}")
Loading