|
Packit |
01d647 |
![Exiv2](exiv2.png)
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
# Building Exiv2 and dependencies with conan
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Conan is a portable package manager for C/C++ libraries. It can be used to create all dependencies needed to build Exiv2, without needing to install system packages.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
This document provides a step-by-step guide to show you the basic usage of conan. For more details about the tool,
|
|
Packit |
01d647 |
please visit the [Conan documentation website](http://docs.conan.io/en/latest/).
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Although we provide step-by-step instructions to enable you to build Exiv2 with conan, we recommend that you read conan's documentation to understand the main concepts: [Getting started with Conan](http://docs.conan.io/en/latest/getting_started.html)
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
To build Exiv2 with conan, you will also need to install CMake. https://cmake.org/download/
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
_**We do not recommend using conan on MinGW, Cygwin, Unix or to cross compile from Linux to those platforms.**
|
|
Packit Service |
fb147c |
The build procedures for those platforms are discussed here: See [README.md](README.md)_
|
|
Packit Service |
fb147c |
|
|
Packit |
01d647 |
<name id="TOC">
|
|
Packit |
01d647 |
----
|
|
Packit Service |
fb147c |
### TABLE OF CONTENTS
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
1. [Step by Step Guide](#1)
|
|
Packit |
01d647 |
1. [Install conan](#1-1)
|
|
Packit |
01d647 |
2. [Test conan installation](#1-2)
|
|
Packit |
01d647 |
3. [Create a build directory](#1-3)
|
|
Packit Service |
fb147c |
4. [Build dependencies, create build environment, build and test](#1-4)
|
|
Packit |
01d647 |
2. [Platform Notes](#2)
|
|
Packit |
01d647 |
1. [Linux Notes](#2-1)
|
|
Packit |
01d647 |
2. [Visual Studio Notes](#2-2)
|
|
Packit |
01d647 |
3. [Conan Architecture](#3)
|
|
Packit |
01d647 |
1. [conanfile.py](#3-1)
|
|
Packit |
01d647 |
2. [Conan Recipes](#3-2)
|
|
Packit |
01d647 |
3. [Conan server search path](#3-3)
|
|
Packit |
01d647 |
4. [Configuring conan on your machine](#3-4)
|
|
Packit |
01d647 |
4. [Building Exiv2 with Adobe XMPsdk 2016](#4)
|
|
Packit |
01d647 |
1. [Add a remote directory to conan's recipe search path](#4-1)
|
|
Packit |
01d647 |
2. [Build dependencies and install conan artefacts in your build directory](#4-2)
|
|
Packit |
01d647 |
3. [Execute cmake to generate build files for your environment](#4-3)
|
|
Packit |
01d647 |
4. [Build Exiv2 and link Adobe XMPsdk library](#4-4)
|
|
Packit |
01d647 |
5. [Webready Support](#5)
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="1">
|
|
Packit |
01d647 |
----
|
|
Packit Service |
fb147c |
|
|
Packit |
01d647 |
# 1 Step by Step Guide
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="1-1">
|
|
Packit |
01d647 |
##### 1.1) Install conan:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ pip install conan
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
For other installation methods (brew, installers, from sources), visit this [link]([install
|
|
Packit |
01d647 |
conan](http://docs.conan.io/en/latest/installation.html)).
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
To upgrade the version of conan:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ pip install conan --upgrade
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="1-2">
|
|
Packit |
01d647 |
##### 1.2) Test conan installation
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan --version
|
|
Packit Service |
fb147c |
Conan version 1.23.0
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="1-3">
|
|
Packit |
01d647 |
##### 1.3) Create a build directory<name id="1-3">
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
Create a build directory and run the conan commands:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ mkdir build
|
|
Packit |
01d647 |
$ cd build
|
|
Packit |
01d647 |
$ conan profile list
|
|
Packit |
01d647 |
```
|
|
Packit Service |
fb147c |
_**Visual Studio Users**_
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
_The profile msvc2019Release `%USERPROFILE%\.conan\profiles\msvc2019Release` is:_
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```ini
|
|
Packit |
01d647 |
[build_requires]
|
|
Packit |
01d647 |
[settings]
|
|
Packit |
01d647 |
arch=x86_64
|
|
Packit |
01d647 |
build_type=Release
|
|
Packit |
01d647 |
compiler=Visual Studio
|
|
Packit |
01d647 |
compiler.runtime=MD
|
|
Packit Service |
fb147c |
compiler.version=16
|
|
Packit |
01d647 |
os=Windows
|
|
Packit |
01d647 |
arch_build=x86_64
|
|
Packit |
01d647 |
os_build=Windows
|
|
Packit |
01d647 |
[options]
|
|
Packit |
01d647 |
[env]
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
_Profiles for Visual Studio are discussed in detail here: [Visual Studio Notes](#2-2)__
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
<name id="1-4">
|
|
Packit Service |
fb147c |
##### 1.4) Build dependencies, create build environment, build and test
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
| | Build Steps | Linux and macOS | Visual Studio |
|
|
Packit Service |
fb147c |
|:--|:--------------|--------------------------------|------------------------------|
|
|
Packit Service |
fb147c |
| _**1**_ | Get conan to fetch dependencies
The output can be quite long as conan downloads and/or builds zlib, expat, curl and other dependencies.| $ conan install .. --build missing | c:\\..\\build> conan install .. --build missing --profile msvc2019Release |
|
|
Packit Service |
fb147c |
| _**2**_ | Get cmake to generate makefiles or sln/vcxproj | $ cmake .. | c:\\..\\build> cmake .. -G "Visual Studio 16 2019"
|
|
Packit Service |
fb147c |
| _**3**_ | Build | $ cmake --build . | c:\\..\\build> cmake --build . --config Release You may prefer to open exiv2.sln and build using the IDE. |
|
|
Packit Service |
fb147c |
| _**4**_ | Optionally Run Test Suite | $ make tests | You must install MinGW bash and python to run tests See [README.md](README.md) |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="2">
|
|
Packit |
01d647 |
## 2) Platform Notes
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="2-1">
|
|
Packit |
01d647 |
### 2.1) Linux Notes
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
##### Default Profile
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
When you run conan install for the first time, it will detect and write the default profile ~/.conan/profile/default. On my Ubuntu system with GCC 4.9, this is:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```ini
|
|
Packit |
01d647 |
[settings]
|
|
Packit |
01d647 |
os=Linux
|
|
Packit |
01d647 |
os_build=Linux
|
|
Packit |
01d647 |
arch=x86_64
|
|
Packit |
01d647 |
arch_build=x86_64
|
|
Packit |
01d647 |
compiler=gcc
|
|
Packit |
01d647 |
compiler.version=4.9
|
|
Packit |
01d647 |
compiler.libcxx=libstdc++
|
|
Packit |
01d647 |
build_type=Release
|
|
Packit |
01d647 |
[options]
|
|
Packit |
01d647 |
[build_requires]
|
|
Packit |
01d647 |
[env]
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
##### Changing profile settings
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
One of the most important **profile** settings to be adjusted in your conan profile when working on Linux is the field:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
compiler.libcxx=libstdc++11 # Possible values: libstdc++, libstdc++11, libc++
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
With the arrival of the c++11 standard, and the growing popularity of the *clang* compiler, it is increasingly important which version of the standard library to use (corresponds to the `-stdlib` compiler flag).
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Recommended **libcxx**
|
|
Packit |
01d647 |
settings works with conan and different compilers:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
compiler.libcxx=libstdc++11 # will use -stdlib=libstdc++ and define _GLIBCXX_USE_CXX11_ABI=1
|
|
Packit |
01d647 |
compiler.libcxx=libstdc++ # will use -stdlib=libstdc++ and define _GLIBCXX_USE_CXX11_ABI=0
|
|
Packit |
01d647 |
compiler.libcxx=libc++ # will use -stdlib=libc++
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
As a rule of thumb, set `compiler.libcxx=libstdc++11` when using a version of gcc >= 5.1.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
More information about the standard library and GCC [dual ABI in gcc](https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html) with GCC works.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Please, be aware that normally when using gcc >= 5.1, \_GLIBCXX\_USE\_CXX11\_ABI is set to 1 by default. However some linux
|
|
Packit |
01d647 |
distributions might set that definition to 0 by default. In case you get linking errors about standard c++ containers or
|
|
Packit |
01d647 |
algorithms when bringing the Exiv2 dependencies with conan, this might indicate a mismatch between the value set in
|
|
Packit |
01d647 |
**compiler.libcxx** and the default values used in your distribution.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="2-2">
|
|
Packit |
01d647 |
### 2.2) Visual Studio Notes
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
I use the following batch file `cmd64.bat` to start cmd.exe. I do this to reduce the complexity of the path which grows as various tools are installed on Windows. The purpose of this script is to ensure a "stripped down path".
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bat
|
|
Packit |
01d647 |
@echo off
|
|
Packit |
01d647 |
setlocal
|
|
Packit Service |
fb147c |
set "P="
|
|
Packit Service |
fb147c |
set "P=%P%C:\Python37\;C:\Python37\Scripts;" # DOS Python3
|
|
Packit Service |
fb147c |
set "P=%P%c:\Program Files\cmake\bin;" # DOS cmake
|
|
Packit Service |
fb147c |
set "P=%P%c:\msys64\usr\bin;" # msys2 make, bash etc
|
|
Packit Service |
fb147c |
set "P=%P%c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;"
|
|
Packit Service |
fb147c |
set "P=%P%c:\Windows\System32;" # windows
|
|
Packit Service |
fb147c |
set "P=%P%%USERPROFILE%\com;" # my home-made magic
|
|
Packit Service |
fb147c |
echo %P%
|
|
Packit Service |
fb147c |
set "PATH=%P%"
|
|
Packit Service |
fb147c |
set "EXIV2_EXT=.exe"
|
|
Packit Service |
fb147c |
set "EXIV2_BINDIR=%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\build\bin"
|
|
Packit Service |
fb147c |
color 0d
|
|
Packit Service |
fb147c |
cmd /S /K cd "%EXIV2_BINDIR%\..\.."
|
|
Packit Service |
fb147c |
color
|
|
Packit Service |
fb147c |
endlocal
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
### Profiles for Visual Studio
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
Exiv2 v0.27 can be built with VS 2008, 2010, 2012, 2013, 2015 , 2017 and 2019.
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
Exiv2 v0.28 is being "modernised" to C++11 and will not support C++98. We don't expect Exiv2 v0.28 to build with VS versions earlier than VS 2015.
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
You create profiles in %HOMEPATH%\.conan\profiles with a text editor. For your convenience, you'll find profiles in `<exiv2dir>\cmake\msvc_conan_profiles`. There are 26 in total:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
Profile := msvc{Edition}{Type}{Bits}
|
|
Packit |
01d647 |
Edition := { 2019 | 2017 | 2015 }
|
|
Packit |
01d647 |
Type := { Release | Debug }
|
|
Packit |
01d647 |
Bits := { 64 | 32 } # 32 bit build is not provided for 2019
|
|
Packit |
01d647 |
Examples: msvc2019Release msvc2017Release64 msvc2015Debug32
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
The profile msvc2019Release is as follows:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```ini
|
|
Packit |
01d647 |
[build_requires]
|
|
Packit |
01d647 |
[settings]
|
|
Packit |
01d647 |
arch=x86_64
|
|
Packit |
01d647 |
build_type=Release
|
|
Packit |
01d647 |
compiler=Visual Studio
|
|
Packit |
01d647 |
compiler.runtime=MD
|
|
Packit Service |
fb147c |
compiler.version=16
|
|
Packit |
01d647 |
os=Windows
|
|
Packit |
01d647 |
arch_build=x86_64
|
|
Packit |
01d647 |
os_build=Windows
|
|
Packit |
01d647 |
[options]
|
|
Packit |
01d647 |
[env]
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
### Tools for Visual Studio 2019
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
You will need cmake version 3.14 (and up) and conan 1.14 (and up).
|
|
Packit Service |
fb147c |
|
|
Packit Service |
fb147c |
Additionally, when I upgraded to conan 1.14.3, I had to manually update the file `settings.yml` as follows. For me: `%USERPROFILE% == C:\Users\rmills`:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bat
|
|
Packit |
01d647 |
copy/y %USERPROFILE%\.conan\settings.yml.new %USERPROFILE%\.conan\settings.yml
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
### CMake Generators for Visual Studio
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
In the step-by-step guide, the command `$ cmake ..` uses
|
|
Packit |
01d647 |
the default CMake generator. Always use the generator for your version of Visual Studio. For example:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bat
|
|
Packit Service |
fb147c |
c:\..\build> conan install .. --build missing --profile msvc2019Release
|
|
Packit Service |
fb147c |
c:\..\build> cmake .. -G "Visual Studio 16 2019"
|
|
Packit Service |
fb147c |
c:\..\build> cmake --build . --config Release
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
CMake provides Generators for different editions of Visual Studio. The 64 and 32 bit Generators have different names:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
| Architecture | Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 |
|
|
Packit |
01d647 |
|:--------- |--------------------|--------------------|--------------------|--------------------|
|
|
Packit |
01d647 |
| 64 bit | "Visual Studio 16 2019" | "Visual Studio 15 2017 Win64" | "Visual Studio 14 2015 Win64" |
|
|
Packit |
01d647 |
| 32 bit | Not provided | "Visual Studio 15 2017" | "Visual Studio 14 2015" |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
### Recommended settings for Visual Studio
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
##### 64 bit Release Build
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
| | Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015|
|
|
Packit |
01d647 |
|:---------|--------------------|--------------------|--------------|
|
|
Packit |
01d647 |
| _**conan install .. --profile**_ | msvc2019Release | msvc2017Release64 | msvc2015Release64 |
|
|
Packit |
01d647 |
| _**cmake -G**_ | "Visual Studio 16 2019" | "Visual Studio 15 2017 Win64" | "Visual Studio 14 2015 Win64" |
|
|
Packit |
01d647 |
| _**profile**_
_ | arch=x86\_64 arch\_build=x86\_64 build\_type=Release compiler.runtime=MD compiler.version=16 compiler=Visual Studio os=Windows os\_build=Windows | arch=x86\_64 arch\_build=x86\_64 build\_type=Release compiler.runtime=MD compiler.version=15 compiler=Visual Studio os=Windows os\_build=Windows | arch=x86\_64 arch\_build=x86\_64 build\_type=Release compiler.runtime=MD compiler.version=14 compiler=Visual Studio os=Windows os\_build=Windows |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
##### Debug Builds
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 |
|
|
Packit |
01d647 |
|:-------|-------|------|--------------|
|
|
Packit |
01d647 |
| _**conan install .. --profile**_ | msvc2019Debug | msvc2017Debug64 | msvc2015Debug64 |
|
|
Packit |
01d647 |
| _**profile**_ _ | build\_type=Debug compiler.runtime=MDd | build\_type=Debug compiler.runtime=MDd | build_type=Debug compiler.runtime=MDd |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
##### 32bit Builds
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
|| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 |
|
|
Packit |
01d647 |
|:-----------|--------------------|--------------------|--------------------|
|
|
Packit |
01d647 |
| _**conan install .. --profile**_ | Not provided | msvc2017Release32 | msvc2015Release32 |
|
|
Packit |
01d647 |
| _**cmake -G**_ | Not provided | "Visual Studio 15 2017" | "Visual Studio 14 2015" |
|
|
Packit |
01d647 |
| _**profile**_ _ | Not provided | arch=x86 arch\_build=x86 | arch=x86 arch\_build=x86 |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
##### Static Builds
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The default builds of Exiv2 and sample applications build and use DLLs.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
To build static libraries, use the cmake option `-DBUILD_SHARED_LIBS=Off`. You will probably also want to use the static run-time. The default is to use the dynamic run-time library.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit Service |
fb147c |
$ cmake .. -DBUILD_SHARED_LIBS=Off -DEXIV2_ENABLE_DYNAMIC_RUNTIME=Off
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
If you wish to use the static C run-time library, use the following option in the conan profile.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
| | Static Release | Static Debug |
|
|
Packit |
01d647 |
|:--- |:--------- |:-------------------|
|
|
Packit |
01d647 |
| **profile setting** | compiler.runtime=MT | compiler.runtime=MTd |
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
If you receive a linker warning concerning `LIBCMT`, it is because you are attempting to link libraries which have been built with different run-time libraries.
|
|
Packit |
01d647 |
You should link everything with the dynamic or static run-time. You can link a static library with the dynamic run-time if you wish.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
### Changing profile settings with the conan command
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
It is recommended that you use profiles provided in `<exiv2dir>\cmake\msvc_conan_profiles`.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
You can modify profile settings on the command line.
|
|
Packit |
01d647 |
The following example demonstrates making substantial changes to profile settings by performing a 32 bit build using Visual Studio 2015 with a 2017 profile! This example is not considered good practice, it is an illustration to some conan flexibility which be useful when your build environment is automated.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan install .. --profile msvc2017Release64 -s arch_build=x86 -s arch=x86 -s compiler.version=14
|
|
Packit |
01d647 |
$ cmake .. -G "Visual Studio 2015"
|
|
Packit |
01d647 |
$ cmake --build . --config Release
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="3">
|
|
Packit |
01d647 |
## 3 Conan Architecture
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="3-1">
|
|
Packit |
01d647 |
##### 3.1) conanfile.py
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
In the root level of the **Exiv2** repository, the file `conanfile.py` defines C/C++ dependencies with the syntax: `Library/version@user/channel`
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
For example, **zlib**:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```python
|
|
Packit |
01d647 |
self.requires('self.requires('zlib/1.2.11@conan/stable')')
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="3-2">
|
|
Packit |
01d647 |
##### 3.2) Conan _**Recipes**_
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Conan searches remote servers for a _**recipe**_ to build a dependency.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
A _**recipe**_ is a python file which indicates how to build a library from sources. The recipe
|
|
Packit |
01d647 |
understands configurations: Platform/Compiler/Settings. If the remote server has a pre-compiled package for
|
|
Packit |
01d647 |
your configuration, it will be downloaded. Otherwise, conan will compile the libraries on your machine using instructions in the recipe.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
To illustrate, here is list of packages that returned by the command `$ conan search`
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan search --remote conan-center zlib/1.2.11@conan/stable
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The output should be:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
Existing packages for recipe zlib/1.2.11@conan/stable:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Package_ID: 0000193ac313953e78a4f8e82528100030ca70ee
|
|
Packit |
01d647 |
[options]
|
|
Packit |
01d647 |
shared: False
|
|
Packit |
01d647 |
[settings]
|
|
Packit |
01d647 |
arch: x86_64
|
|
Packit |
01d647 |
build_type: Debug
|
|
Packit |
01d647 |
compiler: gcc
|
|
Packit |
01d647 |
compiler.version: 4.9
|
|
Packit |
01d647 |
os: Linux
|
|
Packit |
01d647 |
Outdated from recipe: False
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Package_ID: 014be746b283391f79d11e4e8af3154344b58223
|
|
Packit |
01d647 |
[options]
|
|
Packit |
01d647 |
shared: False
|
|
Packit |
01d647 |
[settings]
|
|
Packit |
01d647 |
arch: x86_64
|
|
Packit |
01d647 |
build_type: Debug
|
|
Packit |
01d647 |
compiler: gcc
|
|
Packit |
01d647 |
compiler.exception: seh
|
|
Packit |
01d647 |
compiler.threads: posix
|
|
Packit |
01d647 |
compiler.version: 5
|
|
Packit |
01d647 |
os: Windows
|
|
Packit |
01d647 |
Outdated from recipe: False
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
... deleted ....
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="3-3">
|
|
Packit |
01d647 |
##### 3.3) Conan server search path
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Conan searches remote servers for a _**recipe**_ to build the dependency. You can list them with the command:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan remote list
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
You can add servers to the conan server search path:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan remote add conan-piponazo https://api.bintray.com/conan/piponazo/piponazo
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="3-4">
|
|
Packit |
01d647 |
##### 3.4) Configuring conan on your machine
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Conan stores its configuration and local builds in the directory ~/.conan (%HOMEPATH%\\.conan on Windows).
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Conan installs several files and two directories:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$HOME/.conan/profiles Configuration files for compilers/platforms
|
|
Packit |
01d647 |
$HOME/.conan/data Dependencies are built/stored in this directory
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="3-5">
|
|
Packit |
01d647 |
##### 3.5) Running `conan install` for the first time
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The first time you run `$ conan install`, it will auto-detect your configuration and store a default profile in the file
|
|
Packit |
01d647 |
$HOME/.conan/profiles/default
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Normally you will want to define new profiles for choosing different compilers (msvc, gcc, clang), different
|
|
Packit |
01d647 |
build_type (Release, Debug), runtimes (MD, MT, MDd, MTd)
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The expected output should be something like this, in case it's the first time you run conan:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan install .. --build missing
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable: Retrieving from predefined remote 'conan-center'
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable: Trying with 'conan-center'...
|
|
Packit |
01d647 |
Downloading conanmanifest.txt
|
|
Packit |
01d647 |
[==================================================] 220B/220B
|
|
Packit |
01d647 |
Downloading conanfile.py
|
|
Packit |
01d647 |
[==================================================] 1.7KB/1.7KB
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable: Retrieving from predefined remote 'conan-center'
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable: Trying with 'conan-center'...
|
|
Packit |
01d647 |
Downloading conanmanifest.txt
|
|
Packit |
01d647 |
[==================================================] 121B/121B
|
|
Packit |
01d647 |
Downloading conanfile.py
|
|
Packit |
01d647 |
[==================================================] 5.7KB/5.7KB
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable: Retrieving from predefined remote 'bincrafters'
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable: Trying with 'bincrafters'...
|
|
Packit |
01d647 |
Downloading conanmanifest.txt
|
|
Packit |
01d647 |
...
|
|
Packit |
01d647 |
PROJECT: Installing D:\Dev\Windows\projects\exiv2\conanfile.py
|
|
Packit |
01d647 |
Requirements
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable from 'conan-center'
|
|
Packit |
01d647 |
OpenSSL/1.0.2n@conan/stable from 'conan-center'
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable from 'conan-center'
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable from 'bincrafters'
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable from 'conan-center'
|
|
Packit |
01d647 |
Packages
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
OpenSSL/1.0.2n@conan/stable:606fdb601e335c2001bdf31d478826b644747077
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable:a35f8fa327837a5f1466eaf165e1b6347f6e1e51
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable:e37838f02fd790447943465f1c9317fd1c59b95c
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
PROJECT: Retrieving package 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable: Looking for package 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7 in remote 'conan-center'
|
|
Packit |
01d647 |
Downloading conanmanifest.txt
|
|
Packit |
01d647 |
[==================================================] 323B/323B
|
|
Packit |
01d647 |
Downloading conaninfo.txt
|
|
Packit |
01d647 |
[==================================================] 438B/438B
|
|
Packit |
01d647 |
Downloading conan_package.tgz
|
|
Packit |
01d647 |
[==================================================] 133.6KB/133.6KB
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable: Package installed 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
PROJECT: Retrieving package a35f8fa327837a5f1466eaf165e1b6347f6e1e51
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable: Looking for package a35f8fa327837a5f1466eaf165e1b6347f6e1e51 in remote 'conan-center'
|
|
Packit |
01d647 |
Downloading conanmanifest.txt
|
|
Packit |
01d647 |
[==================================================] 3.5KB/3.5KB
|
|
Packit |
01d647 |
Downloading conaninfo.txt
|
|
Packit |
01d647 |
[==================================================] 478B/478B
|
|
Packit |
01d647 |
Downloading conan_package.tgz
|
|
Packit |
01d647 |
[==================================================] 1001.1KB/1001.1KB
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable: Package installed a35f8fa327837a5f1466eaf165e1b6347f6e1e51
|
|
Packit |
01d647 |
PROJECT: Retrieving package 6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
...
|
|
Packit |
01d647 |
PROJECT: Generator cmake created conanbuildinfo.cmake
|
|
Packit |
01d647 |
PROJECT: Generator txt created conanbuildinfo.txt
|
|
Packit |
01d647 |
PROJECT: Generated conaninfo.txt
|
|
Packit |
01d647 |
PROJECT imports(): Copied 5 '.dll' files
|
|
Packit |
01d647 |
(conan)
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Note that it first downloads the recipes, and then the binary packages. When everything goes well, conan found
|
|
Packit |
01d647 |
the recipes in the remotes, and it also found packages for our configuration (msvc2017, Release, MD).
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
However, if you use other configuration for which there are no packages in the remotes, you will get an error such as:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
PROJECT: WARN: Can't find a 'zlib/1.2.11@conan/stable' package for the specified options and settings:
|
|
Packit |
01d647 |
- Settings: arch=x86_64, build_type=Release, compiler=clang, compiler.version=3.9, os=Macos
|
|
Packit |
01d647 |
- Options: shared=False
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
ERROR: Missing prebuilt package for 'zlib/1.2.11@conan/stable'
|
|
Packit |
01d647 |
Try to build it from sources with "--build zlib"
|
|
Packit |
01d647 |
Or read "http://docs.conan.io/en/latest/faq/troubleshooting.html#error-missing-prebuilt-package"
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
In that case, we can tell conan to build the library:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan install .. --profile MyEsotericProfile --build missing
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Once the command succeeds, we will have the libraries in our system (you can find the recipes and packages in
|
|
Packit |
01d647 |
`$HOME/.conan/data`). When you execute the command `conan install` with the same profile, the following output is typical:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan install ..
|
|
Packit |
01d647 |
PROJECT: Installing D:\Dev\Windows\projects\exiv2\conanfile.py
|
|
Packit |
01d647 |
Requirements
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable from 'conan-center'
|
|
Packit |
01d647 |
OpenSSL/1.0.2n@conan/stable from 'conan-center'
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable from 'conan-center'
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable from 'bincrafters'
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable from 'conan-center'
|
|
Packit |
01d647 |
Packages
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
OpenSSL/1.0.2n@conan/stable:606fdb601e335c2001bdf31d478826b644747077
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable:a35f8fa327837a5f1466eaf165e1b6347f6e1e51
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable:e37838f02fd790447943465f1c9317fd1c59b95c
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable:6cc50b139b9c3d27b3e9042d5f5372d327b3a9f7
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Expat/2.2.5@pix4d/stable: Already installed!
|
|
Packit |
01d647 |
gtest/1.8.0@bincrafters/stable: Already installed!
|
|
Packit |
01d647 |
zlib/1.2.11@conan/stable: Already installed!
|
|
Packit |
01d647 |
OpenSSL/1.0.2n@conan/stable: Already installed!
|
|
Packit |
01d647 |
libcurl/7.56.1@bincrafters/stable: Already installed!
|
|
Packit |
01d647 |
PROJECT: Generator cmake created conanbuildinfo.cmake
|
|
Packit |
01d647 |
PROJECT: Generator txt created conanbuildinfo.txt
|
|
Packit |
01d647 |
PROJECT: Generated conaninfo.txt
|
|
Packit |
01d647 |
PROJECT imports(): Copied 5 '.dll' files
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
Indicating that the packages were found in the local cache.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="4">
|
|
Packit |
01d647 |
## 4 Building Exiv2 with Adobe XMPsdk 2016
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
With Exiv2 v0.27, you can build Exiv2 with Adobe XMPsdk 2016 on Linux/GCC, Mac/clang and Visual Studio 2017.
|
|
Packit |
01d647 |
Other platforms such as Cygwin are not supported by Adobe. Adobe/XMPsdk is built as a external library.
|
|
Packit |
01d647 |
Applications which wish use the Adobe XMPsdk directly should build Exiv2 in this configuration and the
|
|
Packit |
01d647 |
library can be used by the application and Exiv2. The Adobe XMPsdk can be built as a static or shared library (.DLL)
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
To build Exiv2 with Adobe XMPsdk 2016, perform steps 1.1, 1.2 and 1.3 described above, then perform the following:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="4-1">
|
|
Packit |
01d647 |
##### 4.1) Add a remote directory to conan's recipe search path
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
By default, conan knows about several public conan repositories. Exiv2 requires
|
|
Packit |
01d647 |
the **piponazo** repository to find the XmpSdk dependency which is not available from **conan-center** repository.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan remote add conan-piponazo https://api.bintray.com/conan/piponazo/piponazo
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="4-2">
|
|
Packit |
01d647 |
##### 4.2) Build dependencies and install conan artefacts in your build directory
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan install .. --options xmp=True --build missing
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="4-3">
|
|
Packit |
01d647 |
##### 4.3) Execute cmake to generate build files for your environment:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
You must tell CMake to link Adobe's library:
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ cmake .. -DEXIV2_ENABLE_EXTERNAL_XMP=On # -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release
|
|
Packit |
01d647 |
```
|
|
Packit Service |
fb147c |
**macOS** users should use the cmake _**Xcode**_ Generator
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ cmake .. -DEXIV2_ENABLE_EXTERNAL_XMP=On -G Xcode
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
<name id="4-4">
|
|
Packit |
01d647 |
##### 4.4) Build Exiv2 and link Adobe XMPsdk library
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ cmake --build . --config Release
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
<name id="5">
|
|
Packit |
01d647 |
## 5 Webready Support
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
Exiv2 can perform I/O using internet protocols such as http, https and ftp.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
The feature is disabled by default. You will need to instruct conan to build/download necessary libraries (curl, openssl and libssh) and tell CMake to link to the libraries.
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
```bash
|
|
Packit |
01d647 |
$ conan install .. --options webready=True
|
|
Packit |
01d647 |
$ cmake -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=ON -DEXIV2_ENABLE_SSH=ON ..
|
|
Packit |
01d647 |
```
|
|
Packit |
01d647 |
|
|
Packit |
01d647 |
[TOC](#TOC)
|
|
Packit |
01d647 |
|
|
Packit Service |
fb147c |
Written by Robin Mills robin@clanmills.com Updated: 2020-05-21
|