Skip to content

Commit 2905b2c

Browse files
committed
add a hyperlight cfg for conditional compilation
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 242376b commit 2905b2c

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ impl CargoCommandExt for std::process::Command {
8383
fn populate_from_args(&mut self, args: &Args) -> &mut Self {
8484
self.target(&args.target);
8585
self.sysroot(args.sysroot_dir());
86+
self.append_rustflags("--cfg=hyperlight");
87+
self.append_rustflags("--check-cfg=cfg(hyperlight)");
8688
self.entrypoint("entrypoint");
8789
if let Some(clang) = &args.clang {
8890
self.cc_env(&args.target, clang);

src/toolchain.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ pub fn prepare(args: &Args) -> Result<()> {
2929
.arg("metadata")
3030
.manifest_path(&args.manifest_path)
3131
.arg("--format-version=1")
32+
.append_rustflags("--cfg=hyperlight")
33+
.append_rustflags("--check-cfg=cfg(hyperlight)")
3234
.checked_output()
3335
.context("Failed to get cargo metadata")?;
3436

0 commit comments

Comments
 (0)