Files
xmake-repo/packages/s/splib/xmake.lua
2025-03-03 11:10:04 +01:00

63 lines
2.1 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_versions("v1.0.3", "4a7eb7a1df3076529332c1f0d0cfb4b862f47b3d")
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)