build.rs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. fn main()
  2. {
  3. cxx_build::bridge("src/lib.rs")
  4. .file("src/Ciphertext.cc")
  5. .file("src/CryptoContext.cc")
  6. .file("src/KeyPair.cc")
  7. .file("src/Params.cc")
  8. .file("src/Plaintext.cc")
  9. .file("src/PrivateKey.cc")
  10. .file("src/PublicKey.cc")
  11. .file("src/SerialDeserial.cc")
  12. .file("src/EvalKey.cc")
  13. .file("src/LWEPrivateKey.cc")
  14. .file("src/SequenceContainerOfOpaqueTypes.cc")
  15. .file("src/AssociativeContainerOfOpaqueTypes.cc")
  16. .include("/usr/local/include/openfhe")
  17. .include("/usr/local/include/openfhe/third-party/include")
  18. .include("/usr/local/include/openfhe/core")
  19. .include("/usr/local/include/openfhe/pke")
  20. .include("/usr/local/include/openfhe/binfhe")
  21. .flag_if_supported("-std=c++17")
  22. .flag_if_supported("-Wall")
  23. .flag_if_supported("-Werror")
  24. .flag_if_supported("-O3")
  25. .flag_if_supported("-fopenmp") // [-Wunknown-pragmas]
  26. .flag_if_supported("-Wno-parentheses") // [-Wparentheses]
  27. .flag_if_supported("-Wno-unused-parameter") // [-Wunused-parameter]
  28. .flag_if_supported("-Wno-missing-field-initializers") // [-Wmissing-field-initializers]
  29. .flag_if_supported("-Wno-unused-function") // [-Wunused-function]
  30. .compile("openfhe");
  31. println!("cargo::rerun-if-changed=src/lib.rs");
  32. println!("cargo::rerun-if-changed=src/Ciphertext.h");
  33. println!("cargo::rerun-if-changed=src/Ciphertext.cc");
  34. println!("cargo::rerun-if-changed=src/CryptoContext.h");
  35. println!("cargo::rerun-if-changed=src/CryptoContext.cc");
  36. println!("cargo::rerun-if-changed=src/KeyPair.h");
  37. println!("cargo::rerun-if-changed=src/KeyPair.cc");
  38. println!("cargo::rerun-if-changed=src/Params.h");
  39. println!("cargo::rerun-if-changed=src/Params.cc");
  40. println!("cargo::rerun-if-changed=src/Plaintext.h");
  41. println!("cargo::rerun-if-changed=src/Plaintext.cc");
  42. println!("cargo::rerun-if-changed=src/PrivateKey.h");
  43. println!("cargo::rerun-if-changed=src/PrivateKey.cc");
  44. println!("cargo::rerun-if-changed=src/PublicKey.h");
  45. println!("cargo::rerun-if-changed=src/PublicKey.cc");
  46. println!("cargo::rerun-if-changed=src/SerialDeserial.h");
  47. println!("cargo::rerun-if-changed=src/SerialDeserial.cc");
  48. println!("cargo::rerun-if-changed=src/EvalKey.h");
  49. println!("cargo::rerun-if-changed=src/EvalKey.cc");
  50. println!("cargo::rerun-if-changed=src/LWEPrivateKey.h");
  51. println!("cargo::rerun-if-changed=src/LWEPrivateKey.cc");
  52. println!("cargo::rerun-if-changed=src/SequenceContainerOfOpaqueTypes.h");
  53. println!("cargo::rerun-if-changed=src/SequenceContainerOfOpaqueTypes.cc");
  54. println!("cargo::rerun-if-changed=src/AssociativeContainerOfOpaqueTypes.h");
  55. println!("cargo::rerun-if-changed=src/AssociativeContainerOfOpaqueTypes.cc");
  56. // linking openFHE
  57. println!("cargo::rustc-link-arg=-L/usr/local/lib");
  58. println!("cargo::rustc-link-arg=-lOPENFHEpke");
  59. println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
  60. println!("cargo::rustc-link-arg=-lOPENFHEcore");
  61. // linking OpenMP
  62. println!("cargo::rustc-link-arg=-fopenmp");
  63. // necessary to avoid LD_LIBRARY_PATH
  64. println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
  65. }