Browse Source

fmt: add 11.0.0 version (#4533)

* fmt: add 11.0.0 verson

* fix unicode

* add unicode config

* Update xmake.lua
star9029 1 year ago
parent
commit
12e6b31b56
1 changed files with 8 additions and 3 deletions
  1. 8 3
      packages/f/fmt/xmake.lua

+ 8 - 3
packages/f/fmt/xmake.lua

@@ -1,10 +1,11 @@
 package("fmt")
 package("fmt")
-
     set_homepage("https://fmt.dev")
     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_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",
     set_urls("https://github.com/fmtlib/fmt/releases/download/$(version)/fmt-$(version).zip",
              "https://github.com/fmtlib/fmt.git")
              "https://github.com/fmtlib/fmt.git")
+
+    add_versions("11.0.0", "583ce480ef07fad76ef86e1e2a639fc231c3daa86c4aa6bcba524ce908f30699")
     add_versions("10.2.1", "312151a2d13c8327f5c9c586ac6cf7cddc1658e8f53edae0ec56509c8fa516c9")
     add_versions("10.2.1", "312151a2d13c8327f5c9c586ac6cf7cddc1658e8f53edae0ec56509c8fa516c9")
     add_versions("10.2.0", "8a942861a94f8461a280f823041cde8f620a6d8b0e0aacc98c15bb5a9dd92399")
     add_versions("10.2.0", "8a942861a94f8461a280f823041cde8f620a6d8b0e0aacc98c15bb5a9dd92399")
     add_versions("10.1.1", "b84e58a310c9b50196cda48d5678d5fa0849bca19e5fdba6b684f0ee93ed9d1b")
     add_versions("10.1.1", "b84e58a310c9b50196cda48d5678d5fa0849bca19e5fdba6b684f0ee93ed9d1b")
@@ -25,6 +26,7 @@ package("fmt")
                 "3280569bced9ec08933f0ea37b6a4fef4538944d9046fe197ad63e22d1357cd4")
                 "3280569bced9ec08933f0ea37b6a4fef4538944d9046fe197ad63e22d1357cd4")
 
 
     add_configs("header_only", {description = "Use header only version.", default = false, type = "boolean"})
     add_configs("header_only", {description = "Use header only version.", default = false, type = "boolean"})
+    add_configs("unicode", {description = "Enable Unicode support.", default = true, type = "boolean"})
 
 
     if is_plat("mingw") and is_subhost("msys") then
     if is_plat("mingw") and is_subhost("msys") then
         add_extsources("pacman::fmt")
         add_extsources("pacman::fmt")
@@ -48,6 +50,9 @@ package("fmt")
                 package:add("defines", "FMT_EXPORT")
                 package:add("defines", "FMT_EXPORT")
             end
             end
         end
         end
+        if package:is_plat("windows") and package:config("unicode") then
+            package:add("cxxflags", "/utf-8")
+        end
     end)
     end)
 
 
     on_install(function (package)
     on_install(function (package)
@@ -58,7 +63,8 @@ package("fmt")
         io.gsub("CMakeLists.txt", "MASTER_PROJECT AND CMAKE_GENERATOR MATCHES \"Visual Studio\"", "0")
         io.gsub("CMakeLists.txt", "MASTER_PROJECT AND CMAKE_GENERATOR MATCHES \"Visual Studio\"", "0")
         local configs = {"-DFMT_TEST=OFF", "-DFMT_DOC=OFF", "-DFMT_FUZZ=OFF", "-DCMAKE_CXX_VISIBILITY_PRESET=default"}
         local configs = {"-DFMT_TEST=OFF", "-DFMT_DOC=OFF", "-DFMT_FUZZ=OFF", "-DCMAKE_CXX_VISIBILITY_PRESET=default"}
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+        table.insert(configs, "-DFMT_UNICODE=" .. (package:config("unicode") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
         import("package.tools.cmake").install(package, configs)
     end)
     end)
 
 
@@ -73,4 +79,3 @@ package("fmt")
             }
             }
         ]]}, {configs = {languages = "c++14"}, includes = "fmt/format.h"}))
         ]]}, {configs = {languages = "c++14"}, includes = "fmt/format.h"}))
     end)
     end)
-