Feature : mise en place de Clego avec un exemple d'implémentation crossplateforme de la librairie SESAM-Vitale SSV #23

Merged
florian_briand merged 3 commits from feature-setup-clego into main 2024-07-29 19:43:50 +02:00
2 changed files with 12 additions and 6 deletions
Showing only changes of commit 9fc3fef350 - Show all commits

View File

@ -5,13 +5,17 @@ use std::path::PathBuf;
fn main() {
// Load the .env.build file for build-time environment variables
dotenv::from_filename(".env.build").ok();
println!("cargo::rerun-if-changed=.env.build");
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let manifest_path = PathBuf::from(manifest_dir);
dotenv::from_path(manifest_path.join(".env.build")).ok();
println!("cargo::rerun-if-env-changed=SESAM_FSV_LIB_PATH");
println!("cargo::rerun-if-env-changed=SESAM_FSV_SSVLIB");
println!("cargo::rerun-if-changed=.env.build");
println!("cargo::rerun-if-changed=build.rs");
// Add local lib directory to the linker search path (for def files and static libs)
let static_lib_path = PathBuf::from(manifest_dir).join("lib");
let static_lib_path = manifest_path.join("lib");
println!("cargo::rustc-link-search=native={}", static_lib_path.display());
// Add the SESAM_FSV_LIB_PATH to the linker search path

View File

@ -3,9 +3,9 @@ extern crate dotenv;
use libc::{ c_char, c_void, c_ushort, size_t };
use std::ffi::CString;
use std::path::PathBuf;
use std::ptr;
use dotenv::dotenv;
use std::env;
extern "C" {
@ -72,7 +72,9 @@ fn ssv_lire_config() {
}
pub fn demo() {
dotenv().ok();
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let manifest_path = PathBuf::from(manifest_dir);
dotenv::from_path(manifest_path.join(".env")).ok();
println!("------- Demo for the SSV library --------");