build.rs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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/VectorOfCiphertexts.cc")
  15. .include("/usr/local/include/openfhe")
  16. .include("/usr/local/include/openfhe/third-party/include")
  17. .include("/usr/local/include/openfhe/core")
  18. .include("/usr/local/include/openfhe/pke")
  19. .include("/usr/local/include/openfhe/binfhe")
  20. .flag_if_supported("-std=c++17")
  21. .flag_if_supported("-Wall")
  22. .flag_if_supported("-Werror")
  23. .flag_if_supported("-O3")
  24. .flag_if_supported("-fopenmp") // [-Wunknown-pragmas]
  25. .flag_if_supported("-Wno-parentheses") // [-Wparentheses]
  26. .flag_if_supported("-Wno-unused-parameter") // [-Wunused-parameter]
  27. .flag_if_supported("-Wno-missing-field-initializers") // [-Wmissing-field-initializers]
  28. .flag_if_supported("-Wno-unused-function") // [-Wunused-function]
  29. .compile("openfhe");
  30. println!("cargo::rerun-if-changed=src/lib.rs");
  31. println!("cargo::rerun-if-changed=src/Ciphertext.h");
  32. println!("cargo::rerun-if-changed=src/Ciphertext.cc");
  33. println!("cargo::rerun-if-changed=src/CryptoContext.h");
  34. println!("cargo::rerun-if-changed=src/CryptoContext.cc");
  35. println!("cargo::rerun-if-changed=src/KeyPair.h");
  36. println!("cargo::rerun-if-changed=src/KeyPair.cc");
  37. println!("cargo::rerun-if-changed=src/Params.h");
  38. println!("cargo::rerun-if-changed=src/Params.cc");
  39. println!("cargo::rerun-if-changed=src/Plaintext.h");
  40. println!("cargo::rerun-if-changed=src/Plaintext.cc");
  41. println!("cargo::rerun-if-changed=src/PrivateKey.h");
  42. println!("cargo::rerun-if-changed=src/PrivateKey.cc");
  43. println!("cargo::rerun-if-changed=src/PublicKey.h");
  44. println!("cargo::rerun-if-changed=src/PublicKey.cc");
  45. println!("cargo::rerun-if-changed=src/SerialDeserial.h");
  46. println!("cargo::rerun-if-changed=src/SerialDeserial.cc");
  47. println!("cargo::rerun-if-changed=src/EvalKey.h");
  48. println!("cargo::rerun-if-changed=src/EvalKey.cc");
  49. println!("cargo::rerun-if-changed=src/LWEPrivateKey.h");
  50. println!("cargo::rerun-if-changed=src/LWEPrivateKey.cc");
  51. println!("cargo::rerun-if-changed=src/VectorOfCiphertexts.h");
  52. println!("cargo::rerun-if-changed=src/VectorOfCiphertexts.cc");
  53. // linking openFHE
  54. println!("cargo::rustc-link-arg=-L/usr/local/lib");
  55. println!("cargo::rustc-link-arg=-lOPENFHEpke");
  56. println!("cargo::rustc-link-arg=-lOPENFHEbinfhe");
  57. println!("cargo::rustc-link-arg=-lOPENFHEcore");
  58. // linking OpenMP
  59. println!("cargo::rustc-link-arg=-fopenmp");
  60. // necessary to avoid LD_LIBRARY_PATH
  61. println!("cargo::rustc-link-arg=-Wl,-rpath=/usr/local/lib");
  62. }