| 1 | {{{ |
| 2 | Doxygen Integration with Breathe |
| 3 | ================================ |
| 4 | People say that the best way to use C++ with Sphinx is with Breathe. It seems to work, with some limitations though. |
| 5 | |
| 6 | Requirements |
| 7 | ------------ |
| 8 | |
| 9 | 1. Sphinx: http://sphinx-doc.org. I installed with PyPI:: |
| 10 | |
| 11 | $ sudo pip install sphinx |
| 12 | 2. Breathe: http://michaeljones.github.io/breathe/index.html. I installed with PyPI:: |
| 13 | |
| 14 | $ sudo pip install breathe |
| 15 | |
| 16 | 3. Doxygen. I installed from Ubuntu package. |
| 17 | 4. Some say Pygments are needed for syntax coloring. I didn't remember installing it, maybe it was preinstalled, and I have no problem with syntax coloring (see demo below). |
| 18 | |
| 19 | |
| 20 | Setup |
| 21 | ----- |
| 22 | The emailed a tarball containing the pjsip-book source files with Doxygen integration. HTML output has already been generated for sample. Put this in `$PJ_DIR/doc` so that it becomes `$PJDIR/doc/pjsip-book`. Then just run make:: |
| 23 | |
| 24 | $ make |
| 25 | |
| 26 | This will build HTML documentation in `_build/html` directory. T build PDF, run:: |
| 27 | |
| 28 | $ make latexpdf |
| 29 | |
| 30 | |
| 31 | .. default-domain:: cpp |
| 32 | |
| 33 | How to Use Integrate Book with Doxygen |
| 34 | -------------------------------------- |
| 35 | Quick sample:: |
| 36 | |
| 37 | will be rendered like this: |
| 38 | +++++++++++++++++++++++++++ |
| 39 | |
| 40 | This is how to quote a code with syntax coloring: |
| 41 | |
| 42 | .. code-block:: c++ |
| 43 | |
| 44 | pj::AudioMediaPlayer *player = new AudioMediaPlayer; |
| 45 | player->createPlayer("announcement.wav"); |
| 46 | |
| 47 | There are many ways to refer a symbol: |
| 48 | |
| 49 | * A method: :cpp:func:`pj::AudioMediaPlayer::createPlayer()` |
| 50 | * A method with alternate display: :cpp:func:`a method <pj::AudioMediaPlayer::createPlayer()>` |
| 51 | * A class :cpp:class:`pj::AudioMediaPlayer` |
| 52 | * A class with alternate display: :cpp:class:`a class <pj::AudioMediaPlayer>` |
| 53 | |
| 54 | For that links to work, we need to display the link target declaration (a class or method) |
| 55 | somewhere in the doc, like this: |
| 56 | |
| 57 | .. doxygenclass:: pj::AudioMediaPlayer |
| 58 | :path: xml |
| 59 | :members: |
| 60 | |
| 61 | Alternatively we can display a single method declaration like this: |
| 62 | |
| 63 | .. doxygenfunction:: pj::AudioMediaPlayer::createPlayer() |
| 64 | :path: xml |
| 65 | :no-link: |
| 66 | |
| 67 | We can also display class declaration with specific members. |
| 68 | |
| 69 | For more info see `Breathe documentation <http://michaeljones.github.io/breathe/domains.html>`_ |
| 70 | |
| 71 | |
| 72 | |
| 73 | will be rendered like this: |
| 74 | +++++++++++++++++++++++++++ |
| 75 | |
| 76 | This is how to quote a code with syntax coloring: |
| 77 | |
| 78 | .. code-block:: c++ |
| 79 | |
| 80 | pj::AudioMediaPlayer *player = new AudioMediaPlayer; |
| 81 | player->createPlayer("announcement.wav"); |
| 82 | |
| 83 | There are many ways to refer a symbol: |
| 84 | |
| 85 | * A method: :cpp:func:`pj::AudioMediaPlayer::createPlayer()` |
| 86 | * A method with alternate display: :cpp:func:`a method <pj::AudioMediaPlayer::createPlayer()>` |
| 87 | * A class :cpp:class:`pj::AudioMediaPlayer` |
| 88 | * A class with alternate display: :cpp:class:`a class <pj::AudioMediaPlayer>` |
| 89 | |
| 90 | For that links to work, we need to display the link target declaration (a class or method) somewhere in the doc, like this: |
| 91 | |
| 92 | .. doxygenclass:: pj::AudioMediaPlayer |
| 93 | :path: xml |
| 94 | :members: |
| 95 | |
| 96 | Alternatively we can display a single method declaration like this: |
| 97 | |
| 98 | .. doxygenfunction:: pj::AudioMediaPlayer::createPlayer() |
| 99 | :path: xml |
| 100 | :no-link: |
| 101 | |
| 102 | We can also display class declaration with specific members. |
| 103 | |
| 104 | For more info see `Breathe documentation <http://michaeljones.github.io/breathe/domains.html>`_ |
| 105 | |
| 106 | |
| 107 | |
| 108 | }}} |