xmake.lua 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package("seqan3")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://www.seqan.de")
  4. set_description("The modern C++ library for sequence analysis. Contains version 3 of the library and API docs.")
  5. set_license("BSD-3-Clause")
  6. add_urls("https://github.com/seqan/seqan3/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/seqan/seqan3.git")
  8. add_versions("3.4.0", "8e000e6788f1e2ada071b36f64231d56f18e2d687ab4122d86cd3aefc6c87743")
  9. add_versions("3.3.0", "96975406445c8a5974803eefa146ee2f85206f6d2c2bccf45171ee0b1a653fb8")
  10. add_versions("3.2.0", "80d41dd035407cfec83eb3a4466d0421adc27129af684290c0c4da31421e7276")
  11. add_configs("cereal", {description = "required for serialisation and CTD support", default = false, type = "boolean"})
  12. add_configs("zlib", {description = "required for *.gz and .bam file support", default = false, type = "boolean"})
  13. add_configs("bzip2", {description = "required for *.bz2 file support", default = false, type = "boolean"})
  14. if is_plat("windows") then
  15. add_cxxflags("/Zc:__cplusplus")
  16. elseif is_plat("linux") then
  17. add_syslinks("pthread")
  18. end
  19. add_deps("sdsl-lite")
  20. on_load(function (package)
  21. if package:config("cereal") then
  22. package:add("deps", "cereal >=1.3.1")
  23. end
  24. if package:config("zlib") then
  25. package:add("deps", "zlib >=1.2")
  26. package:add("defines", "SEQAN3_HAS_ZLIB=1")
  27. end
  28. if package:config("bzip2") then
  29. package:add("deps", "bzip2 >=1.0")
  30. package:add("defines", "SEQAN3_HAS_BZIP2=1")
  31. end
  32. end)
  33. if on_check then
  34. on_check(function (package)
  35. import("core.base.semver")
  36. import("lib.detect.find_tool")
  37. if package:is_plat("android") then
  38. local ndk = package:toolchain("ndk"):config("ndkver")
  39. assert(ndk and tonumber(ndk) >= 27, "package(seqan3) require ndk version >= 27")
  40. end
  41. local check_map = {
  42. ["3.2.0"] = { gcc = ">=10.0", clang = "unsupported" },
  43. ["3.3.0"] = { gcc = ">=11.0", clang = "unsupported" },
  44. ["3.4.0"] = { gcc = ">=12.0", clang = ">=17.0" },
  45. }
  46. local info
  47. if package:has_tool("cc", "gcc", "gxx") then
  48. info = find_tool("gcc", {version = true})
  49. elseif package:has_tool("cc", "clang", "clangxx") then
  50. info = find_tool("clang", {version = true})
  51. end
  52. local check = check_map[package:version():rawstr()]
  53. if info == nil or check == nil or check[info.name] == nil then
  54. return
  55. end
  56. assert(semver.satisfies(info.version, check[info.name]), "package(seqan3): unsupported compiler")
  57. end)
  58. end
  59. on_install("linux", "macosx", "bsd", "android", "iphoneos", "cross", function (package)
  60. os.cp("include", package:installdir())
  61. end)
  62. on_test(function (package)
  63. assert(package:check_cxxsnippets({test = [[
  64. #include <seqan3/core/debug_stream.hpp>
  65. void test() {
  66. seqan3::debug_stream << "Hello World!\n";
  67. }
  68. ]]}, {configs = {languages = package:version():ge("3.4.0") and "c++23" or "c++20"}}))
  69. end)