-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
factor out C-API into separate crate and tooling around that
- Loading branch information
Showing
17 changed files
with
152 additions
and
91 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: C-API | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build-test: | ||
name: Build and test | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: "build-test" | ||
- name: Cargo build | ||
run: cargo build -p rustsat-capi --verbose | ||
env: | ||
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }} | ||
- name: Cargo test | ||
run: cargo test -p rustsat --verbose --features=all | ||
env: | ||
CMAKE_BUILD_PARALLEL_LEVEL: ${{ fromJSON('["", "4"]')[matrix.os == 'macos-latest'] }} | ||
|
||
version: | ||
name: Ensure C-API crate version is in sync | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check | ||
run: [ "$(grep '^version = ' rustsat/Cargo.toml)" = "$(grep '^version = ' capi/Cargo.toml)" ] | ||
|
||
cbindgen: | ||
name: Test generated C header | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v4 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- name: Check C header | ||
run: | | ||
cargo install cbindgen | ||
cbindgen -c capi/cbindgen.toml --crate rustsat-capi -o capi/rustsat.h --verify |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ members = [ | |
"minisat", | ||
"ipasir", | ||
"solvertests", | ||
"capi", | ||
] | ||
resolver = "2" | ||
|
||
|
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,26 @@ | ||
[package] | ||
name = "rustsat-capi" | ||
version = "0.4.3" | ||
edition = "2021" | ||
authors = ["Christoph Jabs <christoph.jabs@helsinki.fi>"] | ||
license = "MIT" | ||
description = "C-API for the RustSAT library" | ||
keywords = ["sat", "satisfiability", "encodings"] | ||
|
||
build = "build.rs" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
rustsat = { version = "0.4.3", path = "../rustsat", default-features = false, features = [ | ||
"internals", | ||
] } | ||
|
||
[build-dependencies] | ||
cbindgen = "0.26.0" | ||
|
||
[dev-dependencies] | ||
inline-c = "0.1.7" | ||
|
||
[lib] | ||
crate-type = ["staticlib"] |
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,17 @@ | ||
[![Build & Test](https://github.com/chrjabs/rustsat/actions/workflows/capi.yml/badge.svg)](https://github.com/chrjabs/rustsat/actions/workflows/capi.yml) | ||
[![License](https://img.shields.io/crates/l/rustsat)](./LICENSE) | ||
|
||
<!-- cargo-rdme start --> | ||
|
||
# C-API For RustSAT | ||
|
||
In the C-API, literals are represented as IPASIR literals. | ||
|
||
This is the C-API for RustSAT. Currently this API is very minimal and not | ||
the focus of this project. For now, only the API of certain encodings is | ||
available. | ||
|
||
For the API itself, see `rustsat.h`. To use RustSAT from an external project, | ||
build this crate and link against `librustsat.a` | ||
|
||
<!-- cargo-rdme end --> |
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
File renamed without changes.
File renamed without changes.
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
Oops, something went wrong.