split up crate
This commit is contained in:
parent
2ba21f9011
commit
24924ecdf2
25
Cargo.lock
generated
25
Cargo.lock
generated
@ -43,14 +43,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "libcsp-cargo-build"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libcsp-rust"
|
||||
name = "libcsp"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
@ -58,12 +51,26 @@ dependencies = [
|
||||
"num_enum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libcsp-cargo-build"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libcsp-rust-examples"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libcsp",
|
||||
"libcsp-cargo-build",
|
||||
"libcsp-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libcsp-sys"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1,5 +1,5 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"libcsp-cargo-build", "libcsp-rust", "examples"
|
||||
"libcsp-cargo-build", "libcsp", "libcsp-sys", "examples"
|
||||
]
|
||||
resolver = "2"
|
||||
|
@ -4,7 +4,7 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
libcsp-rust = { path = "../libcsp-rust" }
|
||||
libcsp = { path = "../libcsp" }
|
||||
|
||||
[build-dependencies]
|
||||
libcsp-cargo-build = { path = "../libcsp-cargo-build" }
|
||||
|
2
libcsp-rust/.gitignore
vendored
2
libcsp-rust/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
/target
|
||||
/Cargo.lock
|
@ -1,28 +0,0 @@
|
||||
use std::{env, path::PathBuf};
|
||||
|
||||
pub const ENV_KEY_CSP_CONFIG_DIR: &str = "CSP_CONFIG_DIR";
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rustc-link-lib=csp");
|
||||
|
||||
let out_path = env::var("OUT_DIR").unwrap();
|
||||
let csp_conf_dir = match env::var("CSP_CONFIG_DIR") {
|
||||
Ok(conf_path) => conf_path,
|
||||
Err(_e) => {
|
||||
println!("cargo:warning=CSP_CONFIG_DIR not set, using CARGO_MANIFEST_DIR to search for autoconfig.rs");
|
||||
env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set")
|
||||
}
|
||||
};
|
||||
let mut csp_conf_path = PathBuf::new();
|
||||
csp_conf_path.push(csp_conf_dir);
|
||||
csp_conf_path.push("autoconfig.rs");
|
||||
if !csp_conf_path.exists() {
|
||||
panic!(
|
||||
"autoconfig.rs not found at {:?}, is required for library build",
|
||||
csp_conf_path
|
||||
);
|
||||
}
|
||||
let out_path_full = PathBuf::from(&out_path).join("autoconfig.rs");
|
||||
std::fs::copy(&csp_conf_path, out_path_full).expect("failed to copy autoconfig.rs to OUT_DIR");
|
||||
println!("cargo::rerun-if-changed={:?}", &csp_conf_path);
|
||||
}
|
16
libcsp-sys/Cargo.toml
Normal file
16
libcsp-sys/Cargo.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "libcsp-sys"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||
description = "FFI bindings for libcsp"
|
||||
homepage = "https://egit.irs.uni-stuttgart.de/rust/libcsp-rust"
|
||||
repository = "https://egit.irs.uni-stuttgart.de/rust/libcsp-rust"
|
||||
license = "Apache-2.0"
|
||||
keywords = ["no-std", "space", "aerospace", "ffi", "csp"]
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
categories = ["aerospace", "external-ffi-bindings", "no-std", "hardware-support", "embedded"]
|
||||
links = "csp"
|
||||
|
||||
[dependencies]
|
||||
libc = "0.2"
|
0
libcsp-sys/build.rs
Normal file
0
libcsp-sys/build.rs
Normal file
@ -1,16 +1,15 @@
|
||||
[package]
|
||||
name = "libcsp-rust"
|
||||
name = "libcsp"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Robin Mueller <muellerr@irs.uni-stuttgart.de>"]
|
||||
description = "FFI bindings and a safe and ergonomic Rust API for libcsp"
|
||||
description = "Safe and ergonomic Rust API for libcsp on top on libcsp-sys"
|
||||
homepage = "https://egit.irs.uni-stuttgart.de/rust/libcsp-rust"
|
||||
repository = "https://egit.irs.uni-stuttgart.de/rust/libcsp-rust"
|
||||
license = "Apache-2.0"
|
||||
keywords = ["no-std", "space", "aerospace", "ffi", "csp"]
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
categories = ["aerospace", "external-ffi-bindings", "no-std", "hardware-support", "embedded"]
|
||||
links = "csp"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "2"
|
@ -14,6 +14,7 @@ use num_enum::{IntoPrimitive, TryFromPrimitive};
|
||||
|
||||
use bitflags::bitflags;
|
||||
use ffi::{csp_conn_s, csp_packet_s, csp_socket_s};
|
||||
use libcsp_sys as ffi;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
|
||||
pub enum ReservedPort {
|
Loading…
Reference in New Issue
Block a user