xmake.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package("ormpp")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/qicosmos/ormpp")
  4. set_description("modern C++ ORM, C++17, support mysql, postgresql,sqlite")
  5. set_license("Apache-2.0")
  6. set_urls("https://github.com/qicosmos/ormpp/archive/refs/tags/$(version).tar.gz",
  7. "https://github.com/qicosmos/ormpp.git")
  8. add_versions("v0.1.1", "a3c93599950a4c5822ebd0750ac7964c59c9b3f84f638525f01578bac6d898c2")
  9. add_configs("mysql", {description = "Using mysql", default = false, type = "boolean"})
  10. add_configs("postgresql", {description = "Using postgresql", default = false, type = "boolean"})
  11. add_configs("sqlite3", {description = "Using sqlite3", default = false, type = "boolean"})
  12. on_load("windows", "macosx", "linux", function(package)
  13. local configs = {
  14. mysql = "ORMPP_ENABLE_MYSQL",
  15. postgresql = "ORMPP_ENABLE_PG",
  16. sqlite3 = "ORMPP_ENABLE_SQLITE3"
  17. }
  18. for config, define in pairs(configs) do
  19. if package:config(config) then
  20. package:add("deps", config)
  21. package:add("defines", define)
  22. end
  23. end
  24. end)
  25. on_install(function (package)
  26. os.cp("include/*", package:installdir("include"))
  27. os.cp("frozen/**", package:installdir("include/frozen"), {rootdir = "frozen"})
  28. os.cp("iguana/**", package:installdir("include/iguana"), {rootdir = "iguana"})
  29. end)
  30. on_test(function (package)
  31. assert(package:check_cxxsnippets({test = [[
  32. using namespace ormpp;
  33. struct student {
  34. std::string name;
  35. int age;
  36. int id;
  37. };
  38. REGISTER_AUTO_KEY(student, id)
  39. REFLECTION_WITH_NAME(student, "t_student", id, name, age)
  40. ]]}, {configs = {languages = "c++17"}, includes = { "dbng.hpp"} }))
  41. end)