Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

capi: Fix testing stand-alone inclusion of headers (#11882)

Alex Crichton372e8323348a
diff --git a/crates/c-api/include/wasmtime/component/linker.h b/crates/c-api/include/wasmtime/component/linker.h
index 38b5875c01..5fb1582c05 100644
--- a/crates/c-api/include/wasmtime/component/linker.h
+++ b/crates/c-api/include/wasmtime/component/linker.h
@@ -8,6 +8,7 @@
#include <wasmtime/component/instance.h>
#include <wasmtime/conf.h>
#include <wasmtime/error.h>
+#include <wasmtime/module.h>
#include <wasmtime/store.h>
#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
diff --git a/crates/c-api/include/wasmtime/component/val.h b/crates/c-api/include/wasmtime/component/val.h
index 7ab848b5f9..675889d463 100644
--- a/crates/c-api/include/wasmtime/component/val.h
+++ b/crates/c-api/include/wasmtime/component/val.h
@@ -7,6 +7,9 @@
#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
+#include <stdint.h>
+#include <wasm.h>
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/crates/c-api/tests/CMakeLists.txt b/crates/c-api/tests/CMakeLists.txt
index 0624f6ccc7..a5d06cac7d 100644
--- a/crates/c-api/tests/CMakeLists.txt
+++ b/crates/c-api/tests/CMakeLists.txt
@@ -68,15 +68,14 @@ foreach(header IN LISTS cpp_headers)
if(header_extension STREQUAL ".h.in")
continue()
endif()
- cmake_path(GET header FILENAME header_filename)
- cmake_path(APPEND CMAKE_CURRENT_BINARY_DIR "header-test" "${header_filename}.cc"
- OUTPUT_VARIABLE test_filename)
- list(APPEND header_tests ${test_filename})
-
cmake_path(
RELATIVE_PATH header
BASE_DIRECTORY ${header_root}
OUTPUT_VARIABLE rel_header)
+ cmake_path(APPEND CMAKE_CURRENT_BINARY_DIR "header-test" "${rel_header}.cc"
+ OUTPUT_VARIABLE test_filename)
+ list(APPEND header_tests ${test_filename})
+
file(WRITE ${test_filename} "#include <${rel_header}>")
endforeach()
add_capi_test(standalone-headers FILES ${header_tests})