+--- + + -+- + + ++
| \ / | | | / \
| \ / | \ / + |
+--- X | | | /
| / \ | \ / /
| / \ | | /
+--- + + -+- + +----+
C++ Metadata Library
-------------------------------------------------------------------------------
NOTE:
* CMake scripts are functional and used to perform the daily build on the buildserver.
* The existing automake (./configure), and msvc2005 build files will continue
to be supported by exiv2 for at least v0.27 (and probably longer)
The msvc-2003 build files are deprecated and will not be supported after v0.26.
Exiv2 will not build on MinGW (neither 32bit nor 64bit)
This is discussed in TODO-CMAKE
Robin Mills
robin@clanmills.com
2016-09-23
-------------------------------------------------------------------------------
Exiv2 uses cmake, a cross-platform build system, to control the
compilation process using platform/compiler independent configuration files.
TABLE OF CONTENTS
-----------------
1 CMake resources
2 Building and Installing for Unix type systems
3 Building and Installing for Visual Studio Users
4 Building and installing for MinGW Users
1 CMake resources
=================
You have to install cmake on your target system.
Home: http://www.cmake.org/
Help: http://www.cmake.org/cmake/help/help.html
Doc: http://www.cmake.org/cmake/help/documentation.html
Wiki: http://www.cmake.org/Wiki/CMake
FAQ: http://www.cmake.org/Wiki/CMake_FAQ
2 Building and Installing on Linux
==================================
This process also covers MacOS-X Terminal, Cygwin and MinGW users.
a) From the command line
Run the following commands from the top directory (containing this
file) to configure, build and install the library and utility:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ make install
To modify the configuration
$ ccmake ..
Usual CMake options :
-DCMAKE_INSTALL_PREFIX : decide where the program will be install on your computer.
-DCMAKE_BUILD_TYPE : decide which type of build you want. You can chose between:
"debugfull". : for hacking. Include all debug information.
"debug".
"profile".
"relwithdebinfo" : default. use gcc -O2 -g options.
"release" : generate stripped and optimized bin files. For packaging.
Specific Exiv2 options :
-DEXIV2_ENABLE_SHARED : Build exiv2 as a shared library (dll). [default=on ]
-DEXIV2_ENABLE_XMP : Build with XMP metadata support. [default=on ]
-DEXIV2_ENABLE_LIBXMP : Build a static convenience Library for XMP. [default=on ]
-DEXIV2_ENABLE_PNG : Build with png support (requires libz). [default=on ]
-DEXIV2_ENABLE_NLS : Build native language support (requires gettext). [default=on ]
-DEXIV2_ENABLE_PRINTUCS2 : Build with Printucs2. [default=on ]
-DEXIV2_ENABLE_LENSDATA : Build including lens data. [default=on ]
-DEXIV2_ENABLE_COMMERCIAL : Build with the EXV_COMMERCIAL_VERSION symbol set. [default=off]
-DEXIV2_ENABLE_BUILD_SAMPLES : Build the unit tests. [default=off]
-DEXIV2_ENABLE_BUILD_PO : Build translations files. [default=off]
-DEXIV2_ENABLE_CURL : USE Libcurl for HttpIo [default=off]
-DEXIV2_ENABLE_SSH : USE Libssh for SshIo [default=off]
Default install locations
Use -DCMAKE_INSTALL_PREFIX like this :
"cmake . -DCMAKE_INSTALL_PREFIX=/usr" is equivalent to "./configure --prefix=/usr" with automake/configure.
To uninstall Exiv2, run:
$ make uninstall
b) Using the cmake GUI
ccmake
3 Building and installing for Visual Studio Users
=================================================
exiv2 provides three build environment for users of Visual Studio:
cmake: This environment
msvc2005: 32 bit AND 64 bit build environment for MSVC 2005 and later (2008/10/12/13)
msvc2003: 32 bit build environment for MSVC 2003 (deprecated after v0.26)
CMake doesn't build code. It generates build environments.
CMake is a language for describing builds and the CMake interpreter generates
the build environment for your system.
CMake generates MSVC .sln and .vcproj files for your target environment.
The files generated by CMake provide 4 configs: Debug|Release|RelWithDebInfo|MinSizeRel
The current architecture of CMake requires you to decide before running cmake:
1) The version of DevStudio
2) 32bit or 64 bit builds
3) Building static or shared libraries
We have two contributed CMake Build Environments:
1 contrib/cmake/msvc
Please read contrib/cmake/msvc/ReadMe.txt
2 contrib/build/msvc
The scripts require:
- Cygwin (in order to download all dependencies (zlib, expat, ssl, curl, ssh), including exiv2 trunk from svn)
- CMake
- SVN (optional)
Then
- put the two scripts (build.cmd and setenv.cmd) into a completely empty directory
- adapt the paths in setenv.cmd
- open the VS command line shell
- execute build.cmd (if there are any errors, the script should tell you)
Exiv2 should be packaged in the dist directory with all the .lib, include and binary files you need.
4 Building and installing for MinGW Users
=========================================
1 Running a MinGW bash shell
I installed MinGW using the installer on the web site.
I installed two copies c:\MinGW and c:\MinGW64
- both copies run a 32 bit bash shell
I installed the TDM-GCC-64 compiler for use from MinGW64
I installed the Qt 5.6.0 Environement for use from MinGW
I start mingw from DOS with this batch-file (mingw32.bat)
C:\>type c:\Users\rmills\com\mingw32.bat
@echo off
rem ------------------
: mingw32.bat
: invoke MinGW bash
:
setlocal
set "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
set "INCLUDE_PATH=/usr/local/inc"
set "LIBRARY_PATH=/usr/local/lib"
set "BINARY_PATH=/usr/local/bin"
rem set "PATH=c:\MinGW\bin;c:\MinGW\msys\1.0\bin;c:\MinGW\msys\1.0\local\bin;c:\Users\rmills\com;."
set "PATH=c:\Qt\Qt5.6.0\5.6\mingw49_32\bin;c:\Qt\Qt5.6.0\Tools\mingw492_32\bin;c:\MinGW\bin;\usr\bin:\usr\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;."
set "PS1=\! -32- ${PWD}> "
c:\MinGW\msys\1.0\bin\bash.exe %*%
: That's all Folks
rem ------------------
In ~/.bashrc
502 -32- /home/rmills> cat .bashrc
#!/bin/bash
export "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig"
export "INCLUDE_PATH=/usr/local/inc"
export "LIBRARY_PATH=/usr/local/lib"
export "BINARY_PATH=/usr/local/bin"
# PATH=c:/Qt/Qt5.6.0/5.6/mingw49_32/bin;c:/Qt/Qt5.6.0/Tools/mingw492_32/bin;c:/MinGW/bin;/usr/bin:/usr/local/bin;c:/cygwin64/bin;c:/Users/rmills/com;.
PS1='\! -32- ${PWD}> '
# echo hello world from .bashrc
alias dir='ls -alt'
alias del='rm -rf'
alias finder='find . -depth -iname'
alias path='(IFS=:;for i in $PATH; do echo $i; done)'
##
# finder helpers
export L="-exec ls -dalt {} ;"
export X="-exec rm -rf {} ;"
export C="-exec ce {} ;"
export I="-exec lipo -info {} ;"
export O="-exec otool -L {} ;"
export Z="-exec open {} ;"
export P="-exec p4 edit {} ;"
export R="-exec p4 revert {} ;"
export G="-exec grep"
export __=";"
export ___="{} ;"
# That's all Folks!
##503 -32- /home/rmills>
MinGW64 has very similar code. Putting the TDM compiler on the path is the major difference
C:\Users\rmills\com>diff mingw32.bat mingw64.bat
3c3
< : mingw32.bat
---
> : mingw64.bat
11,14c11,25
< rem set "PATH=c:\MinGW\bin;c:\MinGW\msys\1.0\bin;c:\MinGW\msys\1.0\local\bin;c:\Users\rmills\com;."
< set "PATH=c:\Qt\Qt5.6.0\5.6\mingw49_32\bin;c:\Qt\Qt5.6.0\Tools\mingw492_32\bin;c:\MinGW\bin;\usr\bin:\usr\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;."
< set "PS1=\! -32- ${PWD}> "
< c:\MinGW\msys\1.0\bin\bash.exe %*%
---
> : TDM 4.9.2
> set "PATH=c:\TDM-GCC-64\bin;c:\MinGW64\bin;c:\MinGW64\msys\1.0\bin;C:\MinGW64\msys\1.0\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;."
>
> : 4.9.2 compiler
> : set "PATH=c:\mingw-w64\mingw64\bin;c:\mingw-w64\mingw64\opt\bin;;c:\MinGW64\bin;c:\MinGW64\msys\1.0\bin;C:\MinGW64\msys\1.0\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;."
>
> : TDM 5.1 compiler
> : set "PATH=c:\TDM-GCC-51-64\bin;c:\TDM-GCC-51-64\x86_64-w64-mingw32\bin;c:\MinGW64\bin;c:\MinGW64\msys\1.0\bin;C:\MinGW64\msys\1.0\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;."
>
> set "PS1=\! -64- ${PWD}> "
> : 32 bit MinGW/bash
> c:\MinGW64\msys\1.0\bin\bash.exe %*%
>
> : 64 bit Cygwin shell
> : c:\cygwin64\bin\bash.exe
2 Building and installing CMake
$ ./bookstrap --prefix=/usr/local
$ make
$ make install
Gotchas:
1) Do not use a Windows binary install version of CMake
This generates commands which assume you are in the DOS shell.
Build and Use CMake in a "Unix" Way from a MinGW/bash shell.
2) Even although gcc is on the path, we must tell cmake not to use /c/MinGW/bin/gcc)
3) It's using the wrong headers. Needs /c/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$dist -DEXIV2_ENABLE_NLS=OFF \
-DCMAKE_C_COMPILER=$(which gcc) -DCMAKE_CXX_COMPILER=$(which g++) \
"-DCMAKE_CXX_FLAGS=-I/c/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include"
..
4) even so, it errors instantly on:
In file included from c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/stddef.h:7:0,
from c:/Qt/Qt5.6.0/Tools/mingw492_32/lib/gcc/i686-w64-mingw32/4.9.2/include/stddef.h:1,
from C:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/include/XMP_Const.h:14,
from C:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/src/XMPCore_Impl.hpp:13,
from C:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/src/ExpatAdapter.cpp:10:
c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/crtdefs.h:26:9: error: 'size_t' does not name a type
typedef size_t rsize_t;
5) Building cmake itself required setting CC CXX CXXFLAGS and LDFLAGS
AND editing a system file in Qt with an erroneous #pragma error NTDDI_VERSION and _WIN32_WINNT
In file included from c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/windows.h:10:0,
from c:/Users/rmills/gnu/cmake/cmake-3.6.2/Utilities/cmlibarchive/libarchive/archive_windows.h:74,
from c:/Users/rmills/gnu/cmake/cmake-3.6.2/Utilities/cmlibarchive/libarchive/archive_platform.h:60,
from c:/Users/rmills/gnu/cmake/cmake-3.6.2/Utilities/cmlibarchive/libarchive/xxhash.c:35:
c:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include/sdkddkver.h:186:2: error: #error NTDDI_VERSION and _WIN32_WINNT mismatch!
My work-around was to comment off the #error statement!
3 Building with CMake
$ cd ~/gnu/exiv2/trunk
$ rm -rf build ; mkdir build ; cd build
$ cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=$(which gcc) -DCMAKE_CXX_COMPILER=$(which g++) -DEXIV2_ENABLE_NLS=OFF
.... cmake will rattle and roll ....
CMake generates the wrong include response files.
I put the correct include code in contrib/cmake/mingw/includes.rsp
Propagate the correct includes to the generated files.
$ find . -name "includes_*.rsp" -exec cp ../contrib/cmake/mingw/includes.rsp {} \;
$ make
On my system, these the include response file have the code:
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/src
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/include
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/include/exiv2
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/build
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/include
-IC:/MinGW/msys/1.0/home/rmills/gnu/exiv2/trunk/xmpsdk/src
-IC:/Qt/Qt5.6.0/Tools/mingw492_32/i686-w64-mingw32/include
-IC:/Qt/Qt5.6.0/Tools/mingw492_32/lib/gcc/i686-w64-mingw32/4.9.2/include
-IC:/MinGW/msys/1.0/local/include
# That's all Folks
##