Browse by type

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.
This document provides a step-by-step guide to show you the basic usage of conan. For more details about the tool, please visit the Conan documentation website.
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
To build Exiv2 with conan, you will also need to install CMake. https://cmake.org/download/
_We do not recommend using conan on MinGW, Cygwin, Unix or to cross compile from Linux to those platforms.
The build procedures for those platforms are discussed here: See README.md_
$ pip install conan
For other installation methods (brew, installers, from sources), visit this link.
To upgrade the version of conan:
$ pip install conan --upgrade
$ conan --version
Conan version 1.23.0
Create a build directory and run the conan commands:
$ mkdir build
$ cd build
$ conan profile list
Visual Studio Users
The profile msvc2019Release96 in %USERPROFILE%\.conan\profiles\msvc2019Release64 is:
[build_requires]
[settings]
arch=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
os=Windows
arch_build=x86_64
os_build=Windows
[options]
[env]
Profiles for Visual Studio are discussed in detail here: Visual Studio Notes
| Build Steps | Linux and macOS | Visual Studio | |
|---|---|---|---|
| 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 msvc2019Release64 | | 2 | Get cmake to generate
makefiles or sln/vcxproj | $ cmake .. | c:\..\build> cmake .. -G "Visual Studio 16 2019" | 3 | Build | $ cmake --build . | c:\..\build> cmake --build . --config Release
You may prefer to open exiv2.sln and build using the IDE. | | 4 | Optionally Run Test Suite
Test documentation: README.md | $ ctest | c:\..\build> ctest -C Release |
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:
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=4.9
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
One of the most important profile settings to be adjusted in your conan profile when working on Linux is the field:
compiler.libcxx=libstdc++11 # Possible values: libstdc++, libstdc++11, libc++
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).
Recommended libcxx settings works with conan and different compilers:
compiler.libcxx=libstdc++11 # will use -stdlib=libstdc++ and define _GLIBCXX_USE_CXX11_ABI=1
compiler.libcxx=libstdc++ # will use -stdlib=libstdc++ and define _GLIBCXX_USE_CXX11_ABI=0
compiler.libcxx=libc++ # will use -stdlib=libc++
As a rule of thumb, set compiler.libcxx=libstdc++11 when using a version of gcc >= 5.1.
More information about the standard library and GCC dual ABI in gcc with GCC works.
Please, be aware that normally when using gcc >= 5.1, _GLIBCXX_USE_CXX11_ABI is set to 1 by default. However some linux distributions might set that definition to 0 by default. In case you get linking errors about standard c++ containers or algorithms when bringing the Exiv2 dependencies with conan, this might indicate a mismatch between the value set in compiler.libcxx and the default values used in your distribution.
We recommend that you install python as discussed here: https://github.com/Exiv2/exiv2/pull/1403#issuecomment-731836146
Exiv2 v0.27 can be built with VS 2008, 2010, 2012, 2013, 2015 , 2017 and 2019.
Exiv2 v1.0 is being "modernised" to C++11 and will not support C++98. We don't expect Exiv2 v1.0 to build with VS versions earlier than VS 2015.
You create profiles in %HOMEPATH%.conan\profiles with a text editor. For your convenience, you'll find profiles in <exiv2dir>\cmake\msvc_conan_profiles.
Profile := msvc{Edition}{Type}{Bits}
Edition := { 2019 | 2017 | 2015 }
Type := { Release | Debug }
Bits := { 64 | 32 }
Examples: msvc2019Release64 msvc2017Release32 msvc2015Debug32
The profile msvc2019Release64 is as follows:
[build_requires]
[settings]
arch=x86_64
build_type=Release
compiler=Visual Studio
compiler.runtime=MD
compiler.version=16
os=Windows
arch_build=x86_64
os_build=Windows
[options]
[env]
You will need cmake version 3.14 (and up) and conan 1.14 (and up).
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:
copy/y %USERPROFILE%\.conan\settings.yml.new %USERPROFILE%\.conan\settings.yml
In the step-by-step guide, the command $ cmake .. uses
the default CMake generator. Always use the generator for your version of Visual Studio. For example:
c:\..\build> conan install .. --build missing --profile msvc2019Release64
c:\..\build> cmake .. -G "Visual Studio 16 2019" -A x64
c:\..\build> cmake --build . --config Release
CMake provides Generators for different editions of Visual Studio. The 64 and 32 bit Generators have different names:
| Architecture | Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | |:--------- |--------------------|--------------------|--------------------|--------------------| | 64 bit | -G "Visual Studio 16 2019" -A x64 | -G "Visual Studio 15 2017 Win64" | -G "Visual Studio 14 2015 Win64" | | 32 bit | -G "Visual Studio 16 2019" -A Win32 | -G "Visual Studio 15 2017" | -G "Visual Studio 14 2015" |
| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | |
|---|---|---|---|
| conan install .. --profile | msvc2019Release64 | msvc2017Release64 | msvc2015Release64 |
| cmake | -G "Visual Studio 16 2019" -A x64 | -G "Visual Studio 15 2017 Win64" | -G "Visual Studio 14 2015 Win64" |
| 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 |
| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | |
|---|---|---|---|
| conan install .. --profile | msvc2019Debug64 | msvc2017Debug64 | msvc2015Debug64 |
| profile |
_ | build_type=Debug
compiler.runtime=MDd | build_type=Debug
compiler.runtime=MDd | build_type=Debug
compiler.runtime=MDd |
| Visual Studio 2019 | Visual Studio 2017 | Visual Studio 2015 | |
|---|---|---|---|
| conan install .. --profile | msvc2019Release32 | msvc2017Release32 | msvc2015Release32 |
| cmake | -G "Visual Studio 16 2019" -A Win32 | -G "Visual Studio 15 2017" | -G "Visual Studio 14 2015" |
| profile |
_ | arch=x86
arch_build=x86 | arch=x86
arch_build=x86 | arch=x86
arch_build=x86 |
The default builds of Exiv2 and sample applications build and use DLLs.
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.
$ cmake .. -DBUILD_SHARED_LIBS=Off -DEXIV2_ENABLE_DYNAMIC_RUNTIME=Off
If you wish to use the static C run-time library, use the following option in the conan profile.
| Static Release | Static Debug | |
|---|---|---|
| profile setting | compiler.runtime=MT | compiler.runtime=MTd |
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.
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.
It is recommended that you use profiles provided in <exiv2dir>\cmake\msvc_conan_profiles.
You can modify profile settings on the command line. 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 of some conan flexibility which may be useful when your build environment is automated.
$ conan install .. --profile msvc2017Release64 -s arch_build=x86 -s arch=x86 -s compiler.version=14
$ cmake .. -G "Visual Studio 2015"
$ cmake --build . --config Release
In the root level of the Exiv2 repository, the file conanfile.py defines C/C++ dependencies with the syntax: Library/version@user/channel
For example, zlib:
self.requires('self.requires('zlib/1.2.11@conan/stable')')
Conan searches remote servers for a recipe to build a dependency.
A recipe is a python file which indicates how to build a library from sources. The recipe understands configurations: Platform/Compiler/Settings. If the remote server has a pre-compiled package for your configuration, it will be downloaded. Otherwise, conan will compile the libraries on your machine using instructions in the recipe.
To illustrate, here is list of packages that returned by the command $ conan search
$ conan search --remote conan-center zlib/1.2.11@conan/stable
The output should be:
Existing packages for recipe zlib/1.2.11@conan/stable:
Package_ID: 0000193ac313953e78a4f8e82528100030ca70ee
[options]
shared: False
[settings]
arch: x86_64
build_type: Debug
compiler: gcc
compiler.version: 4.9
os: Linux
Outdated from recipe: False
Package_ID: 014be746b283391f79d11e4e8af3154344b58223
[options]
shared: False
[settings]
arch: x86_64
build_type: Debug
compiler: gcc
compiler.exception: seh
compiler.threads: posix
compiler.version: 5
os: Windows
Outdated from recipe: False
... deleted ....
Conan searches remote servers for a recipe to bui
$ claude mcp add exiv2 \
-- python -m otcore.mcp_server <graph>