%!TEX root=cargo.tex
\section{Getting Started}

\subsection{Obtaining a Copy}

There are two ways to obtain a copy.
\begin{itemize}
    \item Add release package to GitHub.

    \item Clone the master \code{libcargo} git repository to your local computer:
\begin{verbatim}
git clone https://github.com/jamjpan/Cargo.git
\end{verbatim}

The source repository is roughly 78 MB. It is large because it includes problem
instances and road networks. The problem instances together are 40.2 MB, and
the road networks are 34.1 MB.
\end{itemize}

\subsection{Installing}

The \code{libcargo} library is a \emph{static} library; it does not need to be
installed. But, it does need to be built in order to be usable. The release
package already contains the pre-built library, but if you would like to build
the library yourself, or if the pre-built version does not work on your
machine, follow the instructions below to build from source.

\subsection{Building from Source}

Make sure your machine satisfies the prerequisites (Section~\ref{2.
Prerequisites}).  Then, \code{cd} into the \code{Cargo} directory and type
\code{make}. The command will create two directories, \code{build} and
\code{lib}. the first directory stores temporary build objects, and the
second stores the library with filename \code{libcargo.a}.

\subsection{Usage}

Copy the \code{include} directory and \code{libcargo.a} into your own project's root directory. Then
use \code{\#include "libcargo.h"} in your code to access the library. Use
\code{using namespace cargo;} at the top of your code to save prepending the
\code{cargo} namespace to library objects and functions. When building your
project, link \code{libcargo} and all its dependencies. For example, using \code{g++}:
\begin{verbatim}
g++ -std=c++11 -O3 -c -Iinclude -o my_project.o my_project.cpp
g++ my_project.o -lcargo -pthread -lrt -lmetis -ldl
\end{verbatim}
The first \code{g++} command compiles \code{my\_project.cpp} into the
\code{my\_project.o} binary. The \code{-I} flag instructs \code{g++} where to
look for includes; this should match wherever you placed \code{libcargo}'s \code{include}
directory.

