diff options
| author | Andreas Grois <andi@grois.info> | 2022-10-10 21:30:02 +0200 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2022-10-10 21:37:15 +0200 |
| commit | e4ad766315879e1ff05bb111229f073f8f0ed68e (patch) | |
| tree | 4b043ff47c78b2c00c80c94ebda622c32c8b6d3d /rust_testhelper | |
PassFish: Initial Commit
Well, that's a lie. But nobody needs to see all the iterations I decided
to sweep under the rug.
That said, I think the repo is, while not clean, clean enough now, to
not be embarrassed by uploading it to github.
Diffstat (limited to 'rust_testhelper')
| -rw-r--r-- | rust_testhelper/Cargo.lock | 23 | ||||
| -rw-r--r-- | rust_testhelper/Cargo.toml | 10 | ||||
| -rw-r--r-- | rust_testhelper/build.rs | 9 | ||||
| -rw-r--r-- | rust_testhelper/src/lib.rs | 6 |
4 files changed, 48 insertions, 0 deletions
diff --git a/rust_testhelper/Cargo.lock b/rust_testhelper/Cargo.lock new file mode 100644 index 0000000..2e5f5d0 --- /dev/null +++ b/rust_testhelper/Cargo.lock @@ -0,0 +1,23 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "libc" +version = "0.2.133" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" + +[[package]] +name = "rust_testhelper" +version = "0.1.0" +dependencies = [ + "cc", + "libc", +] diff --git a/rust_testhelper/Cargo.toml b/rust_testhelper/Cargo.toml new file mode 100644 index 0000000..53958db --- /dev/null +++ b/rust_testhelper/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "rust_testhelper" +version = "0.1.0" +description = "Helper for compiling and linking pwm_qhash.cpp during cargo test." + +[dependencies] +libc = "0.2" + +[build-dependencies] +cc = "1.0" diff --git a/rust_testhelper/build.rs b/rust_testhelper/build.rs new file mode 100644 index 0000000..6fa9026 --- /dev/null +++ b/rust_testhelper/build.rs @@ -0,0 +1,9 @@ +fn main() { + cc::Build::new() + .cpp(true) + .file("../src/pwm_qhash.cpp") + .include("/usr/include/qt5/") + .include("/usr/include/qt5/QtCore/") + .compile("pwm_qhash"); + println!("cargo:rustc-link-lib=Qt5Core"); +} diff --git a/rust_testhelper/src/lib.rs b/rust_testhelper/src/lib.rs new file mode 100644 index 0000000..a3c5db5 --- /dev/null +++ b/rust_testhelper/src/lib.rs @@ -0,0 +1,6 @@ +extern crate libc; +use libc::size_t; + +extern "C"{ + pub fn pwm_qhash(algorithm : size_t, input : *const u8, input_length : size_t, output : *mut u8, output_capacity : size_t) -> size_t; +} |
