From 6fbc548b9609bab58cef4ca8a67a646fd7602c13 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Sat, 7 Sep 2019 19:34:36 +0800 Subject: [PATCH 1/2] add fmt lib --- packages/f/fmt/xmake.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 packages/f/fmt/xmake.lua diff --git a/packages/f/fmt/xmake.lua b/packages/f/fmt/xmake.lua new file mode 100644 index 000000000..7d86cb758 --- /dev/null +++ b/packages/f/fmt/xmake.lua @@ -0,0 +1,33 @@ +package("fmt") + + set_homepage("https://fmt.dev") + set_description("fmt is an open-source formatting library for C++. It can be used as a safe and fast alternative to (s)printf and iostreams.") + + set_urls("https://github.com/fmtlib/fmt/releases/download/$(version)/fmt-$(version).zip") + add_versions("6.0.0", "b4a16b38fa171f15dbfb958b02da9bbef2c482debadf64ac81ec61b5ac422440") + add_versions("5.3.0", "4c0741e10183f75d7d6f730b8708a99b329b2f942dad5a9da3385ab92bb4a15c") + + if is_plat("linux", "macosx") then + add_deps("cmake") + end + + on_install("@windows", function (package) + os.cp("include/fmt", package:installdir("include")) + end) + + on_install("@linux", "@macosx", function (package) + import("package.tools.cmake").install(package) + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + #include + #include + static void test() { + std::string s = fmt::format("{}", "hello"); + assert(s == "hello"); + } + ]]}, {configs = {languages = "c++11"}, includes = "fmt/format.h", defines="FMT_HEADER_ONLY"})) + end) + From f7865de6f596174100144a77dc1b3fd1ec8d0914 Mon Sep 17 00:00:00 2001 From: fasiondog Date: Sun, 8 Sep 2019 15:37:06 +0800 Subject: [PATCH 2/2] add fmt lib --- packages/f/fmt/xmake.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/f/fmt/xmake.lua b/packages/f/fmt/xmake.lua index 7d86cb758..d502d3a8c 100644 --- a/packages/f/fmt/xmake.lua +++ b/packages/f/fmt/xmake.lua @@ -11,11 +11,11 @@ package("fmt") add_deps("cmake") end - on_install("@windows", function (package) + on_install("windows", function (package) os.cp("include/fmt", package:installdir("include")) end) - on_install("@linux", "@macosx", function (package) + on_install("linux", "macosx", function (package) import("package.tools.cmake").install(package) end)