From f7cf18adfcb4b9bff088cd788fcd7a16d05a3b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milo=C5=A1=20Komar=C4=8Devi=C4=87?= Date: Fri, 12 Apr 2024 15:26:07 +0200 Subject: [PATCH] Add UTF-8 resource manifest to app and samples --- app/CMakeLists.txt | 14 ++++++++++---- app/utf8.manifest | 8 ++++++++ app/utf8.rc | 3 +++ samples/CMakeLists.txt | 9 +++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 app/utf8.manifest create mode 100644 app/utf8.rc diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index b22a17db16..4334743bb2 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,16 +1,22 @@ set(APP_SOURCES exiv2.cpp - exiv2app.hpp actions.cpp - actions.hpp getopt.cpp - getopt.hpp app_utils.cpp - app_utils.hpp ) add_executable(exiv2 ${APP_SOURCES}) +# Make app use UTF-8 code page in Windows +if(WIN32) + if(MSVC) + target_sources(exiv2 PRIVATE utf8.manifest) + else() + # Must wrap manifest in .rc w/ other toolchains + target_sources(exiv2 PRIVATE utf8.rc) + endif() +endif() + target_include_directories(exiv2 PRIVATE ${PROJECT_SOURCE_DIR}/src) # To find i18n.hpp set_target_properties(exiv2 PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS} XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES") diff --git a/app/utf8.manifest b/app/utf8.manifest new file mode 100644 index 0000000000..f205604931 --- /dev/null +++ b/app/utf8.manifest @@ -0,0 +1,8 @@ + + + + + UTF-8 + + + \ No newline at end of file diff --git a/app/utf8.rc b/app/utf8.rc new file mode 100644 index 0000000000..b4cca2abbe --- /dev/null +++ b/app/utf8.rc @@ -0,0 +1,3 @@ +#include + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "utf8.manifest" diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 6d4430ce84..843f763daa 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -107,6 +107,15 @@ list(APPEND APPLICATIONS remotetest) # ****************************************************************************** foreach(application ${APPLICATIONS}) + # Make app use UTF-8 code page in Windows + if(WIN32) + if(MSVC) + target_sources(${application} PRIVATE ${PROJECT_SOURCE_DIR}/app/utf8.manifest) + else() + # Must wrap manifest in .rc w/ other toolchains + target_sources(${application} PRIVATE ${PROJECT_SOURCE_DIR}/app/utf8.rc) + endif() + endif() target_link_libraries(${application} PRIVATE exiv2lib std::filesystem) if(EXIV2_ENABLE_PNG) target_link_libraries(${application} PRIVATE ${ZLIB_LIBRARIES})