[fmt,folly] backport '/utf-8 only if the compiler is MSVC at build time' (#40944)

This commit is contained in:
Amin Yahyaabadi 2024-09-24 09:42:06 -07:00 committed by GitHub
parent 08ef4d0ea1
commit d9af3f5586
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 52 additions and 17 deletions

View File

@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ca64fff..1606e886 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -365,8 +365,8 @@ if (NOT MSVC)
# Unicode is always supported on compilers other than MSVC.
elseif (FMT_UNICODE)
# Unicode support requires compiling with /utf-8.
- target_compile_options(fmt PUBLIC $<$<COMPILE_LANGUAGE:CXX>:/utf-8>)
- target_compile_options(fmt-header-only INTERFACE $<$<COMPILE_LANGUAGE:CXX>:/utf-8>)
+ target_compile_options(fmt PUBLIC $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)
+ target_compile_options(fmt-header-only INTERFACE $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>)
else ()
target_compile_definitions(fmt PUBLIC FMT_UNICODE=0)
endif ()
--
2.34.1

View File

@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
fix-write-batch.patch
fix-pass-utf-8-only-if-the-compiler-is-MSVC-at-build.patch # remove in next release
)
vcpkg_cmake_configure(
@ -28,7 +29,7 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
)
endif()
file(REMOVE_RECURSE
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

View File

@ -1,6 +1,7 @@
{
"name": "fmt",
"version": "11.0.2",
"port-version": 1,
"description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.",
"homepage": "https://github.com/fmtlib/fmt",
"license": "MIT",

View File

@ -0,0 +1,18 @@
diff --git a/CMake/GenPkgConfig.cmake b/CMake/GenPkgConfig.cmake
index 0e93175bd..9de854022 100644
--- a/CMake/GenPkgConfig.cmake
+++ b/CMake/GenPkgConfig.cmake
@@ -103,6 +103,11 @@ function(gen_pkgconfig_vars)
"<COMPILE_LANG_AND_ID:CUDA,NVIDIA>" "<COMPILE_LANGUAGE:CUDA>"
cflags "${cflags}"
)
+
+ endif()
+ # patch for fmt's generator expression on older CMake
+ if (MSVC)
+ string(REPLACE "$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CXX_COMPILER_ID:MSVC>>:/utf-8>" "/utf-8" cflags "${cflags}")
endif()
set("${var_prefix}_CFLAGS" "${cflags}" PARENT_SCOPE)
--
2.34.1

View File

@ -1,13 +0,0 @@
diff --git a/CMake/GenPkgConfig.cmake b/CMake/GenPkgConfig.cmake
index 0e93175..1637d9f 100644
--- a/CMake/GenPkgConfig.cmake
+++ b/CMake/GenPkgConfig.cmake
@@ -93,7 +93,7 @@ function(gen_pkgconfig_vars)
# Set the output variables
string(REPLACE ";" " " cflags "${cflags}")
string(REPLACE ";" " " private_libs "${private_libs}")
-
+ string(REPLACE "<$<COMPILE_LANGUAGE:CXX>:/utf-8>" "/utf-8" cflags "${cflags}")
# Since CMake 3.18 FindThreads may include a generator expression requiring
# a target, which gets propagated to us through INTERFACE_COMPILE_OPTIONS.
# Before CMake 3.19 there's no way to solve this in a general way, so we

View File

@ -17,7 +17,7 @@ vcpkg_from_github(
fix-deps.patch
disable-uninitialized-resize-on-new-stl.patch
fix-unistd-include.patch
fix-fmt11-cmake.patch
fix-fmt-patch-for-old-cmake.patch
)
file(REMOVE "${SOURCE_PATH}/CMake/FindFmt.cmake")

View File

@ -1,6 +1,7 @@
{
"name": "folly",
"version-string": "2024.09.16.00",
"port-version": 1,
"description": "An open-source C++ library developed and used at Facebook. The library is UNSTABLE on Windows",
"homepage": "https://github.com/facebook/folly",
"license": "Apache-2.0",

View File

@ -2838,11 +2838,11 @@
},
"fmt": {
"baseline": "11.0.2",
"port-version": 0
"port-version": 1
},
"folly": {
"baseline": "2024.09.16.00",
"port-version": 0
"port-version": 1
},
"font-chef": {
"baseline": "1.1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "07a73a7565e5de9eb42e90c16c133bdfdfebbcda",
"version": "11.0.2",
"port-version": 1
},
{
"git-tree": "65fe4dea09fc09a30e6ece9ac19edb7ad6a49601",
"version": "11.0.2",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1240ab18398982f4a1f4c4cd9bd7f1cdf63f6664",
"version-string": "2024.09.16.00",
"port-version": 1
},
{
"git-tree": "bdb6486a9cc0a710f19f521818547b7e0402e611",
"version-string": "2024.09.16.00",