Updated doc on building with CMake.

This commit is contained in:
Vincent Richard 2016-03-11 21:08:16 +01:00
parent ab14eefa0d
commit 997f9300a5

View File

@ -46,66 +46,43 @@ access with the following instruction:
% ============================================================================ % ============================================================================
\section{Compiling and installing} \section{Compiling and installing}
There are two possibilities for compiling VMime: using SCons building system, VMime relies on CMake for building. CMake is an open source, cross-platform
or using CMake. build system. It will generate all build scripts required to compile VMime on
your platform.
SCons is only used for development purposes, and so it is recommended that you First, extract the tarball or checkout the VMime source code into a directory
use CMake to build the project as it is a more portable solution, and is somewhere on your system, let's call it {\vcode /path/to/vmime-source}. Then,
likely to work out-of-the-box on your computer. Thus, we will not describe create a build directory, which will contain all intermediate build files and
the process of compiling VMime using SCons here. the final libraries, let's call it {\vcode /path/to/vmime-build}.
CMake is an open source, cross-platform build system. It will generate all From the build directory, run {\vcode cmake} with the {\vcode -G} argument
build scripts required to compile VMime on your platform. corresponding to your platform/choice. For example, if you are on a
Unix-compatible platform (like GNU/Linux or MacOS) and want to use the
First, from the directory where you extracted the tarball or checked out {\vcode make} utility for building, type:
the sources, run {\vcode cmake} with the {\vcode -G} argument corresponding
to your platform. For example, if you are on a Unix-compatible platform (like
GNU/Linux or MacOS), type:
\begin{verbatim} \begin{verbatim}
$ cmake -G "Unix Makefiles" $ cd /path/to/vmime-build
$ cmake -G "Unix Makefiles" /path/to/vmime-source
\end{verbatim} \end{verbatim}
This will perform some tests on your system to check for libs installed CMake will perform some tests on your system to check for libs installed
and some platform-specific includes. It will then create a Makefile in and some platform-specific includes, and create all files needed for
the root directory of VMime. compiling the project. Additionally, a {\vcode src/vmime/config.hpp} file
with the parameters detected for your system will be created.
\vnote{Delete the {\vcode CMakeCache.txt} file if something changed on your
system, as CMake may cache some values to speed up things.}
This will also create a file named {\vcode config.hpp} in the {\vcode vmime/}
directory, with the parameters detected for your platform. You should not
modify this file directly. Instead, you can run again {\vcode cmake} and
specify your own defines on the command line.
For example, to force using OpenSSL library instead of GnuTLS for TLS
support, type:
\begin{verbatim}
$ cmake -G "Unix Makefiles" -DVMIME_TLS_SUPPORT_LIB=openssl
\end{verbatim}
If you want to enable or disable some features in VMime, you can obtain some
help by typing {\vcode cmake -L}. The defaults should be OK though. For a list
of build options, you can also refer to section \ref{build-options}, page
\pageref{build-options}.
For more information about using CMake, go to
\href{http://www.cmake.org/}{the CMake web site}.
Next, you can start the compilation process: Next, you can start the compilation process:
\begin{verbatim} \begin{verbatim}
$ make $ cmake --build .
\end{verbatim} \end{verbatim}
Please wait a few minutes will the compilation runs (you should have some time Please wait a few minutes while the compilation runs (you should have some
to have a coffee right now!). If you get errors during the compilation, be time to have a coffee right now!). If you get errors during the compilation,
sure your system meet the requirements given at the beginning of the chapter. be sure your system meet the requirements given at the beginning of the
You can also try to get a newer version (from the Git repository, for example) chapter. You can also try to get a newer version (from the Git repository, for
or to get some help on VMime user forums. example) or to get some help on VMime user forums.
If everything has been compiled successfully, you can install the library and If everything compiled successfully, you can install the library and
the development files on your system: the development files on your system:
\begin{verbatim} \begin{verbatim}
@ -118,6 +95,48 @@ the library into the default location (ie: /usr/lib and /usr/include).}
Now, you are done! You can jump to the next chapter to know how to use VMime Now, you are done! You can jump to the next chapter to know how to use VMime
in your program... in your program...
% ============================================================================
\section{\label{custom-build}Customizing build}
You should not modify the {\vcode config.hpp} file directly. Instead, you
should run {\vcode cmake} again, and specify your build options on the command
line. For example, to force using OpenSSL library instead of GnuTLS for TLS
support, type:
\begin{verbatim}
$ cmake -G "Unix Makefiles" -DVMIME_TLS_SUPPORT_LIB=openssl
\end{verbatim}
If you want to enable or disable some features in VMime, you can obtain some
help by typing {\vcode cmake -L}. The defaults should be OK though. For a
complate list of build options, you can also refer to section
\ref{build-options}, page \pageref{build-options}. For more information about
using CMake, go to \href{http://www.cmake.org/}{the CMake web site}.
\vnote{Delete the {\vcode CMakeCache.txt} file if you changed configuration
or if something changed on your system, as CMake may cache some values to
speed things up.}
You can also use another build backend, like
Ninja\footnote{\url{https://ninja-build.org/}}, if you have it on your system:
\begin{verbatim}
$ cd /path/to/vmime-build
$ cmake -G Ninja /path/to/vmime-source
$ ninja
# ninja install
\end{verbatim}
To install VMime in a directory different from the default directory
({\vcode /usr} on GNU/Linux systems), set the
{\vcode CMAKE\_INSTALL\_PREFIX} option:
\begin{verbatim}
$ cmake -DCMAKE_INSTALL_PREFIX=/opt/ ...
\end{verbatim}
% ============================================================================ % ============================================================================
\section{\label{build-options}Build options} \section{\label{build-options}Build options}