From d896a80d17865f26a30acaee239abe43e65bf31f Mon Sep 17 00:00:00 2001 From: "l.feng" <43399351+msclock@users.noreply.github.com> Date: Mon, 5 May 2025 14:29:13 +0800 Subject: [PATCH] update spdlog and fmt Signed-off-by: l.feng <43399351+msclock@users.noreply.github.com> --- cmake/vcpkg/ports/fmt/fix-write-batch.patch | 13 +++++++ cmake/vcpkg/ports/fmt/portfile.cmake | 37 +++++++++++++++++++ cmake/vcpkg/ports/fmt/usage | 8 ++++ cmake/vcpkg/ports/fmt/vcpkg.json | 18 +++++++++ .../vcpkg/ports/fmt/fix-write-batch.patch | 13 +++++++ template/cmake/vcpkg/ports/fmt/portfile.cmake | 37 +++++++++++++++++++ template/cmake/vcpkg/ports/fmt/usage | 8 ++++ template/cmake/vcpkg/ports/fmt/vcpkg.json | 18 +++++++++ template/vcpkg.json.jinja | 5 +-- vcpkg.json | 5 +-- 10 files changed, 156 insertions(+), 6 deletions(-) create mode 100644 cmake/vcpkg/ports/fmt/fix-write-batch.patch create mode 100644 cmake/vcpkg/ports/fmt/portfile.cmake create mode 100644 cmake/vcpkg/ports/fmt/usage create mode 100644 cmake/vcpkg/ports/fmt/vcpkg.json create mode 100644 template/cmake/vcpkg/ports/fmt/fix-write-batch.patch create mode 100644 template/cmake/vcpkg/ports/fmt/portfile.cmake create mode 100644 template/cmake/vcpkg/ports/fmt/usage create mode 100644 template/cmake/vcpkg/ports/fmt/vcpkg.json diff --git a/cmake/vcpkg/ports/fmt/fix-write-batch.patch b/cmake/vcpkg/ports/fmt/fix-write-batch.patch new file mode 100644 index 00000000..6bec3b8e --- /dev/null +++ b/cmake/vcpkg/ports/fmt/fix-write-batch.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 88c12148..967b53dd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -260,7 +260,7 @@ if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") + join(netfxpath + "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\" + ".NETFramework\\v4.0") +- file(WRITE run-msbuild.bat " ++ file(WRITE "${CMAKE_BINARY_DIR}/run-msbuild.bat" " + ${MSBUILD_SETUP} + ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") + endif () diff --git a/cmake/vcpkg/ports/fmt/portfile.cmake b/cmake/vcpkg/ports/fmt/portfile.cmake new file mode 100644 index 00000000..3058d1cf --- /dev/null +++ b/cmake/vcpkg/ports/fmt/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO fmtlib/fmt + REF "${VERSION}" + SHA512 46974efd36e613477351aa357c451cee434da797c2a505f9f86d73e394dcb35dc2dc0cda66abb98c023e8f24deac9d8e3ee6f9f6c0971cc4c00e37c34aa7f15f + HEAD_REF master + PATCHES + fix-write-batch.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFMT_CMAKE_DIR=share/fmt + -DFMT_TEST=OFF + -DFMT_DOC=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup() +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fmt/base.h" + "defined(FMT_SHARED)" + "1" + ) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/cmake/vcpkg/ports/fmt/usage b/cmake/vcpkg/ports/fmt/usage new file mode 100644 index 00000000..e5a9d704 --- /dev/null +++ b/cmake/vcpkg/ports/fmt/usage @@ -0,0 +1,8 @@ +The package fmt provides CMake targets: + + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt) + + # Or use the header-only version + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt-header-only) diff --git a/cmake/vcpkg/ports/fmt/vcpkg.json b/cmake/vcpkg/ports/fmt/vcpkg.json new file mode 100644 index 00000000..4d591195 --- /dev/null +++ b/cmake/vcpkg/ports/fmt/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "fmt", + "version": "11.2.0", + "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", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/template/cmake/vcpkg/ports/fmt/fix-write-batch.patch b/template/cmake/vcpkg/ports/fmt/fix-write-batch.patch new file mode 100644 index 00000000..6bec3b8e --- /dev/null +++ b/template/cmake/vcpkg/ports/fmt/fix-write-batch.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 88c12148..967b53dd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -260,7 +260,7 @@ if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio") + join(netfxpath + "C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\" + ".NETFramework\\v4.0") +- file(WRITE run-msbuild.bat " ++ file(WRITE "${CMAKE_BINARY_DIR}/run-msbuild.bat" " + ${MSBUILD_SETUP} + ${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*") + endif () diff --git a/template/cmake/vcpkg/ports/fmt/portfile.cmake b/template/cmake/vcpkg/ports/fmt/portfile.cmake new file mode 100644 index 00000000..3058d1cf --- /dev/null +++ b/template/cmake/vcpkg/ports/fmt/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO fmtlib/fmt + REF "${VERSION}" + SHA512 46974efd36e613477351aa357c451cee434da797c2a505f9f86d73e394dcb35dc2dc0cda66abb98c023e8f24deac9d8e3ee6f9f6c0971cc4c00e37c34aa7f15f + HEAD_REF master + PATCHES + fix-write-batch.patch +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DFMT_CMAKE_DIR=share/fmt + -DFMT_TEST=OFF + -DFMT_DOC=OFF +) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup() +vcpkg_fixup_pkgconfig() +vcpkg_copy_pdbs() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fmt/base.h" + "defined(FMT_SHARED)" + "1" + ) +endif() + +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/share" +) + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/template/cmake/vcpkg/ports/fmt/usage b/template/cmake/vcpkg/ports/fmt/usage new file mode 100644 index 00000000..e5a9d704 --- /dev/null +++ b/template/cmake/vcpkg/ports/fmt/usage @@ -0,0 +1,8 @@ +The package fmt provides CMake targets: + + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt) + + # Or use the header-only version + find_package(fmt CONFIG REQUIRED) + target_link_libraries(main PRIVATE fmt::fmt-header-only) diff --git a/template/cmake/vcpkg/ports/fmt/vcpkg.json b/template/cmake/vcpkg/ports/fmt/vcpkg.json new file mode 100644 index 00000000..4d591195 --- /dev/null +++ b/template/cmake/vcpkg/ports/fmt/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "fmt", + "version": "11.2.0", + "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", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} diff --git a/template/vcpkg.json.jinja b/template/vcpkg.json.jinja index 215bc5c9..a1c14eb6 100644 --- a/template/vcpkg.json.jinja +++ b/template/vcpkg.json.jinja @@ -22,12 +22,11 @@ [%- if compile_target != '' or exe_target != '' or header_target != '' %] { "name": "fmt", - "version": "10.2.1", - "port-version": 2 + "version": "11.2.0" }, { "name": "spdlog", - "version": "1.13.0" + "version": "1.15.2" }, [%- endif %] [%- if use_conan == true %] diff --git a/vcpkg.json b/vcpkg.json index feb71df9..92d8090e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -13,12 +13,11 @@ "overrides": [ { "name": "fmt", - "version": "10.2.1", - "port-version": 2 + "version": "11.2.0" }, { "name": "spdlog", - "version": "1.13.0" + "version": "1.15.2" }, { "name": "cmake-modules",