From 7b1ef4341695c1124138643179558339567a8ff2 Mon Sep 17 00:00:00 2001 From: Qudix <17361645+Qudix@users.noreply.github.com> Date: Wed, 7 Jun 2023 21:08:21 -0500 Subject: [PATCH] [rsm-binary-io] Add package (#2151) * [rsm-binary-io] Add package * [rsm-binary-io] License * [rsm-binary-io] Add git url * [rsm-binary-io] Support `shared` * [rsm-binary-io] Export classes --- packages/r/rsm-binary-io/xmake.lua | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 packages/r/rsm-binary-io/xmake.lua diff --git a/packages/r/rsm-binary-io/xmake.lua b/packages/r/rsm-binary-io/xmake.lua new file mode 100644 index 000000000..7178b6b82 --- /dev/null +++ b/packages/r/rsm-binary-io/xmake.lua @@ -0,0 +1,35 @@ +package("rsm-binary-io") + set_homepage("https://github.com/Ryan-rsm-McKenzie/binary_io") + set_description("A binary i/o library for C++, without the agonizing pain") + set_license("MIT") + + add_urls("https://github.com/Ryan-rsm-McKenzie/binary_io/archive/refs/tags/$(version).tar.gz", + "https://github.com/Ryan-rsm-McKenzie/binary_io.git") + add_versions("2.0.5", "4cc904ef02f77e04756cbdf01372629b0f04d859f06ee088d854468abdd4b840") + + on_install(function (package) + io.writefile("xmake.lua", [[ + add_rules("mode.debug", "mode.release") + set_languages("c++20") + target("rsm-binary-io") + set_kind("$(kind)") + add_files("src/**.cpp") + add_includedirs("include/") + add_headerfiles("include/(**.hpp)") + if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all", {export_classes = true}) + end + ]]) + local configs = {} + configs.kind = package:config("shared") and "shared" or "static" + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + void test(int argc, char** argv) { + binary_io::span_istream s; + assert(s.tell() == 0); + } + ]]}, {configs = {languages = "c++20"}, includes = {"binary_io/binary_io.hpp", "assert.h"}})) + end)