Repository: conan-io/conan-center-index

Issue:
[request] easyexif
### Package Details
  * Source code: **https://github.com/mayanklahiri/easyexif**


### Description Of The Library / Tool
Tiny ISO-compliant C++ EXIF parsing library


Discussion:

Resolving patch:
diff --git a/recipes/easyexif/all/conanfile.py b/recipes/easyexif/all/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/easyexif/all/conanfile.py
@@ -0,0 +1,58 @@
+import os
+from conans import CMake, ConanFile, tools
+
+class EasyExifConan(ConanFile):
+    name = "easyexif"
+    description = "Tiny ISO-compliant C++ EXIF parsing library, third-party dependency free."
+    topics = ("conan", "exif", "image", "multimedia", "format", "graphics")
+    url = "https://github.com/conan-io/conan-center-index"
+    homepage = "https://github.com/mayanklahiri/easyexif"
+    license = "BSD-2-Clause"
+    exports_sources = "CMakeLists.txt"
+    settings = "os", "compiler", "build_type", "arch"
+    options = {
+        "shared": [True, False],
+        "fPIC": [True, False]
+    }
+    default_options = {"shared": False, "fPIC": True}
+    generators = "cmake"
+    
+    _cmake = None
+
+    @property
+    def _source_subfolder(self):
+        return "source_subfolder"
+
+    def config_options(self):
+        if self.settings.os == "Windows":
+            del self.options.fPIC
+
+    def configure(self):
+        if self.options.shared:
+            del self.options.fPIC
+        if self.settings.compiler.cppstd:
+            tools.check_min_cppstd(self, 11)
+
+    def source(self):
+        tools.get(**self.conan_data["sources"][self.version])
+        extracted_dir = self.name + "-" + self.version
+        os.rename(extracted_dir, self._source_subfolder)
+
+    def _configure_cmake(self):
+        if self._cmake:
+            return self._cmake
+        self._cmake = CMake(self)
+        self._cmake.configure()
+        return self._cmake
+
+    def build(self):
+        cmake = self._configure_cmake()
+        cmake.build()
+
+    def package(self):
+        cmake = self._configure_cmake()
+        cmake.install()
+        self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
+
+    def package_info(self):
+        self.cpp_info.libs = ["easyexif"]


Test patch:
diff --git a/recipes/easyexif/all/test_package/CMakeLists.txt b/recipes/easyexif/all/test_package/CMakeLists.txt
new file mode 100644
--- /dev/null
+++ b/recipes/easyexif/all/test_package/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.1)
+project(PackageTest CXX)
+
+include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+conan_basic_setup()
+
+add_executable(example example.cpp)
+
+set_target_properties(example PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
+target_link_libraries(example ${CONAN_LIBS})
diff --git a/recipes/easyexif/all/test_package/conanfile.py b/recipes/easyexif/all/test_package/conanfile.py
new file mode 100644
--- /dev/null
+++ b/recipes/easyexif/all/test_package/conanfile.py
@@ -0,0 +1,17 @@
+import os
+from conans import ConanFile, CMake, tools
+
+
+class SolaceTestConan(ConanFile):
+    settings = "os", "compiler", "build_type", "arch"
+    generators = "cmake"
+
+    def build(self):
+        cmake = CMake(self)
+        cmake.configure()
+        cmake.build()
+
+    def test(self):
+        if not tools.cross_building(self.settings):
+            bin_path = os.path.join("bin", "example")
+            self.run(bin_path, run_environment=True)
diff --git a/recipes/easyexif/all/test_package/example.cpp b/recipes/easyexif/all/test_package/example.cpp
new file mode 100644
--- /dev/null
+++ b/recipes/easyexif/all/test_package/example.cpp
@@ -0,0 +1,7 @@
+#include "easyexif/exif.h"
+
+int main() {
+  easyexif::EXIFInfo exif_info;
+  exif_info.clear();
+  return 0;
+}