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 #include #include 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(); } }; using AllPackets = std::tuple; #include #include ]]}, {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)