file dependency reload stuff
This commit is contained in:
parent
16f75fef9b
commit
15187cd760
10
garnet.cabal
10
garnet.cabal
@ -6,6 +6,13 @@ author: Patrick Aldis
|
|||||||
maintainer:
|
maintainer:
|
||||||
george.thomas@obsidian.systems
|
george.thomas@obsidian.systems
|
||||||
patrick.aldis@obsidian.systems
|
patrick.aldis@obsidian.systems
|
||||||
|
-- aha, nice, this does fix recompilation checking
|
||||||
|
extra-source-files:
|
||||||
|
rust/target/debug/garnet_rs.h
|
||||||
|
-- that could be problematic given file is gitignored? unfortunately this doesn't work
|
||||||
|
-- tbf, I haven't even looked up the docs, just saw the autocompletion
|
||||||
|
-- extra-tmp-files:
|
||||||
|
-- rust/target/debug/garnet_rs.h
|
||||||
|
|
||||||
common common
|
common common
|
||||||
default-language: GHC2024
|
default-language: GHC2024
|
||||||
@ -44,6 +51,9 @@ library
|
|||||||
GarnetRs.Wrapped
|
GarnetRs.Wrapped
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
include-dirs: rust/target/debug
|
include-dirs: rust/target/debug
|
||||||
|
-- HLS gives up entirely when the header is malformed if we do this
|
||||||
|
-- and anyway, I don't think it gives us dependency tracking like `extra-source-files` does
|
||||||
|
-- includes: garnet_rs.h
|
||||||
extra-bundled-libraries: Cgarnet_rs
|
extra-bundled-libraries: Cgarnet_rs
|
||||||
build-depends:
|
build-depends:
|
||||||
hs-bindgen,
|
hs-bindgen,
|
||||||
|
|||||||
@ -2,6 +2,23 @@ use std::env;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// this doesn't make _much_ difference really, since this is our only Rust source file
|
||||||
|
// but it seems it's probably better than not having it
|
||||||
|
// what we really want is to tell Rust to only regenerate the header file if the Rust code actually compiles
|
||||||
|
// but we don't have that flexibility
|
||||||
|
// and it's an issue because cbindgen tries to be fault-tolerant in some ways that don't even seem to make sense
|
||||||
|
//
|
||||||
|
// e.g. mis-spell "Option" as "Option" and you get
|
||||||
|
// void print_optional(Optio<const int8_t*> x);
|
||||||
|
// instead of
|
||||||
|
// void print_optional(const int8_t *x);
|
||||||
|
// and that's only an issue because in HLS TH dependent-file watching gives up after an error
|
||||||
|
// i.e. once the containing splice has thrown an exception once, the containing file needs a manual edit to kick it
|
||||||
|
// and that's really not helped by Rust Analyzer mostly only showing diagnostics on save
|
||||||
|
// P.S. strings to stdout?! what a terrible API
|
||||||
|
// don't get me started in the discoverability of actually then using the terminal for debugging:
|
||||||
|
// println!("cargo::warning={:?}", env::var("OUT_DIR"));
|
||||||
|
println!("cargo::rerun-if-changed=lib.rs");
|
||||||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||||
let profile = env::var("PROFILE").unwrap();
|
let profile = env::var("PROFILE").unwrap();
|
||||||
cbindgen::Builder::new()
|
cbindgen::Builder::new()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user