easymodo / qimgv

Image viewer. Fast, easy to use. Optional video support.
GNU General Public License v3.0
2.3k stars 160 forks source link

Failed to build with exiv2 v0.28.0 #534

Open eddiezato opened 5 months ago

eddiezato commented 5 months ago

Environment msys2/ucrt64 Exiv2 v0.28.0 dropped EXIV2_ENABLE_WIN_UNICODE. So solution from #331 doesn't work now.

FAILED: qimgv/CMakeFiles/qimgv.dir/sourcecontainers/documentinfo.cpp.obj
D:\msys2\ucrt64\bin\clang++.exe -DMINGW_HAS_SECURE_API=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_OPENGLWIDGETS_LIB -DQT_OPENGL_LIB -DQT_PRINTSUPPORT_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DUNICODE -DUSE_EXIV2 -DUSE_OPENCV -DWIN32 -DWIN64 -DWINVER=0x0A00 -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_UNICODE -D_WIN32_WINNT=0x0A00 -D_WIN64 -ID:/msys2/home/Gautama/ucrt/qimgv/build/qimgv -ID:/msys2/home/Gautama/ucrt/qimgv/qimgv -ID:/msys2/home/Gautama/ucrt/qimgv/build/qimgv/qimgv_autogen/include -isystem D:/msys2/ucrt64/include/qt6/QtCore -isystem D:/msys2/ucrt64/include/qt6 -isystem D:/msys2/ucrt64/share/qt6/mkspecs/win32-g++ -isystem D:/msys2/ucrt64/include/qt6/QtWidgets -isystem D:/msys2/ucrt64/include/qt6/QtGui -isystem D:/msys2/ucrt64/include/qt6/QtSvg -isystem D:/msys2/ucrt64/include/qt6/QtPrintSupport -isystem D:/msys2/ucrt64/include/qt6/QtOpenGLWidgets -isystem D:/msys2/ucrt64/include/qt6/QtOpenGL -isystem D:/msys2/home/Gautama/ucrt/install/include -Wno-shift-negative-value -O3 -DNDEBUG -MD -MT qimgv/CMakeFiles/qimgv.dir/sourcecontainers/documentinfo.cpp.obj -MF qimgv\CMakeFiles\qimgv.dir\sourcecontainers\documentinfo.cpp.obj.d -o qimgv/CMakeFiles/qimgv.dir/sourcecontainers/documentinfo.cpp.obj -c D:/msys2/home/Gautama/ucrt/qimgv/qimgv/sourcecontainers/documentinfo.cpp
D:/msys2/home/Gautama/ucrt/qimgv/qimgv/sourcecontainers/documentinfo.cpp:196:17: error: no matching function for call to 'open'
  196 |         image = Exiv2::ImageFactory::open(toStdString(fileInfo.filePath()));
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~
D:/msys2/home/Gautama/ucrt/install/include/exiv2/image.hpp:539:27: note: candidate function not viable: no known conversion from 'basic_string<wchar_t>' to 'const basic_string<char>' for 1st argument
  539 |   static Image::UniquePtr open(const std::string& path, bool useCurl = true);
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~
D:/msys2/home/Gautama/ucrt/install/include/exiv2/image.hpp:570:27: note: candidate function not viable: no known conversion from 'std::wstring' (aka 'basic_string<wchar_t>') to 'BasicIo::UniquePtr' (aka 'unique_ptr<BasicIo>') for 1st argument
  570 |   static Image::UniquePtr open(BasicIo::UniquePtr io);
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~
D:/msys2/home/Gautama/ucrt/install/include/exiv2/image.hpp:552:27: note: candidate function not viable: requires 2 arguments, but 1 was provided
  552 |   static Image::UniquePtr open(const byte* data, size_t size);
      |                           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.
eddiezato commented 3 months ago

Ok, here are some of my discoveries: stuff.h

#ifdef _WIN32
    //#define StdString std::wstring
    //#define CharType wchar_t
    #define StdString std::string
    #define CharType char
#else
    #define StdString std::string
    #define CharType char
#endif

stuff.cpp

StdString toStdString(QString str) {
#ifdef _WIN32
    //return str.toStdWString();
    return str.toStdString();
#else
    return str.toStdString();
#endif
}

QString fromStdString(StdString str) {
#ifdef _WIN32
    //return QString::fromStdWString(str);
    return QString::fromStdString(str);
#else
    return QString::fromStdString(str);
#endif

With this I was able to build (msys2/ucrt64) with exiv2 v0.28.2, and qimgv can show exif for jxl's created with Brotli compression for metadata boxes (with 0.27-maintenance can't). And I don't see a problem with Cyrillic file names.