62 lines
2.0 KiB
Lua
62 lines
2.0 KiB
Lua
package("splib")
|
|
set_description("The splib package")
|
|
|
|
add_urls("https://git.ale-pri.com/Persson-dev/Simple-Protocol-Lib.git")
|
|
add_versions("v1.0.0", "db0c5f324570bfa071e182537b9a96664770446a")
|
|
add_versions("v1.0.1", "f145716cf6ed6c863dd5267e525842e8970833de")
|
|
add_versions("v1.0.2", "2acbd76c5a08b2400e64f1e507e62c9bd150392d")
|
|
|
|
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean"})
|
|
|
|
on_load(function (package)
|
|
package:set("installdir", path.join(os.scriptdir(), package:plat(), package:arch(), package:mode()))
|
|
end)
|
|
|
|
on_test(function (package)
|
|
assert(package:check_cxxsnippets({test = [[
|
|
#include <sp/default/DefaultPacket.h>
|
|
#include <sp/protocol/Field.h>
|
|
#include <sp/protocol/MessageBase.h>
|
|
|
|
enum PacketId {
|
|
KeepAlive = 0,
|
|
};
|
|
|
|
|
|
enum class KeepAliveFieldsE {
|
|
KeepAliveId = 0,
|
|
};
|
|
|
|
using KeepAliveFields = std::tuple<
|
|
std::uint64_t //<- KeepAliveId
|
|
>;
|
|
|
|
DeclarePacket(KeepAlive){
|
|
public:
|
|
PacketConstructor(KeepAlive)
|
|
|
|
std::uint64_t GetKeepAliveId() const {
|
|
return GetField<KeepAliveFieldsE, KeepAliveFieldsE::KeepAliveId>();
|
|
}
|
|
};
|
|
|
|
using AllPackets = std::tuple<KeepAlivePacket>;
|
|
|
|
#include <sp/default/DefaultPacketHandler.h>
|
|
#include <sp/default/DefaultPacketFactory.h>
|
|
]]}, {configs = {languages = "c++17"}}))
|
|
end)
|
|
|
|
on_install(function (package)
|
|
import("package.tools.xmake").install(package)
|
|
end)
|
|
|
|
on_fetch(function (package)
|
|
local result = {}
|
|
local libfiledir = (package:config("shared") and package:is_plat("windows", "mingw")) and "bin" or "lib"
|
|
result.links = "SimpleProtocolLib"
|
|
result.linkdirs = package:installdir("lib")
|
|
result.includedirs = package:installdir("include")
|
|
return result
|
|
end)
|