add rest_rpc and sqlite_orm (#2163)
* add rest_rpc * add sqlite_orm * Update xmake.lua * Update xmake.lua * Update xmake.lua * add ws2_32 * limit os * Update xmake.lua * set c++11 --------- Co-authored-by: ruki <waruqi@gmail.com>pull/2177/head
parent
0460312b10
commit
e8c9401c48
2 changed files with 75 additions and 0 deletions
@ -0,0 +1,29 @@ |
||||
package("rest_rpc") |
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://github.com/qicosmos/rest_rpc") |
||||
set_description("c++11, high performance, cross platform, easy to use rpc framework.") |
||||
|
||||
add_urls("https://github.com/qicosmos/rest_rpc.git") |
||||
add_versions("2023.6.14", "8782f1d341e1dd18f9fe3a77b8335fd17a5ba585") |
||||
|
||||
add_deps("asio", "msgpack-cxx") |
||||
|
||||
if is_plat("mingw") then |
||||
add_syslinks("ws2_32") |
||||
end |
||||
|
||||
on_install("windows", "macosx", "linux", "mingw", function (package) |
||||
os.cp("include", package:installdir()) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include "rest_rpc.hpp" |
||||
void test() { |
||||
rest_rpc::rpc_client client("127.0.0.1", 9000); |
||||
client.connect(); |
||||
int result = client.call<int>("add", 1, 2); |
||||
client.run(); |
||||
} |
||||
]]}, {configs = {languages = "c++11"}})) |
||||
end) |
@ -0,0 +1,46 @@ |
||||
package("sqlite_orm") |
||||
set_kind("library", {headeronly = true}) |
||||
set_homepage("https://github.com/fnc12/sqlite_orm") |
||||
set_description("SQLite ORM light header only library for modern C++") |
||||
|
||||
add_urls("https://github.com/fnc12/sqlite_orm/archive/refs/tags/v$(version).zip") |
||||
add_versions("1.8.2", "dd098fe06b46640384b77fd937b694af105dab221ab45f574e4ff9bb38bbeb90") |
||||
|
||||
add_deps("sqlite3") |
||||
|
||||
on_install(function (package) |
||||
os.cp("include", package:installdir()) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:check_cxxsnippets({test = [[ |
||||
#include "sqlite_orm/sqlite_orm.h" |
||||
using namespace sqlite_orm; |
||||
struct User{ |
||||
int id; |
||||
std::string firstName; |
||||
std::string lastName; |
||||
int birthDate; |
||||
std::unique_ptr<std::string> imageUrl; |
||||
int typeId; |
||||
}; |
||||
|
||||
struct UserType { |
||||
int id; |
||||
std::string name; |
||||
}; |
||||
void test() { |
||||
auto storage = make_storage("db.sqlite", |
||||
make_table("users", |
||||
make_column("id", &User::id, primary_key().autoincrement()), |
||||
make_column("first_name", &User::firstName), |
||||
make_column("last_name", &User::lastName), |
||||
make_column("birth_date", &User::birthDate), |
||||
make_column("image_url", &User::imageUrl), |
||||
make_column("type_id", &User::typeId)), |
||||
make_table("user_types", |
||||
make_column("id", &UserType::id, primary_key().autoincrement()), |
||||
make_column("name", &UserType::name, default_value("name_placeholder")))); |
||||
} |
||||
]]}, {configs = {languages = "c++17"}})) |
||||
end) |
Loading…
Reference in new issue