|
| 1 | +.. _getting_started: |
| 2 | + |
| 3 | +***************** |
| 4 | + Getting Started |
| 5 | +***************** |
| 6 | + |
| 7 | +Downloading an official release |
| 8 | +=============================== |
| 9 | + |
| 10 | +All stable versions of :mod:`cpp-netlib` can be downloaded from |
| 11 | +Github_ from this url: |
| 12 | + |
| 13 | + http://github.com/cpp-netlib/cpp-netlib/downloads |
| 14 | + |
| 15 | +Each release is available as gzipped (Using the command |
| 16 | +``tar xzf cpp-netlib.tar.gz``) or bzipped (Using ``tar xjf |
| 17 | +cpp-netlib.tar.bz2``) tarball, or as a zipfile (``unzip |
| 18 | +cpp-netlib.zip``, or on Windows using a tool such as 7zip_). |
| 19 | + |
| 20 | +.. _Github: http://github.com/cpp-netlib/cpp-netlib/downloads |
| 21 | +.. _7zip: http://www.7-zip.org/ |
| 22 | + |
| 23 | +Downloading a development version |
| 24 | +================================= |
| 25 | + |
| 26 | +The :mod:`cpp-netlib` uses Git_ for source control, so to use any |
| 27 | +development versions Git must be installed on your system. |
| 28 | + |
| 29 | +Using the command line, the command to get the latest code is: |
| 30 | + |
| 31 | +:: |
| 32 | + |
| 33 | + shell$ git clone git://github.com/mikhailberis/cpp-netlib.git |
| 34 | + |
| 35 | +This should be enough information get to started. To do more complex |
| 36 | +things with Git, such as pulling changes or checking out a new branch, |
| 37 | +refer to the `Git documentation`_. |
| 38 | + |
| 39 | +.. note:: If you look at the Git repository closely, this is the repository of |
| 40 | + *mikhailberis* instead of *cpp-netlib*. The reason is that the main developer |
| 41 | + and maintainer of the project is Dean Michael Berris, who goes by the alias |
| 42 | + *mikhailberis* on the Internet. |
| 43 | + |
| 44 | + Dean does the merging and maintenance of the whole library, similar to how |
| 45 | + `Linus Torvalds`_ of the Linux project acts as the gatekeeper of the project. |
| 46 | + |
| 47 | +.. _`Linus Torvalds`: http://en.wikipedia.org/wiki/Linus_Torvalds |
| 48 | + |
| 49 | +Windows users need to use msysGit_, and to invoke the command above |
| 50 | +from a shell. |
| 51 | + |
| 52 | +For fans of Subversion_, the same code can be checked out from |
| 53 | +http://svn.github.com/mikhailberis/cpp-netlib.git. |
| 54 | + |
| 55 | +.. _Git: http://git-scm.com/ |
| 56 | +.. _`Git documentation`: http://git-scm.com/documentation |
| 57 | +.. _msysGit: http://code.google.com/p/msysgit/downloads/list |
| 58 | +.. _Subversion: http://subversion.tigris.org/ |
| 59 | + |
| 60 | +.. note:: The :mod:`cpp-netlib` project is hosted on GitHub_ and follows the |
| 61 | + prescribed development model for GitHub_ based projects. This means in case |
| 62 | + you want to submit patches, you will have to create a fork of the project |
| 63 | + (read up on forking_) and then submit a pull request (read up on submitting |
| 64 | + `pull requests`_). |
| 65 | + |
| 66 | +.. _forking: http://help.github.com/forking/ |
| 67 | +.. _`pull requests`: http://help.github.com/pull-requests/ |
| 68 | + |
| 69 | +Getting Boost |
| 70 | +============= |
| 71 | + |
| 72 | +:mod:`cpp-netlib` depends on Boost_. It should work for any version |
| 73 | +of Boost above 1.45.0. If Boost is not installed on your system, the |
| 74 | +latest package can be found on the `Boost web-site`_. The environment |
| 75 | +variable ``BOOST_ROOT`` must be defined, which must be the full path |
| 76 | +name of the top directory of the Boost distribution. Although Boost |
| 77 | +is mostly header only, applications built using :mod:`cpp-netlib` |
| 78 | +still requires linking with `Boost.System`_, `Boost.Date_time`_, and |
| 79 | +`Boost.Regex`_. |
| 80 | + |
| 81 | +.. _Boost: http://www.boost.org/doc/libs/release/more/getting_started/index.html |
| 82 | +.. _`Boost web-site`: http://www.boost.org/users/download/ |
| 83 | +.. _`Boost.System`: http://www.boost.org/libs/system/index.html |
| 84 | +.. _`Boost.Date_time`: http://www.boost.org/libs/date_time/index.html |
| 85 | +.. _`Boost.Regex`: http://www.boost.org/libs/regex/index.html |
| 86 | + |
| 87 | +.. note:: You can follow the steps in the `Boost Getting Started`_ guide to |
| 88 | + install Boost into your development system. |
| 89 | + |
| 90 | +.. _`Boost Getting Started`: |
| 91 | + http://www.boost.org/doc/libs/release/more/getting_started/index.html |
| 92 | + |
| 93 | +.. warning:: There is a known incompatibility between :mod:`cpp-netlib` and |
| 94 | + Boost 1.46.1 on some compilers. It is not recommended to use :mod:`cpp-netlib` |
| 95 | + with Boost 1.46.1. Some have reported though that Boost 1.47.0 |
| 96 | + and :mod:`cpp-netlib` work together better. |
| 97 | + |
| 98 | +Getting CMake |
| 99 | +============= |
| 100 | + |
| 101 | +The :mod:`cpp-netlib` uses CMake_ to generate platform-specific build files. If |
| 102 | +you intend to run the test suite, you can follow the instructions below. |
| 103 | +Otherwise, you don't need CMake to use :mod:`cpp-netlib` in your project. The |
| 104 | +:mod:`cpp-netlib` requires CMake version 2.8 or higher. |
| 105 | + |
| 106 | +.. _CMake: http://www.cmake.org/ |
| 107 | + |
| 108 | +Let's assume that you have unpacked the :mod:`cpp-netlib` at the top of your |
| 109 | +HOME directory. On Unix-like systems you will typically be able to change into |
| 110 | +your HOME directory using the command ``cd ~``. This sample below assumes that |
| 111 | +the ``~/cpp-netlib`` directory exists, and is the top-level directory of the |
| 112 | +:mod:`cpp-netlib` release. |
| 113 | + |
| 114 | +Building with CMake |
| 115 | +=================== |
| 116 | + |
| 117 | +To build the tests that come with cpp-netlib, we first need to configure the |
| 118 | +build system to use our compiler of choice. This is done by running the |
| 119 | +``cmake`` command at the top-level directory of :mod:`cpp-netlib` with |
| 120 | +additional parameters:: |
| 121 | + |
| 122 | + $ mkdir ~/cpp-netlib-build |
| 123 | + $ cd ~/cpp-netlib-build |
| 124 | + $ cmake -DCMAKE_BUILD_TYPE=Debug \ |
| 125 | + > -DCMAKE_C_COMPILER=gcc \ |
| 126 | + > -DCMAKE_CXX_COMPILER=g++ \ |
| 127 | + > ../cpp-netlib |
| 128 | + |
| 129 | +.. note:: While it's not compulsory, it's recommended that |
| 130 | + :mod:`cpp-netlib` is built outside the source directory. |
| 131 | + For the purposes of documentation, we'll assume that all |
| 132 | + builds are done in ``~/cpp-netlib-build``. |
| 133 | + |
| 134 | +Building on Linux |
| 135 | +~~~~~~~~~~~~~~~~~ |
| 136 | + |
| 137 | +On Linux, this will generate the appropriate Makefiles that will enable you to |
| 138 | +build and run the tests and examples that come with :mod:`cpp-netlib`. To build |
| 139 | +the tests, you can run ``make`` in the same top-level directory of |
| 140 | +``~/cpp-netlib-build``:: |
| 141 | + |
| 142 | + $ make |
| 143 | + |
| 144 | +.. note:: Just like with traditional GNU Make, you can add the ``-j`` parameter |
| 145 | + to specify how many parallel builds to run. In case you're in a sufficiently |
| 146 | + powerful system and would like to parallelize the build into 4 jobs, you can |
| 147 | + do this with:: |
| 148 | + |
| 149 | + make -j4 |
| 150 | + |
| 151 | + As a caveat, :mod:`cpp-netlib` is heavy on template metaprogramming and will |
| 152 | + require a lot of computing and memory resources to build the individual |
| 153 | + tests. Do this at the risk of thrashing_ your system. However, this |
| 154 | + compile-time burden is much reduced in recent versions. |
| 155 | + |
| 156 | +.. _thrashing: http://en.wikipedia.org/wiki/Thrashing_(computer_science) |
| 157 | + |
| 158 | +Once the build has completed, you can now run the test suite by issuing:: |
| 159 | + |
| 160 | + $ make test |
| 161 | + |
| 162 | +Building On Windows |
| 163 | +~~~~~~~~~~~~~~~~~~~ |
| 164 | + |
| 165 | +If you're using the Microsoft Visual C++ compiler or the Microsoft Visual Studio |
| 166 | +IDE and you would like to build cpp-netlib from within Visual Studio, you can |
| 167 | +look for the solution and project files as the artifacts of the call to |
| 168 | +``cmake`` -- the file should be named ``CPP-NETLIB.sln`` (the solution) along |
| 169 | +with a number of project files for Visual Studio. |
| 170 | + |
| 171 | +.. note:: As of version 0.9.3, :mod:`cpp-netlib` produces three static |
| 172 | + libraries. Using GCC on Linux these are:: |
| 173 | + |
| 174 | + libcppnetlib-client-connections.a |
| 175 | + libcppnetlib-server-parsers.a |
| 176 | + libcppnetlib-uri.a |
| 177 | + |
| 178 | + And using Visual C++ on Windows they are:: |
| 179 | + |
| 180 | + cppnetlib-client-connections.lib |
| 181 | + cppnetlib-server-parsers.lib |
| 182 | + cppnetlib-uri.lib |
| 183 | + |
| 184 | + Users can find them in ``~/cpp-netlib-build/libs/network/src``. |
| 185 | + |
| 186 | +Reporting Issues, Getting Support |
| 187 | +================================= |
| 188 | + |
| 189 | +In case you find yourself stuck or if you've found a bug (or you want to just |
| 190 | +join the discussion) you have a few options to choose from. |
| 191 | + |
| 192 | +For reporting bugs, feature requests, and asking questions about the |
| 193 | +implementation and/or the documentation, you can go to the GitHub issues page |
| 194 | +for the project at http://github.com/cpp-netlib/cpp-netlib/issues. |
| 195 | + |
| 196 | +You can also opt to join the developers mailing list for a more personal |
| 197 | +interaction with the developers of the project. You can join the mailing list |
| 198 | +through http://groups.google.com/forum/#!forum/cpp-netlib. |
| 199 | + |
0 commit comments