xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package("marisa")
  2. set_homepage("https://github.com/s-yata/marisa-trie")
  3. set_description("Matching Algorithm with Recursively Implemented StorAge.")
  4. add_urls("https://github.com/s-yata/marisa-trie/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/s-yata/marisa-trie.git")
  6. add_versions("v0.2.6", "1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de")
  7. add_versions("v0.3.0", "a3057d0c2da0a9a57f43eb8e07b73715bc5ff053467ee8349844d01da91b5efb")
  8. add_patches("v0.3.0", "patches/v0.3.0/support-debug-install.diff", "a3d02bf6881d233bf8cfadded33edfcde167bee719d47538b869e0e90d8bf7ce")
  9. add_patches("v0.3.0", "https://github.com/s-yata/marisa-trie/pull/119.diff", "f02211699465b55cd2ab93ef20bafcd69aa573da1fd796cb9366697075074093")
  10. add_deps("cmake")
  11. on_install(function (package)
  12. if package:version() and package:version():lt("v0.3.0") then
  13. os.cp(path.join(package:scriptdir(), "port", "CMakeLists.txt"), "CMakeLists.txt")
  14. end
  15. local configs = {
  16. "-DCMAKE_POLICY_DEFAULT_CMP0057=NEW",
  17. "-DENABLE_TESTS=OFF",
  18. "-DBUILD_TESTING=OFF",
  19. "-DENABLE_TOOLS=OFF"
  20. }
  21. if package:config("shared") and package:is_plat("windows") then
  22. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  23. end
  24. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  25. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  26. import("package.tools.cmake").install(package, configs)
  27. end)
  28. on_test(function (package)
  29. assert(package:check_cxxsnippets({test = [[
  30. #include <marisa.h>
  31. void test() {
  32. int x = 1, y = 2;
  33. marisa::swap(x, y);
  34. }
  35. ]]}, {configs = {languages = "c++17"}}), "package(marisa) require >= c++17")
  36. end)