xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728293031
  1. package("litehtml")
  2. set_homepage("http://www.litehtml.com/")
  3. set_description("Fast and lightweight HTML/CSS rendering engine")
  4. add_urls("https://github.com/litehtml/litehtml.git")
  5. add_versions("2023.01.05", "1e803393bdc8e586e8eefd4c33973e04994bb288")
  6. add_deps("cmake", "gumbo-parser")
  7. on_install(function (package)
  8. local configs = {"-DBUILD_TESTING=OFF", "-DEXTERNAL_GUMBO=ON"}
  9. if package:is_plat("windows") and package:config("shared") then
  10. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  11. end
  12. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  13. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  14. import("package.tools.cmake").install(package, configs, {packagedeps = "gumbo-parser"})
  15. os.cp("include/litehtml.h", package:installdir("include"))
  16. end)
  17. on_test(function (package)
  18. assert(package:check_cxxsnippets({test = [[
  19. #include <string>
  20. #include <litehtml.h>
  21. using namespace litehtml;
  22. void test() {
  23. css_element_selector selector;
  24. selector.parse(".class");
  25. }
  26. ]]}, {configs = {languages = "c++11"}}))
  27. end)