MCPcopy Create free account
hub / github.com/CCExtractor/rusty_ffmpeg / linking_with_pkg_config

Function linking_with_pkg_config

build.rs:301–327  ·  view source on GitHub ↗

Returns error when some library are missing. Otherwise, returns the paths of the libraries. Note: no side effect if this function errors.

(
        library_names: &[&str],
    )

Source from the content-addressed store, hash-verified

299 ///
300 /// Note: no side effect if this function errors.
301 pub fn linking_with_pkg_config(
302 library_names: &[&str],
303 ) -> Result<Vec<PathBuf>, pkg_config::Error> {
304 // dry run for library linking
305 for libname in library_names {
306 pkg_config::Config::new()
307 .cargo_metadata(false)
308 .env_metadata(false)
309 .print_system_libs(false)
310 .print_system_cflags(false)
311 .probe(&format!("lib{}", libname))?;
312 }
313
314 // real linking
315 let mut paths = HashSet::new();
316 for libname in library_names {
317 let new_paths = pkg_config::Config::new()
318 .probe(&format!("lib{}", libname))
319 .unwrap_or_else(|_| panic!("{} not found!", libname))
320 .include_paths;
321 for new_path in new_paths {
322 let new_path = new_path.to_str().unwrap().to_string();
323 paths.insert(new_path);
324 }
325 }
326 Ok(paths.into_iter().map(PathBuf::from).collect())
327 }
328}
329
330#[cfg(feature = "link_vcpkg_ffmpeg")]

Calls

no outgoing calls

Tested by

no test coverage detected