protols/build.rs
Michal Trybus 358cc296a5
feat: compile-time fallback include path (#98)
This is a result of a small investigation into how to make protols work
out of the box with the well-known protobuf types, even though it does
not ship them. See https://github.com/NixOS/nixpkgs/pull/465302.

The idea is to be able to configure, in compile time, a lowest-priority
include path that a distro package could set to make sure, without
compromising other sources of include paths, that protols can find the
well-known types even when `pkg-config` and `protobuf` are missing from
the environment and no paths have been manually configured via CLI or
settings.

Please advise on the best name for the environment variable.
2025-12-03 12:53:54 +05:30

11 lines
285 B
Rust

use std::path::Path;
fn main() {
if let Some(path) = option_env!("FALLBACK_INCLUDE_PATH") {
let path = Path::new(path);
assert!(
path.is_absolute(),
"Environment variable FALLBACK_INCLUDE_PATH must be absolute: {path:?}"
);
}
}