xmake.lua 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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("v3.1.1", "b49014b1774ed4009a8770ce482e5cb260ee2cbf7854d7795af0812ccecf48ea")
  8. add_versions("v3.1.0", "fc2c2df5a975a77eafa1ce396a2e2aa36b8498af15e991c8ce964e1a3b39df73")
  9. add_versions("v2.6.2", "7067ed97b8c4ad118dccc93aca58e739717d87bcd21d6ea937ffe2e2bd45706d")
  10. add_versions("v2.6.1", "0024854adfa836d424ff38782c926173f2d869af205c39a031cf0dc13c418c84")
  11. add_versions("v2.6.0", "1b055ee86f0340f2c35b4ed40c4a3b4cc05081b115b0fb634d778671018648f2")
  12. add_versions("v2.5.4", "fd5a53dc0d7e3fc11050ccc13fac987196ad42184a4e244b9d5e5d698b1cb101")
  13. if is_plat("linux", "bsd") then
  14. add_syslinks("pthread")
  15. end
  16. on_install(function (package)
  17. if package:has_tool("cxx", "cl") then
  18. package:add("cxxflags", "/utf-8")
  19. end
  20. io.writefile("xmake.lua", [[
  21. add_rules("mode.debug", "mode.release")
  22. set_languages("c++11")
  23. set_encodings("utf-8")
  24. target("cgraph")
  25. set_kind("$(kind)")
  26. add_files("src/**.cpp")
  27. add_headerfiles("src/(**.h)", "src/(**.inl)")
  28. if is_plat("windows") and is_kind("shared") then
  29. add_rules("utils.symbols.export_all", {export_classes = true})
  30. end
  31. if is_plat("linux", "macosx") then
  32. add_defines("_ENABLE_LIKELY_")
  33. end
  34. if is_plat("linux", "bsd") then
  35. add_syslinks("pthread")
  36. end
  37. ]])
  38. import("package.tools.xmake").install(package)
  39. end)
  40. on_test(function (package)
  41. assert(package:check_cxxsnippets({test = [[
  42. #include <CGraph.h>
  43. class MyNode1 : public CGraph::GNode {
  44. public:
  45. CStatus run() override {
  46. CGRAPH_SLEEP_SECOND(1)
  47. return CStatus();
  48. }
  49. };
  50. void test() {}
  51. ]]}, {configs = {languages = "c++11"}}))
  52. end)