xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package("oniguruma")
  2. set_homepage("https://github.com/kkos/oniguruma")
  3. set_description("regular expression library")
  4. set_license("BSD")
  5. add_urls("https://github.com/kkos/oniguruma/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/kkos/oniguruma.git")
  7. add_versions("v6.9.9", "001aa1202e78448f4c0bf1a48c76e556876b36f16d92ce3207eccfd61d99f2a0")
  8. add_configs("posix", {description = "Include POSIX API", default = false, type = "boolean"})
  9. add_configs("compatible_posix", {description = "Include Binary compatible POSIX API", default = false, type = "boolean"})
  10. add_configs("statistics", {description = "Include statistics API", default = false, type = "boolean"})
  11. add_deps("cmake")
  12. on_install(function (package)
  13. local configs = {"-DINSTALL_DOCUMENTATION=OFF", "-DBUILD_TEST=OFF"}
  14. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  15. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  16. if package:is_plat("windows") then
  17. table.insert(configs, "-DMSVC_STATIC_RUNTIME=" .. (package:config("vs_runtime"):startswith("MT") and "ON" or "OFF"))
  18. if not package:config("shared") then
  19. package:add("defines", "ONIG_STATIC")
  20. end
  21. end
  22. table.insert(configs, "-DENABLE_POSIX_API=" .. (package:config("posix") and "ON" or "OFF"))
  23. table.insert(configs, "-DENABLE_BINARY_COMPATIBLE_POSIX_API=" .. (package:config("compatible_posix") and "ON" or "OFF"))
  24. table.insert(configs, "-DENABLE_STATISTICS=" .. (package:config("statistics") and "ON" or "OFF"))
  25. import("package.tools.cmake").install(package, configs)
  26. end)
  27. on_test(function (package)
  28. assert(package:has_cfuncs("onig_new", {includes = "oniguruma.h"}))
  29. end)