xmake.lua 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("hyperscan")
  2. set_homepage("https://www.hyperscan.io")
  3. set_description("High-performance regular expression matching library")
  4. set_license("BSD-3")
  5. add_urls("https://github.com/intel/hyperscan/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/intel/hyperscan.git")
  7. add_versions("v5.4.2", "32b0f24b3113bbc46b6bfaa05cf7cf45840b6b59333d078cc1f624e4c40b2b99")
  8. add_deps("cmake", "ragel", "python 3.x", {kind = "binary"})
  9. add_deps("boost", {configs = {thread = true, graph = true}})
  10. on_check(function (package)
  11. if not package:is_arch("x64", "x86", "x86_64", "i386") then
  12. raise("package(hyperscan) only support x86 arch")
  13. end
  14. end)
  15. -- mingw require this patch: https://github.com/intel/hyperscan/pull/36
  16. on_install("!mingw", function (package)
  17. io.replace("CMakeLists.txt", "add_subdirectory(tools)", "", {plain = true})
  18. if not package:config("pic") then
  19. io.replace("CMakeLists.txt", "POSITION_INDEPENDENT_CODE TRUE", "POSITION_INDEPENDENT_CODE FALSE", {plain = true})
  20. end
  21. local configs = {"-DBUILD_EXAMPLES=OFF"}
  22. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  23. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  24. import("package.tools.cmake").install(package, configs)
  25. end)
  26. on_test(function (package)
  27. assert(package:has_cxxfuncs("hs_compile", {includes = "hs/hs.h"}))
  28. end)