|
@@ -15,9 +15,18 @@ package("ormpp")
|
|
|
add_configs("postgresql", {description = "Using postgresql", default = false, type = "boolean"})
|
|
|
add_configs("sqlite3", {description = "Using sqlite3", default = false, type = "boolean"})
|
|
|
|
|
|
- add_deps("iguana <=1.0.5")
|
|
|
+ on_load(function (package)
|
|
|
+ local iguana_vers = {
|
|
|
+ ["0.1.3"] = "1.0.5",
|
|
|
+ ["v0.1.2"] = "1.0.5",
|
|
|
+ ["v0.1.1"] = "1.0.5",
|
|
|
+ }
|
|
|
+ if package:gitref() then
|
|
|
+ package:add("deps", "iguana")
|
|
|
+ else
|
|
|
+ package:add("deps", "iguana " .. iguana_vers[package:version_str()])
|
|
|
+ end
|
|
|
|
|
|
- on_load(function(package)
|
|
|
local configs = {
|
|
|
mysql = "ORMPP_ENABLE_MYSQL",
|
|
|
postgresql = "ORMPP_ENABLE_PG",
|
|
@@ -46,16 +55,33 @@ package("ormpp")
|
|
|
languages = "c++20"
|
|
|
end
|
|
|
|
|
|
- assert(package:check_cxxsnippets({test = [[
|
|
|
- #include <algorithm>
|
|
|
- #include <dbng.hpp>
|
|
|
- using namespace ormpp;
|
|
|
- struct student {
|
|
|
- std::string name;
|
|
|
- int age;
|
|
|
- int id;
|
|
|
- };
|
|
|
- REGISTER_AUTO_KEY(student, id)
|
|
|
- REFLECTION_WITH_NAME(student, "t_student", id, name, age)
|
|
|
- ]]}, {configs = {languages = languages}}))
|
|
|
+ local snippets
|
|
|
+ if package:gitref() or package:version():gt("0.1.3") then
|
|
|
+ snippets = [[
|
|
|
+ #include <algorithm>
|
|
|
+ #include <dbng.hpp>
|
|
|
+ using namespace ormpp;
|
|
|
+ struct person {
|
|
|
+ std::string name;
|
|
|
+ int age;
|
|
|
+ int id;
|
|
|
+ };
|
|
|
+ REGISTER_AUTO_KEY(person, id)
|
|
|
+ YLT_REFL(person, id, name, age)
|
|
|
+ ]]
|
|
|
+ else
|
|
|
+ snippets = [[
|
|
|
+ #include <algorithm>
|
|
|
+ #include <dbng.hpp>
|
|
|
+ using namespace ormpp;
|
|
|
+ struct student {
|
|
|
+ std::string name;
|
|
|
+ int age;
|
|
|
+ int id;
|
|
|
+ };
|
|
|
+ REGISTER_AUTO_KEY(student, id)
|
|
|
+ REFLECTION_WITH_NAME(student, "t_student", id, name, age)
|
|
|
+ ]]
|
|
|
+ end
|
|
|
+ assert(package:check_cxxsnippets({test = snippets}, {configs = {languages = languages}}))
|
|
|
end)
|