xmake.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("workflow")
  2. set_homepage("https://github.com/sogou/workflow")
  3. set_description("C++ Parallel Computing and Asynchronous Networking Engine")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/sogou/workflow/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/sogou/workflow.git")
  7. add_versions("v0.9.11", "71b5531728d6b4f3666176dbc45d680350518af8")
  8. add_versions("v0.10.1", "315eb1b1b5411e807e5ecc45ba5aa7db1d4f7c28")
  9. add_versions("v0.10.2", "42d87f4f9eaa80e882ccdd71cd81d20899050266")
  10. add_deps("cmake", "openssl")
  11. if is_plat("linux") then
  12. add_syslinks("pthread", "dl")
  13. end
  14. on_install("linux", "macosx", "android", function (package)
  15. local configs = {}
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  17. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  18. if package:is_plat("android") then
  19. io.replace("src/CMakeLists.txt", "add_subdirectory(client)", "add_subdirectory(client)\nlink_libraries(ssl crypto)", {plain = true})
  20. end
  21. import("package.tools.cmake").install(package, configs, {packagedeps = "openssl"})
  22. if package:config("shared") then
  23. os.tryrm(path.join(package:installdir("lib"), "*.a"))
  24. else
  25. os.tryrm(path.join(package:installdir("lib"), "*.so"))
  26. os.tryrm(path.join(package:installdir("lib"), "*.dylib"))
  27. end
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include <stdio.h>
  32. #include "workflow/WFHttpServer.h"
  33. static void test() {
  34. WFHttpServer server([](WFHttpTask *task) {
  35. task->get_resp()->append_output_body("<html>Hello World!</html>");
  36. });
  37. if (server.start(8888) == 0) { // start server on port 8888
  38. server.stop();
  39. }
  40. }
  41. ]]}, {configs = {languages = "c++11"}}))
  42. end)