-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add wasm-smith C/C++ bindings * Add initial c-api * Add CMake support and examples * Add main function to examples * Remove references to wasmtime in doxygen.conf * Handle insufficent entropy in c-api and add CI * Fix c-api CI error * Simplify wasm_tools_byte_vec_delete * Move c-api CMakeLists into c-api crate * Suppress examples build errors * Add macos support to c-api building * Fix windows c-api build * Fix c-api type in readme
- Loading branch information
1 parent
8f6a72f
commit 77f1718
Showing
15 changed files
with
2,853 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
# Copy shared library into build directory | ||
if(WIN32) | ||
set(WASM_TOOLS_INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/wasmtools.dll | ||
${CMAKE_BINARY_DIR}) | ||
elseif(APPLE) | ||
set(WASM_TOOLS_INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/libwasmtools.dylib | ||
${CMAKE_BINARY_DIR}) | ||
else() | ||
set(WASM_TOOLS_INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||
${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/libwasmtools.so | ||
${CMAKE_BINARY_DIR}) | ||
endif() | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add( | ||
wasm-tools-crate | ||
DOWNLOAD_COMMAND "" | ||
CONFIGURE_COMMAND "" | ||
INSTALL_COMMAND "${WASM_TOOLS_INSTALL_COMMAND}" | ||
BUILD_COMMAND cargo build --release | ||
BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR} | ||
BUILD_ALWAYS ON) | ||
add_library(wasm-tools INTERFACE) | ||
add_dependencies(wasm-tools wasm-tools-crate) | ||
|
||
if(WIN32) | ||
target_link_libraries(wasm-tools INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/wasmtools.dll.lib) | ||
elseif(APPLE) | ||
target_link_libraries(wasm-tools INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/libwasmtools.dylib) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'") | ||
else() | ||
target_link_libraries(wasm-tools INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/../../target/release/libwasmtools.so) | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath='$ORIGIN'") | ||
endif() | ||
|
||
target_include_directories(wasm-tools INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "wasm-tools-c-api" | ||
authors = ["Addison Hart <tgr@tgrcode.com>"] | ||
categories = ["development-tools", "development-tools::testing", "wasm"] | ||
description = "C API to expose wasm-tools" | ||
edition = "2021" | ||
license = "Apache-2.0 WITH LLVM-exception" | ||
readme = "./README.md" | ||
repository = "https://github.com/bytecodealliance/wasm-tools/tree/main/crates/c-api" | ||
version = "0.1.1" | ||
publish = false | ||
|
||
[lib] | ||
name = "wasmtools" | ||
crate-type = ["cdylib"] | ||
doc = false | ||
test = false | ||
doctest = false | ||
|
||
[dependencies] | ||
arbitrary = { version = "1.1.0", features = ["derive"] } | ||
wasmparser-dump = { version = "0.1.4", path = "../dump" } | ||
wasm-mutate = { version = "0.2.4", path = "../wasm-mutate" } | ||
wasm-shrink = { version = "0.1.6", path = "../wasm-shrink" } | ||
wasm-smith = { version = "0.11.1", path = "../wasm-smith" } | ||
wasmparser = { version = "0.86.0", path = "../wasmparser" } | ||
wasmprinter = { version = "0.2.36", path = "../wasmprinter" } | ||
wast = { version = "42.0.0", path = "../wast" } | ||
wat = { version = "1.0.44", path = "../wat" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Wasm-tools's C API | ||
|
||
For more information you can find the documentation for this library (TODO). | ||
TODO EXCLUDE_SYMBOLS INPUT INCLUDE_PATH in doxygen needs modifying |
Oops, something went wrong.