Skip to content

Commit a5d7652

Browse files
authored
perf: update spdlog and fmt (#526)
Signed-off-by: l.feng <[email protected]>
1 parent 0a57eda commit a5d7652

File tree

10 files changed

+156
-6
lines changed

10 files changed

+156
-6
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 88c12148..967b53dd 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -260,7 +260,7 @@ if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
6+
join(netfxpath
7+
"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\"
8+
".NETFramework\\v4.0")
9+
- file(WRITE run-msbuild.bat "
10+
+ file(WRITE "${CMAKE_BINARY_DIR}/run-msbuild.bat" "
11+
${MSBUILD_SETUP}
12+
${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*")
13+
endif ()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO fmtlib/fmt
4+
REF "${VERSION}"
5+
SHA512 46974efd36e613477351aa357c451cee434da797c2a505f9f86d73e394dcb35dc2dc0cda66abb98c023e8f24deac9d8e3ee6f9f6c0971cc4c00e37c34aa7f15f
6+
HEAD_REF master
7+
PATCHES
8+
fix-write-batch.patch
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}"
13+
OPTIONS
14+
-DFMT_CMAKE_DIR=share/fmt
15+
-DFMT_TEST=OFF
16+
-DFMT_DOC=OFF
17+
)
18+
19+
vcpkg_cmake_install()
20+
vcpkg_cmake_config_fixup()
21+
vcpkg_fixup_pkgconfig()
22+
vcpkg_copy_pdbs()
23+
24+
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
25+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fmt/base.h"
26+
"defined(FMT_SHARED)"
27+
"1"
28+
)
29+
endif()
30+
31+
file(REMOVE_RECURSE
32+
"${CURRENT_PACKAGES_DIR}/debug/include"
33+
"${CURRENT_PACKAGES_DIR}/debug/share"
34+
)
35+
36+
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
37+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

cmake/vcpkg/ports/fmt/usage

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The package fmt provides CMake targets:
2+
3+
find_package(fmt CONFIG REQUIRED)
4+
target_link_libraries(main PRIVATE fmt::fmt)
5+
6+
# Or use the header-only version
7+
find_package(fmt CONFIG REQUIRED)
8+
target_link_libraries(main PRIVATE fmt::fmt-header-only)

cmake/vcpkg/ports/fmt/vcpkg.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "fmt",
3+
"version": "11.2.0",
4+
"port-version": 1,
5+
"description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.",
6+
"homepage": "https://github.com/fmtlib/fmt",
7+
"license": "MIT",
8+
"dependencies": [
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
]
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 88c12148..967b53dd 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -260,7 +260,7 @@ if (FMT_MASTER_PROJECT AND CMAKE_GENERATOR MATCHES "Visual Studio")
6+
join(netfxpath
7+
"C:\\Program Files\\Reference Assemblies\\Microsoft\\Framework\\"
8+
".NETFramework\\v4.0")
9+
- file(WRITE run-msbuild.bat "
10+
+ file(WRITE "${CMAKE_BINARY_DIR}/run-msbuild.bat" "
11+
${MSBUILD_SETUP}
12+
${CMAKE_MAKE_PROGRAM} -p:FrameworkPathOverride=\"${netfxpath}\" %*")
13+
endif ()
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
vcpkg_from_github(
2+
OUT_SOURCE_PATH SOURCE_PATH
3+
REPO fmtlib/fmt
4+
REF "${VERSION}"
5+
SHA512 46974efd36e613477351aa357c451cee434da797c2a505f9f86d73e394dcb35dc2dc0cda66abb98c023e8f24deac9d8e3ee6f9f6c0971cc4c00e37c34aa7f15f
6+
HEAD_REF master
7+
PATCHES
8+
fix-write-batch.patch
9+
)
10+
11+
vcpkg_cmake_configure(
12+
SOURCE_PATH "${SOURCE_PATH}"
13+
OPTIONS
14+
-DFMT_CMAKE_DIR=share/fmt
15+
-DFMT_TEST=OFF
16+
-DFMT_DOC=OFF
17+
)
18+
19+
vcpkg_cmake_install()
20+
vcpkg_cmake_config_fixup()
21+
vcpkg_fixup_pkgconfig()
22+
vcpkg_copy_pdbs()
23+
24+
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
25+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/fmt/base.h"
26+
"defined(FMT_SHARED)"
27+
"1"
28+
)
29+
endif()
30+
31+
file(REMOVE_RECURSE
32+
"${CURRENT_PACKAGES_DIR}/debug/include"
33+
"${CURRENT_PACKAGES_DIR}/debug/share"
34+
)
35+
36+
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
37+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
The package fmt provides CMake targets:
2+
3+
find_package(fmt CONFIG REQUIRED)
4+
target_link_libraries(main PRIVATE fmt::fmt)
5+
6+
# Or use the header-only version
7+
find_package(fmt CONFIG REQUIRED)
8+
target_link_libraries(main PRIVATE fmt::fmt-header-only)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "fmt",
3+
"version": "11.2.0",
4+
"port-version": 1,
5+
"description": "{fmt} is an open-source formatting library providing a fast and safe alternative to C stdio and C++ iostreams.",
6+
"homepage": "https://github.com/fmtlib/fmt",
7+
"license": "MIT",
8+
"dependencies": [
9+
{
10+
"name": "vcpkg-cmake",
11+
"host": true
12+
},
13+
{
14+
"name": "vcpkg-cmake-config",
15+
"host": true
16+
}
17+
]
18+
}

template/vcpkg.json.jinja

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222
[%- if compile_target != '' or exe_target != '' or header_target != '' %]
2323
{
2424
"name": "fmt",
25-
"version": "10.2.1",
26-
"port-version": 2
25+
"version": "11.2.0"
2726
},
2827
{
2928
"name": "spdlog",
30-
"version": "1.13.0"
29+
"version": "1.15.2"
3130
},
3231
[%- endif %]
3332
[%- if use_conan == true %]

vcpkg.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313
"overrides": [
1414
{
1515
"name": "fmt",
16-
"version": "10.2.1",
17-
"port-version": 2
16+
"version": "11.2.0"
1817
},
1918
{
2019
"name": "spdlog",
21-
"version": "1.13.0"
20+
"version": "1.15.2"
2221
},
2322
{
2423
"name": "cmake-modules",

0 commit comments

Comments
 (0)