October 29th 2014, Exiv2 Revisited
← October 21th 2014 libexif | ● | October 30th 2014 Geo-Tagging with libexiv2 →
In order to manipulate EXIF tags on Android, we need to add libexiv2 to the package:
We need to add the libexiv2 source modules directly to the QMake build, since otherwise the Android libraries need to be prepared manually for deployment. We could do so, by using the Android NDK’s cross-compiler, but there’s no straight-forward supporting mechanism for that in QtCreator.
If we add the libexiv2 library as source modules, then off course the usual automake configuration step cannot be applied. So we need to take care of the configuration manually. Further dependencies must be also included, so we would like to build libexiv2 with a minimal set of dependencies. Fortunately, we can configure the library to build without its dependencies libexpat and zlib. On the other hand, zlib is already part of the standard Qt libraries, so we only have to get rid of libexpat with the following configuration line:
./configure --enable-static --disable-shared --disable-lensdata --disable-xmp
Now, configuring libexiv2 manually is not terribly difficult, we just use the following manually tailored exv_config.h file, which will work on most platforms using the g++:
#define EXV_HAVE_DECL_STRERROR_R 1 #define EXV_HAVE_GMTIME_R 1 #define EXV_HAVE_LIBINTL_H 1 #define EXV_HAVE_LIBINTL_H 1 #define EXV_HAVE_MALLOC_H 1 #define EXV_HAVE_MEMORY_H 1 #define EXV_HAVE_MEMSET 1 #define EXV_HAVE_REALLOC 1 #define EXV_HAVE_STDBOOL_H 1 #define EXV_HAVE_STDINT_H 1 #define EXV_HAVE_STDLIB_H 1 #define EXV_HAVE_STRCHR 1 #define EXV_HAVE_STRERROR 1 #define EXV_HAVE_STRERROR_R 1 #define EXV_HAVE_STRINGS_H 1 #define EXV_HAVE_STRING_H 1 #define EXV_HAVE_STRTOL 1 #define EXV_HAVE_MMAP 1 #define EXV_HAVE_MUNMAP 1 #define EXV_HAVE_SYS_STAT_H 1 #define EXV_HAVE_SYS_TIME_H 1 #define EXV_HAVE_SYS_TYPES_H 1 #define EXV_HAVE_UNISTD_H 1 #define EXV_HAVE_VPRINTF 1 #define EXV_HAVE_WCHAR_H 1 #define EXV_HAVE_SYS_MMAN_H 1 #define EXV_HAVE_LIBZ 1 #define EXV_PACKAGE_BUGREPORT "ahuggel@gmx.net" #define EXV_PACKAGE "exiv2" #define EXV_PACKAGE_NAME "exiv2" #define EXV_PACKAGE_STRING "exiv2 0.24" #define EXV_PACKAGE_VERSION "0.24" #define STDC_HEADERS 1 #define STRERROR_R_CHAR_P 1 #define TIME_WITH_SYS_TIME 1 #define HAVE_PID_T 1 #define EXV_SEPERATOR_STR "/" #define EXV_SEPERATOR_CHR '/' #define EXV_IMPORT #define EXV_EXPORT #define EXV_DLLLOCAL #define EXV_DLLPUBLIC #define EXIV2API
Next, we create a “exiv2” directory in our source package, put the above config header in it and also put all the libexiv2 modules from the “src” directory in it, except exiv2.*, actions.*, util.*, tiff*-test.cpp, crwparse.cpp, crwedit.cpp, mrwthumb.cpp, xmpdump.cpp and getopt_win32.*.
We include these source modules into our package with the following qmake “exiv2.pri” file:
HEADERS += $$files(exiv2/*.h*) SOURCES += $$files(exiv2/*.c*) QMAKE_CFLAGS += -w QMAKE_CXXFLAGS += -w
← October 21th 2014 libexif | ● | October 30th 2014 Geo-Tagging with libexiv2 →