xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package("cpp-tbox")
  2. set_homepage("https://github.com/cpp-main/cpp-tbox")
  3. set_description("A complete Linux application software development tool library and runtime framework, aim at make C++ development easy.")
  4. set_license("MIT")
  5. add_urls("https://github.com/cpp-main/cpp-tbox.git")
  6. add_versions("2023.12.13", "1666e59a1ff2407a692d619691d744d52c1c057d")
  7. add_configs("mqtt", {description = "Enable mosquitto", default = false, type = "boolean"})
  8. add_deps("cmake")
  9. add_deps("dbus", "nlohmann_json")
  10. on_load(function (package)
  11. if package:config("mqtt") then
  12. add_deps("mosquitto")
  13. end
  14. end)
  15. on_install("linux", function (package)
  16. local configs = {"-DCMAKE_ENABLE_TEST=OFF"}
  17. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  18. table.insert(configs, "-DTBOX_ENABLE_MQTT=" .. (package:config("mqtt") and "ON" or "OFF"))
  19. table.insert(configs, "-DTBOX_BUILD_LIB_TYPE=" .. (package:config("shared") and "SHARED" or "STATIC"))
  20. import("package.tools.cmake").install(package, configs)
  21. local httpdir = path.join(package:installdir(),"include", "tbox", "http")
  22. os.mv(path.join(httpdir, "types.h"), path.join(httpdir, "server", "types.h"))
  23. os.mv(path.join(httpdir, "server.h"), path.join(httpdir, "server", "server.h"))
  24. os.mv(path.join(httpdir, "context.h"), path.join(httpdir, "server", "context.h"))
  25. os.mv(path.join(httpdir, "middleware.h"), path.join(httpdir, "server", "middleware.h"))
  26. os.mv(path.join(httpdir, "router.h"), path.join(httpdir, "server", "router.h"))
  27. os.mv(path.join(httpdir, "client.h"), path.join(httpdir, "client", "client.h"))
  28. end)
  29. on_test(function (package)
  30. assert(package:check_cxxsnippets({test = [[
  31. #include <tbox/base/log.h>
  32. #include <tbox/base/log_output.h>
  33. #include <tbox/base/scope_exit.hpp>
  34. using namespace tbox;
  35. void test() {
  36. LogOutput_Enable();
  37. }
  38. ]]}, {configs = {languages = "c++11"}}))
  39. end)