xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package("cgraph")
  2. set_homepage("http://www.chunel.cn")
  3. set_description("A common used C++ DAG framework")
  4. set_license("MIT")
  5. add_urls("https://github.com/ChunelFeng/CGraph/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ChunelFeng/CGraph.git")
  7. add_versions("v2.6.2", "7067ed97b8c4ad118dccc93aca58e739717d87bcd21d6ea937ffe2e2bd45706d")
  8. add_versions("v2.6.1", "0024854adfa836d424ff38782c926173f2d869af205c39a031cf0dc13c418c84")
  9. add_versions("v2.6.0", "1b055ee86f0340f2c35b4ed40c4a3b4cc05081b115b0fb634d778671018648f2")
  10. add_versions("v2.5.4", "fd5a53dc0d7e3fc11050ccc13fac987196ad42184a4e244b9d5e5d698b1cb101")
  11. if is_plat("linux", "bsd") then
  12. add_syslinks("pthread")
  13. end
  14. on_install(function (package)
  15. if package:has_tool("cxx", "cl") then
  16. package:add("cxxflags", "/utf-8")
  17. end
  18. io.writefile("xmake.lua", [[
  19. add_rules("mode.debug", "mode.release")
  20. set_languages("c++11")
  21. set_encodings("utf-8")
  22. target("cgraph")
  23. set_kind("$(kind)")
  24. add_files("src/**.cpp")
  25. add_headerfiles("src/(**.h)", "src/(**.inl)")
  26. if is_plat("windows") and is_kind("shared") then
  27. add_rules("utils.symbols.export_all", {export_classes = true})
  28. end
  29. if is_plat("linux", "macosx") then
  30. add_defines("_ENABLE_LIKELY_")
  31. end
  32. if is_plat("linux", "bsd") then
  33. add_syslinks("pthread")
  34. end
  35. ]])
  36. import("package.tools.xmake").install(package)
  37. end)
  38. on_test(function (package)
  39. assert(package:check_cxxsnippets({test = [[
  40. #include <CGraph.h>
  41. class MyNode1 : public CGraph::GNode {
  42. public:
  43. CStatus run() override {
  44. CGRAPH_SLEEP_SECOND(1)
  45. return CStatus();
  46. }
  47. };
  48. void test() {}
  49. ]]}, {configs = {languages = "c++11"}}))
  50. end)