Skip to content

Commit 76e3c21

Browse files
committed
update build to support mshv3 feature
Signed-off-by: Simon Davies <[email protected]>
1 parent b1255e9 commit 76e3c21

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/hyperlight_host/build.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,24 @@ fn main() -> Result<()> {
8585
}
8686

8787
// Makes #[cfg(kvm)] == #[cfg(all(feature = "kvm", target_os = "linux"))]
88-
// and #[cfg(mshv)] == #[cfg(all(feature = "mshv", target_os = "linux"))].
88+
// and #[cfg(mshv)] == #[cfg(all(any(feature = "mshv2", feature = "mshv3"), target_os = "linux"))].
8989
// Essentially the kvm and mshv features are ignored on windows as long as you use #[cfg(kvm)] and not #[cfg(feature = "kvm")].
9090
// You should never use #[cfg(feature = "kvm")] or #[cfg(feature = "mshv")] in the codebase.
9191
cfg_aliases::cfg_aliases! {
9292
kvm: { all(feature = "kvm", target_os = "linux") },
93-
mshv: { all(feature = "mshv", target_os = "linux") },
93+
mshv: { all(any(feature = "mshv2", feature = "mshv3"), target_os = "linux") },
9494
// inprocess feature is aliased with debug_assertions to make it only available in debug-builds.
9595
// You should never use #[cfg(feature = "inprocess")] in the codebase. Use #[cfg(inprocess)] instead.
9696
inprocess: { all(feature = "inprocess", debug_assertions) },
9797
// crashdump feature is aliased with debug_assertions to make it only available in debug-builds.
9898
crashdump: { all(feature = "crashdump", debug_assertions) },
9999
// print_debug feature is aliased with debug_assertions to make it only available in debug-builds.
100100
print_debug: { all(feature = "print_debug", debug_assertions) },
101+
// the following features are mutually exclusive but rather than enforcing that here we are enabling mshv3 to override mshv2 when both are enabled
102+
// because mshv2 is in the default feature set we want to allow users to enable mshv3 without having to set --no-default-features and the re-enable
103+
// the other features they want.
104+
mshv2: { all(feature = "mshv2", not(feature="mshv3"), target_os = "linux") },
105+
mshv3: { all(feature = "mshv3", target_os = "linux") },
101106
}
102107

103108
write_built_file()?;

0 commit comments

Comments
 (0)