xmake.lua 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package("liboqs")
  2. set_homepage("https://openquantumsafe.org")
  3. set_description("C library for prototyping and experimenting with quantum-resistant cryptography")
  4. set_license("MIT")
  5. add_urls("https://github.com/open-quantum-safe/liboqs/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/open-quantum-safe/liboqs.git")
  7. add_versions("0.14.0", "5b0df6138763b3fc4e385d58dbb2ee7c7c508a64a413d76a917529e3a9a207ea")
  8. add_versions("0.13.0", "789e9b56bcb6b582467ccaf5cdb5ab85236b0c1007d30c606798fa8905152887")
  9. add_versions("0.12.0", "df999915204eb1eba311d89e83d1edd3a514d5a07374745d6a9e5b2dd0d59c08")
  10. add_versions("0.11.0", "f77b3eff7dcd77c84a7cd4663ef9636c5c870f30fd0a5b432ad72f7b9516b199")
  11. add_versions("0.10.1", "00ca8aba65cd8c8eac00ddf978f4cac9dd23bb039f357448b60b7e3eed8f02da")
  12. if is_plat("windows", "mingw") then
  13. add_syslinks("advapi32")
  14. end
  15. add_deps("cmake")
  16. if on_check then
  17. on_check("windows", function (package)
  18. local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
  19. if vs_toolset then
  20. local vs_toolset_ver = import("core.base.semver").new(vs_toolset)
  21. local minor = vs_toolset_ver:minor()
  22. assert(minor and minor >= 30, "package(liboqs) require vs_toolset >= 14.3")
  23. end
  24. end)
  25. end
  26. on_install("!windows or windows|!arm64", function (package)
  27. io.replace(".CMake/compiler_opts.cmake", "add_compile_options(/MT)", "", {plain = true})
  28. local configs = {"-DOQS_BUILD_ONLY_LIB=ON", "-DOQS_USE_OPENSSL=OFF"}
  29. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  30. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  31. if package:is_plat("cross", "iphoneos") or (package:is_plat("mingw") and package:is_arch("i386")) then
  32. table.insert(configs, "-DOQS_PERMIT_UNSUPPORTED_ARCHITECTURE=ON")
  33. end
  34. if package:is_plat("windows") then
  35. table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=.")
  36. end
  37. import("package.tools.cmake").install(package, configs)
  38. if package:is_plat("windows") and package:is_debug() then
  39. local dir = package:config("shared") and "bin" or "lib"
  40. os.vcp(path.join(package:buildir(), dir, "*.pdb"), package:installdir(dir))
  41. end
  42. end)
  43. on_test(function (package)
  44. assert(package:has_cfuncs("OQS_SIG_keypair", {includes = "oqs/oqs.h"}))
  45. end)