mirror of
https://github.com/logos-storage/constantine.git
synced 2026-01-02 13:13:07 +00:00
* first jab at Rust bindings * stash C library and header generation * Create a single big library with multiple headers * remove ctt_pure, people will not call crypto proc twice with unchanged parameter and extra noise when reading header * fix MacOS and Windows builds * fix cross-lang ThinLTO, require LLD * Remove NimMain need, cleanup CPU features and detect them on library load
36 lines
1.3 KiB
Rust
36 lines
1.3 KiB
Rust
use std::env;
|
|
use std::path::PathBuf;
|
|
use std::process::{Command, Stdio};
|
|
|
|
fn main() {
|
|
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
let cargo_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
let root_dir = cargo_dir
|
|
.parent()
|
|
.expect("constantine-sys is nested")
|
|
.parent()
|
|
.expect("constantine-rust is nested");
|
|
|
|
// Avoid full recompilation
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
println!("cargo:rerun-if-changed=Cargo.toml");
|
|
println!("cargo:rerun-if-changed={}", cargo_dir.join(".cargo").join("config.toml").display());
|
|
println!("cargo:rerun-if-changed={}", root_dir.join("Cargo.toml").display());
|
|
println!("cargo:rerun-if-changed={}", root_dir.join("constantine").display());
|
|
println!("cargo:rerun-if-changed={}", root_dir.join("bindings").display());
|
|
println!("cargo:rerun-if-changed={}", root_dir.join("constantine.nimble").display());
|
|
|
|
println!("Building Constantine library ...");
|
|
|
|
Command::new("nimble")
|
|
.arg("make_lib_rust")
|
|
.current_dir(root_dir)
|
|
.stdout(Stdio::inherit())
|
|
.stderr(Stdio::inherit())
|
|
.status()
|
|
.expect("failed to execute process");
|
|
|
|
println!("cargo:rustc-link-search=native={}", out_dir.display());
|
|
println!("cargo:rustc-link-lib=static=constantine");
|
|
|
|
} |