add splib (unfinished)
This commit is contained in:
60
packages/s/splib/xmake.lua
Normal file
60
packages/s/splib/xmake.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
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", "...")
|
||||
|
||||
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")
|
||||
result.libfiles = path.join(package:installdir(libfiledir), "libSimpleProtocolLib.so")
|
||||
return result
|
||||
end)
|
||||
Reference in New Issue
Block a user