pub fn compile_package(
pkg_src_dir: &Path,
pkg_name: &str,
output_dir: &Path,
include_dir: &Path,
) -> Result<PathBuf, String>Expand description
Compile C/C++ source files in a package’s src/ directory into a shared library.
Uses the cc crate for compiler detection (respects CC, CXX, CFLAGS, CXXFLAGS
env vars, handles cross-compilation). The cc crate compiles sources to .o
files; we then link them into a .so/.dylib ourselves.
§Arguments
pkg_src_dir— the package’ssrc/directorypkg_name— package name (used for the output library name)output_dir— directory to write the compiled shared libraryinclude_dir— path to miniR’sinclude/directory (for Rinternals.h)
§Returns
Path to the compiled shared library.