Skip to content

Commit

Permalink
[fmt,folly] backport '/utf-8 only if the compiler is MSVC at build ti…
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Sep 24, 2024
1 parent 08ef4d0 commit d9af3f5
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion ports/fmt/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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"
)
Expand Down
1 change: 1 addition & 0 deletions ports/fmt/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 18 additions & 0 deletions ports/folly/fix-fmt-patch-for-old-cmake.patch
Original file line number Diff line number Diff line change
@@ -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
13 changes: 0 additions & 13 deletions ports/folly/fix-fmt11-cmake.patch

This file was deleted.

2 changes: 1 addition & 1 deletion ports/folly/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions ports/folly/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/fmt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "07a73a7565e5de9eb42e90c16c133bdfdfebbcda",
"version": "11.0.2",
"port-version": 1
},
{
"git-tree": "65fe4dea09fc09a30e6ece9ac19edb7ad6a49601",
"version": "11.0.2",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/folly.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit d9af3f5

Please sign in to comment.