Skip to content
Merged
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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ license = "MIT"

[dependencies]
ffms2-sys = { path = "./ffms2-sys" }
cfg-if = "1.0"
paste = "1.0"
ffmpeg-the-third = "4.0"
cfg-if = "1.0.4"
paste = "1.0.15"
ffmpeg-the-third = "4.0.1"

[dev-dependencies]
structopt = "0.3"
structopt = "0.3.26"

[workspace]
members = ["ffms2-sys"]
7 changes: 5 additions & 2 deletions ffms2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ repository = "https://github.com/rust-av/ffms2-rs"
edition = "2021"
license = "MIT"

[features]
static = []

[build-dependencies]
bindgen = "0.66"
metadeps = "1.1"
bindgen = "0.72.1"
metadeps = "1.1.2"

[package.metadata.pkg-config]
ffms2 = "2.40"
13 changes: 10 additions & 3 deletions ffms2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ fn format_write(builder: bindgen::Builder) -> String {
}

fn main() {
let use_static = env::var("CARGO_FEATURE_STATIC").is_ok();

// Consider 'FFMS_INCLUDE_DIR' and 'FFMS_LIB_DIR', if pkg-config should not be used.
let headers = env::var("FFMS_INCLUDE_DIR").map(|value| {
// Ensure the include directory is valid
Expand All @@ -35,9 +37,10 @@ fn main() {

// Using dynamic library in Windows remains a problem. We have to copy the DLL into a path...
// Problem: If 'FFMS_LIB_DIR' is outside of 'target', it is not considered (https://doc.rust-lang.org/cargo/reference/environment-variables.html).
#[cfg(windows)] {
// Only handle DLL copying for dynamic linking on Windows
#[cfg(windows)]
if !use_static {
let cargo_output_dir = env::var("OUT_DIR").expect("Unable to get OUT_DIR");
// We need to add the file in target/{debug|release as it is included in the PATH: https://doc.rust-lang.org/cargo/reference/environment-variables.html#dynamic-library-paths
let linkable_dll: PathBuf = [cargo_output_dir.as_ref(), "..", "..", "..", "ffms2.dll"].iter().collect();

// Copy the file if it does not exists
Expand All @@ -52,7 +55,11 @@ fn main() {
}

// Add the flags for cargo otherwise explicitely added by pkg-config-rs
println!("cargo:rustc-link-lib=dylib=ffms2");
if use_static {
println!("cargo:rustc-link-lib=static=ffms2");
} else {
println!("cargo:rustc-link-lib=dylib=ffms2");
}
println!("cargo:rustc-link-search=native={}", lib_dir.to_string_lossy());

vec![include_dir]
Expand Down
Loading