build.rs 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. //! Build script
  2. #![allow(clippy::unwrap_used)]
  3. fn main() {
  4. // Check that at least one database feature is enabled
  5. let has_database = cfg!(feature = "sqlite") || cfg!(feature = "postgres");
  6. if !has_database {
  7. panic!(
  8. "cdk-mintd requires at least one database backend to be enabled.\n\
  9. Available database features: sqlite, postgres\n\
  10. Example: cargo build --features sqlite"
  11. );
  12. }
  13. // Check that at least one Lightning backend is enabled
  14. let has_lightning_backend = cfg!(feature = "cln")
  15. || cfg!(feature = "lnd")
  16. || cfg!(feature = "lnbits")
  17. || cfg!(feature = "fakewallet")
  18. || cfg!(feature = "grpc-processor")
  19. || cfg!(feature = "ldk-node");
  20. if !has_lightning_backend {
  21. panic!(
  22. "cdk-mintd requires at least one Lightning backend to be enabled.\n\
  23. Available Lightning backends: cln, lnd, lnbits, fakewallet, grpc-processor\n\
  24. Example: cargo build --features \"sqlite fakewallet\""
  25. );
  26. }
  27. println!("cargo:rerun-if-changed=build.rs");
  28. }