From 3f18fcd9ed7308c00491b6455e5c7bea5ac22edc Mon Sep 17 00:00:00 2001 From: star9029 Date: Thu, 10 Aug 2023 22:45:58 +0800 Subject: [PATCH] cpp-semver: add package (#2422) * cpp-semver: add package * fix test * fix cpp compile --- packages/c/cpp-semver/xmake.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 packages/c/cpp-semver/xmake.lua diff --git a/packages/c/cpp-semver/xmake.lua b/packages/c/cpp-semver/xmake.lua new file mode 100644 index 000000000..0e90dc8e6 --- /dev/null +++ b/packages/c/cpp-semver/xmake.lua @@ -0,0 +1,26 @@ +package("cpp-semver") + set_kind("library", {headeronly = true}) + set_homepage("https://github.com/z4kn4fein/cpp-semver") + set_description("Semantic Versioning library for modern C++.") + set_license("MIT") + + add_urls("https://github.com/z4kn4fein/cpp-semver/archive/refs/tags/$(version).tar.gz", + "https://github.com/z4kn4fein/cpp-semver.git") + + add_versions("v0.3.1", "9168cc815d8b9a5b3d73d2a158efec467eff844f1cab929bc145312cfc3958ae") + + on_install(function (package) + io.replace("include/semver/semver.hpp", "#include ", "#include \n#include ", {plain = true}) + os.cp("include", package:installdir()) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + void test() { + auto v1 = semver::version(3, 5, 2, "alpha", "build"); + auto v2 = semver::version::parse("3.5.2-alpha+build"); + } + ]]}, {configs = {languages = "c++17"}})) + end)