| 1 |
\section{Compiling and linking} |
| 2 |
\label{sec:build} |
| 3 |
This appendix provides a brief description of how to build |
| 4 |
your program using \gviz\ as a library. It also notes the |
| 5 |
various libraries involved. As compilation systems vary |
| 6 |
greatly, we make no attempt to provide low-level build |
| 7 |
instructions. We assume that the user is capable of tailoring |
| 8 |
the build environment to use the necessary include files and |
| 9 |
libraries. |
| 10 |
|
| 11 |
All of the necessary include files and libraries are available |
| 12 |
in the {\tt include}, {\tt lib} and {\tt bin} directories where \gviz\ |
| 13 |
is installed. At the simplest level, all an application needs |
| 14 |
to do to use the layout algorithms is to include {\tt gvc.h}, |
| 15 |
which provides (indirectly) all of the \gviz\ types and functions, |
| 16 |
compile the code, |
| 17 |
and link the program with the necessary libraries. |
| 18 |
|
| 19 |
For linking, the application should use the \gviz\ libraries |
| 20 |
\begin{itemize} |
| 21 |
\item {\tt gvc} |
| 22 |
\item {\tt cgraph} |
| 23 |
\item {\tt cdt} |
| 24 |
\end{itemize} |
| 25 |
If the system is configured to use plug-ins, these libraries |
| 26 |
are all that are necessary. At run time, the program will |
| 27 |
load the dynamic libraries it needs. |
| 28 |
|
| 29 |
If the program does not use plug-ins, then these libraries |
| 30 |
need to be incorporated at link time. These libraries may |
| 31 |
include |
| 32 |
\begin{itemize} |
| 33 |
\item {\tt gvplugin\_core} |
| 34 |
\item {\tt gvplugin\_dot\_layout} |
| 35 |
\item {\tt gvplugin\_neato\_layout} |
| 36 |
\item {\tt gvplugin\_gd} |
| 37 |
\item {\tt gvplugin\_pango}\footnote{ |
| 38 |
For completeness, we note that it may be necessary to explicitly |
| 39 |
link in the following additional libraries, depending |
| 40 |
on the options set when \gviz\ was built: |
| 41 |
{\tt expat}, |
| 42 |
{\tt fontconfig}, |
| 43 |
{\tt freetype2}, |
| 44 |
{\tt pangocairo}, |
| 45 |
{\tt cairo}, |
| 46 |
{\tt pango}, |
| 47 |
{\tt gd}, |
| 48 |
{\tt jpeg}, |
| 49 |
{\tt png}, |
| 50 |
{\tt z}, |
| 51 |
{\tt ltdl}, |
| 52 |
and other libraries required by Cairo and Pango. |
| 53 |
Typically, though, most builds handle these implicitly.} |
| 54 |
\end{itemize} |
| 55 |
plus any other plug-ins the program requires. |
| 56 |
|
| 57 |
If \gviz\ is built and installed with the GNU build tools, |
| 58 |
there are package configure files created in the {\tt lib/pkgconfig} |
| 59 |
directory which can be used with the {\tt pkg-config} program |
| 60 |
to obtain the include file and library information for |
| 61 |
a given installation. |
| 62 |
Assuming a Unix-like environment, a sample {\tt Makefile} for building the |
| 63 |
programs listed in Appendices~\ref{sec:simple}, \ref{sec:dot} |
| 64 |
and \ref{sec:demo}\footnote{They |
| 65 |
can also be found, along with the {\tt Makefile}, in the |
| 66 |
{\tt dot.demo} directory of the \gviz\ source.} |
| 67 |
could have the form: |
| 68 |
|
| 69 |
\begin{verbatim} |
| 70 |
CFLAGS=`pkg-config libgvc --cflags` -Wall -g -O2 |
| 71 |
LDFLAGS=`pkg-config libgvc --libs` |
| 72 |
|
| 73 |
all: simple dot demo |
| 74 |
|
| 75 |
simple: simple.o |
| 76 |
dot: dot.o |
| 77 |
demo: demo.o |
| 78 |
|
| 79 |
clean: |
| 80 |
rm -rf simple dot demo *.o |
| 81 |
\end{verbatim} |
| 82 |
|