diff --git a/Cargo.lock b/Cargo.lock index 9399c8538603..43c3d10892b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3323,6 +3323,13 @@ dependencies = [ [[package]] name = "wasmtime-c-api" version = "15.0.0" +dependencies = [ + "wasmtime-c-api-impl", +] + +[[package]] +name = "wasmtime-c-api-impl" +version = "15.0.0" dependencies = [ "anyhow", "cap-std", diff --git a/Cargo.toml b/Cargo.toml index b2b3f3b3cb7e..9b612a34f2a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ members = [ "cranelift/isle/islec", "cranelift/serde", "crates/bench-api", - "crates/c-api", + "crates/c-api/artifact", "crates/environ/fuzz", "crates/test-programs", "crates/wasi-preview1-component-adapter", diff --git a/crates/c-api/CMakeLists.txt b/crates/c-api/CMakeLists.txt index 782a9aa78b06..b5fb5e085f08 100644 --- a/crates/c-api/CMakeLists.txt +++ b/crates/c-api/CMakeLists.txt @@ -100,7 +100,7 @@ ExternalProject_Add( CONFIGURE_COMMAND "" INSTALL_COMMAND "${WASMTIME_INSTALL_COMMAND}" BUILD_COMMAND ${WASMTIME_PREBUILD_COMMAND} ${WASMTIME_CARGO_BINARY} build ${WASMTIME_BUILD_TYPE_FLAG} ${WASMTIME_USER_CARGO_BUILD_OPTIONS} ${WASMTIME_BUILD_TARGET} - BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR} + BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/artifact BUILD_ALWAYS ${WASMTIME_ALWAYS_BUILD} BUILD_BYPRODUCTS ${WASMTIME_BUILD_PRODUCT}) add_library(wasmtime INTERFACE) @@ -137,5 +137,5 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/include/wasm.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/wasmtime DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(FILES ${WASMTIME_BUILD_PRODUCT} +install(FILES ${WASMTIME_BUILD_PRODUCT} DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/crates/c-api/Cargo.toml b/crates/c-api/Cargo.toml index 1548b0634dca..82d46337bba9 100644 --- a/crates/c-api/Cargo.toml +++ b/crates/c-api/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "wasmtime-c-api" +name = "wasmtime-c-api-impl" version.workspace = true authors.workspace = true description = "C API to expose the Wasmtime runtime" @@ -10,8 +10,7 @@ edition.workspace = true publish = false [lib] -name = "wasmtime" -crate-type = ["staticlib", "cdylib", "rlib"] +name = "wamstime_c_api" doc = false test = false doctest = false @@ -38,16 +37,6 @@ wasi-common = { workspace = true, optional = true } futures = { workspace = true, optional = true } [features] -default = [ - 'profiling', - 'wat', - 'wasi', - 'cache', - 'parallel-compilation', - 'async', - 'coredump', - 'addr2line', -] async = ['wasmtime/async', 'futures'] profiling = ["wasmtime/profiling"] cache = ["wasmtime/cache"] diff --git a/crates/c-api/artifact/Cargo.toml b/crates/c-api/artifact/Cargo.toml new file mode 100644 index 000000000000..0738a9df1dc0 --- /dev/null +++ b/crates/c-api/artifact/Cargo.toml @@ -0,0 +1,42 @@ +[package] +name = "wasmtime-c-api" +version.workspace = true +authors.workspace = true +description = "C API to expose the Wasmtime runtime" +license = "Apache-2.0 WITH LLVM-exception" +repository = "https://github.com/bytecodealliance/wasmtime" +readme = "README.md" +edition.workspace = true +publish = false + +[lib] +name = "wasmtime" +crate-type = ["staticlib", "cdylib"] +doc = false +test = false +doctest = false + +[dependencies] +wasmtime-c-api = { path = '..', package = 'wasmtime-c-api-impl' } + +[features] +default = [ + 'profiling', + 'wat', + 'wasi', + 'cache', + 'parallel-compilation', + 'async', + 'coredump', + 'addr2line', +] +async = ['wasmtime-c-api/async'] +profiling = ["wasmtime-c-api/profiling"] +cache = ["wasmtime-c-api/cache"] +parallel-compilation = ['wasmtime-c-api/parallel-compilation'] +wasi = ['wasmtime-c-api/wasi'] +logging = ['wasmtime-c-api/logging'] +disable-logging = ["wasmtime-c-api/disable-logging"] +coredump = ["wasmtime-c-api/coredump"] +addr2line = ["wasmtime-c-api/addr2line"] +wat = ["wasmtime-c-api/wat"] diff --git a/crates/c-api/artifact/src/lib.rs b/crates/c-api/artifact/src/lib.rs new file mode 100644 index 000000000000..43929bb8605f --- /dev/null +++ b/crates/c-api/artifact/src/lib.rs @@ -0,0 +1 @@ +pub use wasmtime_c_api::*;