From 90227b11cf430e49d5e0bcc9fe3ff51daf0a1d32 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 5 Oct 2024 07:58:39 +0100 Subject: [PATCH 1/4] Update libfmt --- 3rdParty/libfmt/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdParty/libfmt/CMakeLists.txt b/3rdParty/libfmt/CMakeLists.txt index 2a6c24d181c..7721c1ae3ab 100644 --- a/3rdParty/libfmt/CMakeLists.txt +++ b/3rdParty/libfmt/CMakeLists.txt @@ -16,8 +16,8 @@ else() endif() include(FetchContent) FetchContent_Declare(libfmt - URL https://github.com/fmtlib/fmt/archive/92227c77a4eed4c12f97f7916041ace4d5ca02d4.tar.gz - URL_HASH MD5=a60bc215a81a4ba770a7c1936311612f + URL https://github.com/fmtlib/fmt/archive/02537548f3a9efb5f3b83755acf50c8a16ba58c8.tar.gz + URL_HASH MD5=6901c6945cd311117d96baaa6d067380 ) FetchContent_MakeAvailableExcludeFromAll(libfmt) From ab5930bbe989d8a42255b6903ce2a45af1946141 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 5 Oct 2024 08:03:46 +0100 Subject: [PATCH 2/4] libfmt: FMT_BUILTIN_TYPES=0 on rg99 --- 3rdParty/libfmt/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/3rdParty/libfmt/CMakeLists.txt b/3rdParty/libfmt/CMakeLists.txt index 7721c1ae3ab..0ec1feca4dc 100644 --- a/3rdParty/libfmt/CMakeLists.txt +++ b/3rdParty/libfmt/CMakeLists.txt @@ -24,3 +24,8 @@ FetchContent_MakeAvailableExcludeFromAll(libfmt) if(DEVILUTIONX_WINDOWS_NO_WCHAR) target_compile_definitions(fmt PUBLIC FMT_USE_WRITE_CONSOLE) endif() + +# Reduces the overall binary size by 8 KiB. +if(TARGET_PLATFORM STREQUAL "rg99") + target_compile_definitions(fmt PUBLIC FMT_BUILTIN_TYPES=0) +endif() From 656ef6212870123ba33eb03e943a94070f7a1243 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 5 Oct 2024 08:40:24 +0100 Subject: [PATCH 3/4] libfmt: Set FMT_USE_LOCALE=0 --- 3rdParty/libfmt/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/3rdParty/libfmt/CMakeLists.txt b/3rdParty/libfmt/CMakeLists.txt index 0ec1feca4dc..1eea3540f00 100644 --- a/3rdParty/libfmt/CMakeLists.txt +++ b/3rdParty/libfmt/CMakeLists.txt @@ -21,6 +21,9 @@ FetchContent_Declare(libfmt ) FetchContent_MakeAvailableExcludeFromAll(libfmt) +# We do not use locale-specific features of libfmt and disabling them reduces the size. +target_compile_definitions(fmt PUBLIC FMT_USE_LOCALE=0) + if(DEVILUTIONX_WINDOWS_NO_WCHAR) target_compile_definitions(fmt PUBLIC FMT_USE_WRITE_CONSOLE) endif() From 04ecccb6db491413bb4fec87d8f95797f76cabfd Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sat, 5 Oct 2024 09:10:23 +0100 Subject: [PATCH 4/4] Set FMT_USE_FALLBACK_FILE=1 on some platforms These platforms incorrectly declare but do not define `f(un)lockfile`. `FMT_USE_FALLBACK_FILE=1` prevents libfmt from trying to use these functions. --- 3rdParty/libfmt/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/3rdParty/libfmt/CMakeLists.txt b/3rdParty/libfmt/CMakeLists.txt index 1eea3540f00..6269400c05a 100644 --- a/3rdParty/libfmt/CMakeLists.txt +++ b/3rdParty/libfmt/CMakeLists.txt @@ -32,3 +32,8 @@ endif() if(TARGET_PLATFORM STREQUAL "rg99") target_compile_definitions(fmt PUBLIC FMT_BUILTIN_TYPES=0) endif() + +# https://github.com/fmtlib/fmt/issues/4189 +if(NINTENDO_3DS OR NINTENDO_SWITCH OR VITA) + target_compile_definitions(fmt PUBLIC FMT_USE_FALLBACK_FILE=1) +endif()