xmake.lua 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("crow")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/CrowCpp/Crow")
  4. set_description("A Fast and Easy to use microframework for the web.")
  5. set_license("BSD 3-Clause")
  6. add_urls("https://github.com/CrowCpp/Crow/archive/refs/tags/$(version).zip", {version = function (version)
  7. return (version:gsub("%+", "."))
  8. end})
  9. add_versions("v1.2.1+2", "eb52839043358830e09976198df5c1e8855a75730ccd3f1d8799eff0a79609b1")
  10. add_versions("v1.2.1+1", "d9f85d9df036336c9cb872ecd73c7744e493ed5d02e9aec8b3c1351c757c9707")
  11. add_configs("zlib", {description = "ZLib for HTTP Compression", default = true, type = "boolean"})
  12. add_configs("ssl", {description = "OpenSSL for HTTPS support", default = true, type = "boolean"})
  13. add_deps("cmake", "asio")
  14. on_load(function (package)
  15. if package:config("zlib") then
  16. package:add("deps", "zlib")
  17. end
  18. if package:config("ssl") then
  19. package:add("deps", "openssl")
  20. end
  21. end)
  22. on_install("!wasm", function (package)
  23. local configs = {"-DCROW_BUILD_EXAMPLES=OFF", "-DCROW_BUILD_TESTS=OFF"}
  24. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  25. table.insert(configs, "-DCROW_ENABLE_COMPRESSION=" .. (package:config("zlib") and "ON" or "OFF"))
  26. table.insert(configs, "-DCROW_ENABLE_SSL=" .. (package:config("ssl") and "ON" or "OFF"))
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include "crow.h"
  32. void test()
  33. {
  34. crow::SimpleApp app;
  35. }
  36. ]]}, {configs = {languages = "c++17"}}))
  37. end)