Skip to content

Commit

Permalink
Merge pull request #580 from Kicer86/exiv2
Browse files Browse the repository at this point in the history
Require exiv2 0.28.0
  • Loading branch information
Kicer86 authored May 10, 2024
2 parents 96c935b + 1486ee7 commit 664db9a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 42 deletions.
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ include(CTest)
include(${PROJECT_SOURCE_DIR}/cmake/functions.cmake)
include(${PROJECT_SOURCE_DIR}/cmake_modules/DeveloperTools.cmake)

if(MSVC_VERSION)
#enable auto_ptr. Disabled by VS for c++17 but required by exiv 0.27
add_definitions(-D_HAS_AUTO_PTR_ETC=1)
add_compile_options(/wd4251)
elseif(APPLE)
#enable auto_ptr. Disabled by clang on MacOS for c++17 but required by exiv 0.27
add_definitions(-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
endif()

#objdump
if(ENABLE_OBJDUMPING)
add_custom_target(DumpObjs ALL)
Expand Down
7 changes: 6 additions & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@

find_package(OpenCV REQUIRED)
find_package(OpenCV REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Multimedia)
find_package(exiv2 REQUIRED)
find_package(Threads REQUIRED)
find_package(CsLibGuarded REQUIRED)

include(GenerateExportHeader)

if(exiv2_VERSION VERSION_LESS 0.28.1)
message(FATAL_ERROR "Exiv2 0.28.1 or higher is required")
endif()


if(TARGET Exiv2::exiv2lib)
set(EXIV2_LIB Exiv2::exiv2lib)
else()
Expand Down
33 changes: 1 addition & 32 deletions src/core/implementation/exiv2_exif_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@
#include "aexif_reader.hpp"


template<typename, typename = void>
struct has_auto_ptr_type : std::false_type
{
using ptr_type = int;
};

template<typename T>
struct has_auto_ptr_type<T, std::void_t<typename T::AutoPtr>> : std::true_type
{
using ptr_type = typename T::AutoPtr;
};

template<typename, typename = void>
struct has_unique_ptr_type : std::false_type
{
using ptr_type = int;
};

template<typename T>
struct has_unique_ptr_type<T, std::void_t<typename T::UniquePtr>> : std::true_type
{
using ptr_type = typename T::UniquePtr;
};

template <typename T>
struct Exiv2Helper
{
using Ptr = typename std::conditional<has_unique_ptr_type<T>::value, typename has_unique_ptr_type<T>::ptr_type, typename has_auto_ptr_type<T>::ptr_type>::type;
};


class Exiv2ExifReader final: public AExifReader
{
public:
Expand All @@ -56,7 +25,7 @@ class Exiv2ExifReader final: public AExifReader
virtual void collect(const QString &) override;
virtual std::optional<std::string> read(TagType) const override;

Exiv2Helper<Exiv2::Image>::Ptr m_exif_data;
Exiv2::Image::UniquePtr m_exif_data;
QString m_path;
};

Expand Down

0 comments on commit 664db9a

Please sign in to comment.