Skip to content

Generate a C API for IGVM #3

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

Merged
merged 12 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ jobs:
- name: Run doc tests
run: cargo test --no-fail-fast --doc --workspace

c_api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install cbindgen
run: cargo install cbindgen
- name: Install build dependencies
run: sudo apt-get install -y libcunit1-dev
- name: Build and test
run: make -f igvm_c/Makefile

miri:
name: "Miri"
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# will have compiled files and executables
debug/
target/
target_c/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Expand All @@ -12,3 +13,6 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Header files generated for the C API by igvm_c/Makefile
igvm_c/include/*.h
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
resolver = "2"
members = [
"igvm",
"igvm_c/test_data",
]

[workspace.dependencies]
igvm_defs = { path = "igvm_defs", version = "0.1.3" }
igvm = { path = "igvm", version = "0.1.3" }

anyhow = "1.0"
bitfield-struct = "0.5"
Expand Down
17 changes: 17 additions & 0 deletions igvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ repository = "https://github.com/microsoft/igvm"
keywords = ["virtualization"]
categories = ["virtualization", "parser-implementations"]

[package.metadata.docs.rs]
# Document all features
all-features = true
# Defines the configuration attribute `docsrs` which emits nicer docs via
# nightly features.
#
# Run locally with RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features
rustdoc-args = ["--cfg", "docsrs"]

[lib]
name = "igvm"
crate-type = ["staticlib", "rlib"]

[dependencies]
igvm_defs = { workspace = true, features = ["unstable"] }

Expand All @@ -23,3 +36,7 @@ open-enum.workspace = true
thiserror.workspace = true
tracing.workspace = true
zerocopy = { workspace = true, features = ["alloc"] }

[features]
default = []
igvm-c = [] # Add exports that allow the library to be used from C
Loading