Add cmake compatibility to c-api (#4369)
* Add cmake compatibility to c-api * Add CMake documentation to wasmtime.h * Add CMake instructions in examples * Modify CI for CMake support * Use correct rust in CI * Trigger build * Refactor run-examples * Reintroduce example_to_run in run-examples * Replace run-examples crate with cmake * Fix markdown formatting in examples readme * Fix cmake test quotes * Build rust wasm before cmake tests * Pass CTEST_OUTPUT_ON_FAILURE * Another cmake test * Handle os differences in cmake test * Fix bugs in memory and multimemory examples
This commit is contained in:
@@ -16,6 +16,10 @@ You can compile and run this example on Linux with:
|
||||
Note that on Windows and macOS the command will be similar, but you'll need
|
||||
to tweak the `-lpthread` and such annotations.
|
||||
|
||||
You can also build using cmake:
|
||||
|
||||
mkdir build && cd build && cmake .. && cmake --build . --target wasmtime-memory
|
||||
|
||||
Also note that this example was taken from
|
||||
https://github.com/WebAssembly/wasm-c-api/blob/master/example/memory.c
|
||||
originally
|
||||
@@ -220,7 +224,7 @@ int main(int argc, const char* argv[]) {
|
||||
|
||||
// Grow memory.
|
||||
printf("Growing memory...\n");
|
||||
uint32_t old_size;
|
||||
uint64_t old_size;
|
||||
error = wasmtime_memory_grow(context, &memory, 1, &old_size);
|
||||
if (error != NULL)
|
||||
exit_with_error("failed to grow memory", error, trap);
|
||||
|
||||
Reference in New Issue
Block a user