xmake.lua 1.8 KB

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