mirror of
https://github.com/encounter/rust-ffmpeg.git
synced 2026-07-10 21:18:39 -07:00
Spawn a new thread with a larger stack perform build script work in
This commit is contained in:
@@ -577,6 +577,21 @@ fn link_to_libraries(statik: bool) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
// The long chain of `header` method calls for `bindgen::Builder` seems to be overflowing the default stack size on Windows.
|
||||
// The main thread appears to have a hardcoded stack size which is unaffected by `RUST_MIN_STACK`. As a workaround, spawn a thread here with a stack size that works expermentally, and allow overriding it with `FFMPEG_SYS_BUILD_STACK_SIZE` just in case.
|
||||
let stack_size = std::env::var("FFMPEG_SYS_BUILD_STACK_SIZE").map(|s| s.parse()).unwrap_or(Ok(3 * 1024 * 1024));
|
||||
eprintln!("Using stack size: {:?}", stack_size);
|
||||
|
||||
std::thread::Builder::new()
|
||||
.name("ffmpg-sys-build".into())
|
||||
.stack_size(stack_size.unwrap())
|
||||
.spawn(thread_main)
|
||||
.unwrap()
|
||||
.join()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn thread_main() {
|
||||
let statik = env::var("CARGO_FEATURE_STATIC").is_ok();
|
||||
|
||||
let include_paths: Vec<PathBuf> = if env::var("CARGO_FEATURE_BUILD").is_ok() {
|
||||
|
||||
Reference in New Issue
Block a user