xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package("sqlite_orm")
  2. set_kind("library", {headeronly = true})
  3. set_homepage("https://github.com/fnc12/sqlite_orm")
  4. set_description("SQLite ORM light header only library for modern C++")
  5. add_urls("https://github.com/fnc12/sqlite_orm/archive/refs/tags/v$(version).zip")
  6. add_versions("1.8.2", "dd098fe06b46640384b77fd937b694af105dab221ab45f574e4ff9bb38bbeb90")
  7. add_deps("sqlite3")
  8. on_install(function (package)
  9. os.cp("include", package:installdir())
  10. end)
  11. on_test(function (package)
  12. assert(package:check_cxxsnippets({test = [[
  13. #include "sqlite_orm/sqlite_orm.h"
  14. using namespace sqlite_orm;
  15. struct User{
  16. int id;
  17. std::string firstName;
  18. std::string lastName;
  19. int birthDate;
  20. std::unique_ptr<std::string> imageUrl;
  21. int typeId;
  22. };
  23. struct UserType {
  24. int id;
  25. std::string name;
  26. };
  27. void test() {
  28. auto storage = make_storage("db.sqlite",
  29. make_table("users",
  30. make_column("id", &User::id, primary_key().autoincrement()),
  31. make_column("first_name", &User::firstName),
  32. make_column("last_name", &User::lastName),
  33. make_column("birth_date", &User::birthDate),
  34. make_column("image_url", &User::imageUrl),
  35. make_column("type_id", &User::typeId)),
  36. make_table("user_types",
  37. make_column("id", &UserType::id, primary_key().autoincrement()),
  38. make_column("name", &UserType::name, default_value("name_placeholder"))));
  39. }
  40. ]]}, {configs = {languages = "c++17"}}))
  41. end)