Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ $ LIBRARY_PATH="[gcc-path value]" LD_LIBRARY_PATH="[gcc-path value]" rustc +$(ca
* _**CG_GCCJIT_DUMP_EVERYTHING**_: Enables dumping of all intermediate representations and passes.
* _**CG_GCCJIT_KEEP_INTERMEDIATES**_: Keeps intermediate files generated during the compilation process.
* _**CG_GCCJIT_VERBOSE**_: Enables verbose output from the GCC driver.
* _**CG_GCCJIT_SEARCH_PATH**_: Add a custom library path to look for `libgccjit.so` in

## Extra documentation

Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ mod type_of;
use std::any::Any;
use std::ffi::CString;
use std::fmt::Debug;
use std::fs;
use std::ops::Deref;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::{env, fs};

#[cfg(feature = "master")]
use gccjit::TargetInfo;
Expand Down Expand Up @@ -210,6 +210,10 @@ impl CodegenBackend for GccCodegenBackend {
lib_path.join(sess.target.llvm_target.as_ref()).join("libgccjit.so");
paths.push(llvm_target_path);
}
if let Ok(custom_path) = env::var("CG_GCCJIT_SEARCH_PATH").as_deref() {
paths.push(PathBuf::from(custom_path).join("libgccjit.so"));
}

paths
}

Expand Down
Loading