xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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+1", "d9f85d9df036336c9cb872ecd73c7744e493ed5d02e9aec8b3c1351c757c9707")
  10. add_configs("zlib", {description = "ZLib for HTTP Compression", default = true, type = "boolean"})
  11. add_configs("ssl", {description = "OpenSSL for HTTPS support", default = true, type = "boolean"})
  12. add_deps("cmake", "asio")
  13. on_load(function (package)
  14. if package:config("zlib") then
  15. package:add("deps", "zlib")
  16. end
  17. if package:config("ssl") then
  18. package:add("deps", "openssl")
  19. end
  20. end)
  21. on_install("windows", "linux", "macosx", "mingw", function (package)
  22. local configs = {"-DCROW_BUILD_EXAMPLES=OFF", "-DCROW_BUILD_TESTS=OFF"}
  23. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  24. local features = {}
  25. if package:config("zlib") then
  26. table.insert(features, "compression")
  27. end
  28. if package:config("ssl") then
  29. table.insert(features, "ssl")
  30. end
  31. if #features > 0 then
  32. table.insert(configs, '-DCROW_FEATURES="' .. table.concat(features, ";") .. '"')
  33. end
  34. import("package.tools.cmake").install(package, configs)
  35. end)
  36. on_test(function (package)
  37. assert(package:check_cxxsnippets({test = [[
  38. #include "crow.h"
  39. void test()
  40. {
  41. crow::SimpleApp app;
  42. }
  43. ]]}, {configs = {languages = "c++17"}}))
  44. end)