The file ReadMe.txt in a Build bundle describes how to install the library on the platform. ReadMe.txt also documents how to compile and link code on the platform.
The file ReadMe.txt in a Build bundle describes how to install the library on the platform. ReadMe.txt also documents how to compile and link code on the platform.
[TOC](#TOC)
[TOC](#TOC)
<nameid="2">
<divid="2">
## 2 Building, Installing, Using and Uninstalling Exiv2
## 2 Building, Installing, Using and Uninstalling Exiv2
You need CMake to build Exiv2: https://cmake.org/download/
You need [CMake](https://cmake.org/download/) to configure the Exiv2 project and a C++11 compiler.
<divid="2-1">
<nameid="2-1">
### 2.1 Build, Install, Use Exiv2 on a UNIX-like system
### 2.1 Build, Install, Use, Uninstall Exiv2 on a UNIX-like system
```bash
```bash
$ cd <exiv2dir> ; mkdir build ; cd build
cd $EXIV_ROOT
$ cmake .. -G "Unix Makefiles" ; cmake --build . ; make test
mkdir build && cd build
$ sudo make install
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
make test
sudo make install
```
```
This will install the library into the "standard locations". The library will be installed in `/usr/local/lib`, executables (including the exiv2 command-line program) in `/usr/local/bin/` and header files in `/usr/local/include/exiv2`
This will install the library into the "standard locations". The library will be installed in `/usr/local/lib`, executables (including the exiv2 command-line program) in `/usr/local/bin/` and header files in `/usr/local/include/exiv2`
The following Exiv2 features are enabled by default and require external libraries. You can disable the dependency with CMake options:
The following Exiv2 features are enabled by default and require external libraries. You can disable the dependency with CMake options:
@ -136,7 +142,10 @@ The following Exiv2 features are enabled by default and require external librari
| Native language support | gettext | -DEXIV2\_ENABLE\_NLS=Off | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) |
| Native language support | gettext | -DEXIV2\_ENABLE\_NLS=Off | [http://www.gnu.org/software/gettext/](http://www.gnu.org/software/gettext/) |
| XMP support | expat | -DEXIV2\_ENABLE\_XMP=Off | [http://expat.sourceforge.net](http://expat.sourceforge.net)/<br/>Use _**Expat 2.2.6**_ and later |
| XMP support | expat | -DEXIV2\_ENABLE\_XMP=Off | [http://expat.sourceforge.net](http://expat.sourceforge.net)/<br/>Use _**Expat 2.2.6**_ and later |
On Linux, you may install the dependencies using the distribution's package management system. Install the development package of a dependency to install the header files and static libraries required to build Exiv2.
On UNIX systems, you may install the dependencies using the distribution's package management system. Install the
development package of a dependency to install the header files and libraries required to build Exiv2. In the file
`ci/install_dependencies.sh` you can check to the list of packages we install on different Linux distributions. This
file is used to setup some CI images in which we try out the Exiv2 compilation.
Notes about different platforms are included in this document: [Platform Notes](#5)
Notes about different platforms are included in this document: [Platform Notes](#5)
@ -144,24 +153,26 @@ You may choose to install dependences with conan. This is supported on all plat
See [README-CONAN](README-CONAN.md) for more information.
See [README-CONAN](README-CONAN.md) for more information.
[TOC](#TOC)
[TOC](#TOC)
<nameid="2-5">
<divid="2-5">
### 2.5 Building and linking your code with Exiv2
### 2.5 Building and linking your code with Exiv2
There are detailed platform notes about linking code in releasenotes/platform/ReadMe.txt
There are detailed platform notes about compiling and linking in `releasenotes/{platform}/ReadMe.txt`
platform: { CYGWIN| Darwin | Linux | MinGW | msvc }
where `platform: { CYGWIN| Darwin | Linux | MinGW | msvc }`
In general you need to do the following:
In general you need to do the following:
1) Application code should be written in C++98 and include exiv2 headers:
1) Application code should be written in C++98 and include exiv2 headers:
```C++
```C++
#include<exiv2/exiv2.hpp>
#include<exiv2/exiv2.hpp>
```
```
2 Compile your C++ code with the directive: **`-I/usr/local/include`**
2) Compile your C++ code with the directive: **`-I/usr/local/include`**
3 Link your code with libexiv2 using the linker options: **`-lexiv2`** and **`-L/usr/local/lib`**
3) Link your code with libexiv2 using the linker options: **`-lexiv2`** and **`-L/usr/local/lib`**
The following is a typical command to build and link with libexiv2:
The following is a typical command to build and link with libexiv2:
The default cmake Generator is usually appropriate for your platform. Additional information concerning Generators for Visual Studio in [README-CONAN](README-CONAN.md)
This [repository](https://github.com/piponazo/exiv2Consumer) shows an example of how to consume Exiv2 with CMake.
[TOC](#TOC)
[TOC](#TOC)
<nameid="2-7">
<divid="2-7">
### 2.7 Using pkg-config to compile and link your code with Exiv2
### 2.7 Using pkg-config to compile and link your code with Exiv2
When exiv2 is installed, the file exiv2.pc used by pkg-config is installed in `${CMAKE_INSTALL_PREFIX}/lib/pkgconfig` You will need to set the following in your environment:
When exiv2 is installed, the file exiv2.pc used by pkg-config is installed in `${CMAKE_INSTALL_PREFIX}/lib/pkgconfig` You will need to set the following in your environment:
You must install the library to ensure that your code is linked to the debug library.
You must install the library to ensure that your code is linked to the debug library.
@ -452,7 +473,8 @@ The following are some of the valid targets for this Makefile:
```
```
[TOC](#TOC)
[TOC](#TOC)
<nameid="2-12">
<divid="2-12">
### 2.12 Building Exiv2 with **clang** and other build chains
### 2.12 Building Exiv2 with **clang** and other build chains
1) On Linux
1) On Linux
@ -489,7 +511,8 @@ I have been unable to get clang to work on any of those platforms.
I've never succeeded in getting this to work. I use different VMs for Linux 32 and 64 bit. I've documented how to set up Cygwin and MinGW/msys2 for 64 and 32 bit builds in [README-CONAN](README-CONAN.md)
I've never succeeded in getting this to work. I use different VMs for Linux 32 and 64 bit. I've documented how to set up Cygwin and MinGW/msys2 for 64 and 32 bit builds in [README-CONAN](README-CONAN.md)
[TOC](#TOC)
[TOC](#TOC)
<nameid="2-13">
<divid="2-13">
### 2.13 Building Exiv2 with ccache
### 2.13 Building Exiv2 with ccache
To speed up compilation, the utility ccache can be installed to cache the output of the compiler. This greatly speeds up the build when you frequently built code that has not been modified.
To speed up compilation, the utility ccache can be installed to cache the output of the compiler. This greatly speeds up the build when you frequently built code that has not been modified.
@ -515,45 +538,50 @@ $ make
Due to the way in which ccache is installed in Fedora (and other Linux distros), ccache effectively replaces the compiler. A default build or **-DBUILD\_WITH\_CCACHE=Off** is not effective and the environment variable CCACHE_DISABLE is required to disable ccache. [https://github.com/Exiv2/exiv2/issues/361](https://github.com/Exiv2/exiv2/issues/361)
Due to the way in which ccache is installed in Fedora (and other Linux distros), ccache effectively replaces the compiler. A default build or **-DBUILD\_WITH\_CCACHE=Off** is not effective and the environment variable CCACHE_DISABLE is required to disable ccache. [https://github.com/Exiv2/exiv2/issues/361](https://github.com/Exiv2/exiv2/issues/361)
[TOC](#TOC)
[TOC](#TOC)
<nameid="3">
<divid="3">
## 3 License and Support
## 3 License and Support
All project resources are accessible from the project website.
All project resources are accessible from the project website.
https://github.com/Exiv2/exiv2
https://github.com/Exiv2/exiv2
<nameid="3-1">
<divid="3-1">
### 3.1 License
### 3.1 License
Copyright (C) 2004-2018 Exiv2 authors.
Copyright (C) 2004-2019 Exiv2 authors.
You should have received a copy of the file [license.txt](license.txt) which details the GPLv2 license.
You should have received a copy of the file [COPYING](COPYING) which details the GPLv2 license.
Exiv2 is free software; you can redistribute it and/or modify it under
Exiv2 is free software; you can redistribute it and/or modify
the terms of the GNU General Public License as published by the Free
it under the terms of the GNU General Public License as published by
Software Foundation; either version 2 of the License, or (at your
the Free Software Foundation; either version 2 of the License, or
option) any later version.
(at your option) any later version.
Exiv2 is distributed in the hope that it will be useful, but WITHOUT
Exiv2 program is distributed in the hope that it will be useful,
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
but WITHOUT ANY WARRANTY; without even the implied warranty of
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
for more details.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, 5th Floor, Boston,
MA 02110-1301 USA.
[TOC](#TOC)
[TOC](#TOC)
<nameid="3-2">
<divid="3-2">
### 3.2 Support
### 3.2 Support
For new bug reports and feature requests, please open an issue in Github.
For new bug reports and feature requests, please open an issue in Github.
[TOC](#TOC)
[TOC](#TOC)
<nameid="4">
<divid="4">
## 4 Running the test suite
## 4 Running the test suite
The test suite is a mix of bash and python scripts. The python scripts are new to v0.27 and the bash scripts are being replaced as time permits.
The test suite is a mix of bash and python scripts. The python scripts are new to v0.27 and the bash scripts are being replaced as time permits.
Use the bash interpreter for MinGW/msys2 to run the test suite. It's essential to have a DOS Python3 interpreter on your path called `python3.exe` The variables EXIV2\_BINDIR and EXIV2\_EXT enable the test suite to locate the MSVC build artifacts.
Use the bash interpreter for MinGW/msys2 to run the test suite. It's essential to have a DOS Python3 interpreter on your path called `python3.exe` The variables EXIV2\_BINDIR and EXIV2\_EXT enable the test suite to locate the MSVC build artifacts.
@ -604,12 +633,13 @@ $ ./icc-test.sh
```
```
[TOC](#TOC)
[TOC](#TOC)
<nameid="4-3">
<divid="4-3">
### 4.3 Unit tests
### 4.3 Unit tests
The code for the unit tests is in `<exiv2dir>/unitTests`
The code for the unit tests is in `<exiv2dir>/unitTests`
To build the unit tests, use the *cmake* option **`-DEXIV2_BUILD_UNIT_TESTS=On`**.
To build the unit tests, use the *cmake* option `-DEXIV2_BUILD_UNIT_TESTS=ON`.
To execute the unit tests:
To execute the unit tests:
@ -621,12 +651,14 @@ $ bin/unit_tests
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
There is a discussion on the web about installing GTest: [https://github.com/Exiv2/exiv2/issues/575](https://github.com/Exiv2/exiv2/issues/575)
[TOC](#TOC)
[TOC](#TOC)
<nameid="5">
<divid="5">
## 5 Platform Notes
## 5 Platform Notes
There are many ways to set up and configure your platform. The following notes are provided as a guide.
There are many ways to set up and configure your platform. The following notes are provided as a guide.
<nameid="5-1">
<divid="5-1">
### 5.1 Linux
### 5.1 Linux
Update your system and install the build tools and dependencies (zlib, expat, gtest and others)
Update your system and install the build tools and dependencies (zlib, expat, gtest and others)
@ -649,7 +681,8 @@ $ make
```
```
[TOC](#TOC)
[TOC](#TOC)
<nameid="5-2">
<divid="5-2">
### 5.2 MacOS-X
### 5.2 MacOS-X
You will need to install Xcode and the Xcode command-line tools to build on the Mac.
You will need to install Xcode and the Xcode command-line tools to build on the Mac.
@ -659,7 +692,8 @@ You should build and install libexpat and zlib. You may use brew, macports, bui
I recommend that you build and install CMake from source.
I recommend that you build and install CMake from source.
[TOC](#TOC)
[TOC](#TOC)
<nameid="5-3">
<divid="5-3">
### 5.3 MinGW
### 5.3 MinGW
We provide support for both 64bit and 32bit builds using MinGW/msys2. [https://www.msys2.org](https://www.msys2.org)
We provide support for both 64bit and 32bit builds using MinGW/msys2. [https://www.msys2.org](https://www.msys2.org)
@ -682,6 +716,7 @@ set "HOME=c:\msys64\home\%USERNAME%"
if NOT EXIST %HOME% mkdir %HOME%
if NOT EXIST %HOME% mkdir %HOME%
cd %HOME%
cd %HOME%
c:\msys64\usr\bin\bash.exe -norc
c:\msys64\usr\bin\bash.exe -norc
```
```
#### MinGW/msys2 32 bit
#### MinGW/msys2 32 bit
@ -698,6 +733,7 @@ set "HOME=c:\msys32\home\%USERNAME%"
if NOT EXIST %HOME% mkdir %HOME%
if NOT EXIST %HOME% mkdir %HOME%
cd %HOME%
cd %HOME%
c:\msys32\usr\bin\bash.exe -norc
c:\msys32\usr\bin\bash.exe -norc
```
```
#### Install MinGW Dependencies
#### Install MinGW Dependencies
@ -738,7 +774,8 @@ $
```
```
[TOC](#TOC)
[TOC](#TOC)
<nameid="5-4">
<divid="5-4">
### 5.4 Cygwin
### 5.4 Cygwin
Download: [https://cygwin.com/install.html](https://cygwin.com/install.html) and run setup-x86_64.exe for 64 Bit Cygwin, or setup-x86.exe for 32 bit Cygwin. I install into c:\\cygwin64 and c:\\cygwin32
Download: [https://cygwin.com/install.html](https://cygwin.com/install.html) and run setup-x86_64.exe for 64 Bit Cygwin, or setup-x86.exe for 32 bit Cygwin. I install into c:\\cygwin64 and c:\\cygwin32
@ -766,11 +803,13 @@ set "PS1=\! CYGWIN64:\u@\h:\w \$ "
bash.exe -norc
bash.exe -norc
```
```
[TOC](#TOC)
[TOC](#TOC)
<nameid="5-5">
<divid="5-5">
### 5.5 Microsoft Visual C++
### 5.5 Microsoft Visual C++
We recommend that you use Conan to build Exiv2 using Microsoft Visual C++. For v0.27, we support Visual Studio 2008, 2010, 2012, 2013, 2015 and 2017.
We recommend that you use Conan to build Exiv2 using Microsoft Visual C++. Exiv2 v0.27 can be built with Visual Studio versions 2008 and later. We actively support and build with Visual Studio 2015, 2017 and 2019.
As well as Microsoft Visual Studio, you will need to install CMake, Python3, and Conan.
As well as Microsoft Visual Studio, you will need to install CMake, Python3, and Conan.
@ -784,10 +823,12 @@ I use the following batch file to start cmd.exe. I do this to reduce the comple
@echo off
@echo off
setlocal
setlocal
cd %HOMEPATH%
cd %HOMEPATH%
set "PATH=C:\Python34\;C:\Python27\;C:\Python27\Scripts;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;c:\Program Files\cmake\bin;"
set "PATH=C:\Python37\;C:\Python27\;C:\Python27\Scripts;C:\Perl64\site\bin;C:\Perl64\bin;C:\WINDOWS\system32;C:\Program Files\Git\cmd;C:\Program Files\Git\usr\bin;c:\Program Files\cmake\bin;"
cmd
cmd
```
```
[TOC](#TOC)
[TOC](#TOC)
Written by Robin Mills<br>robin@clanmills.com<br>Revised: 2019-04-18