build.html 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  3. <title>Build and install - Boost.Outcome documentation</title>
  4. <link rel="stylesheet" href="./css/boost.css" type="text/css">
  5. <meta name="generator" content="Hugo 0.52 with Boostdoc theme">
  6. <meta name="viewport" content="width=device-width,initial-scale=1.0"/>
  7. <link rel="icon" href="./images/favicon.ico" type="image/ico"/>
  8. <body><div class="spirit-nav">
  9. <a accesskey="p" href="./requirements.html"><img src="./images/prev.png" alt="Prev"></a>
  10. <a accesskey="u" href="./index.html"><img src="./images/up.png" alt="Up"></a>
  11. <a accesskey="h" href="./index.html"><img src="./images/home.png" alt="Home"></a><a accesskey="n" href="./motivation.html"><img src="./images/next.png" alt="Next"></a></div><div id="content">
  12. <div class="titlepage"><div><div><h1 style="clear: both">Build and install</h1></div></div></div>
  13. <h2 id="usage-as-a-single-header-file">Usage as a single header file</h2>
  14. <p>Outcome v2 comes in single header file form. This is regenerated per commit. To fetch
  15. on Linux:</p>
  16. <pre><code>wget https://github.com/ned14/outcome/raw/master/single-header/outcome.hpp
  17. </code></pre>
  18. <p>On BSD:</p>
  19. <pre><code>fetch https://github.com/ned14/outcome/raw/master/single-header/outcome.hpp
  20. </code></pre>
  21. <p>If you have <code>curl</code> installed:</p>
  22. <pre><code>curl -O -J -L https://github.com/ned14/outcome/raw/master/single-header/outcome.hpp
  23. </code></pre>
  24. <p>Otherwise, simply download the raw file from above and place it wherever it suits you.
  25. If you might be debugging using Microsoft Visual Studio, you may find the debugger
  26. visualisation file at <a href="https://github.com/ned14/outcome/raw/master/include/outcome/outcome.natvis">https://github.com/ned14/outcome/raw/master/include/outcome/outcome.natvis</a>
  27. useful to include into your build.</p>
  28. <h2 id="usage-from-the-conan-package-manager">Usage from the Conan package manager</h2>
  29. <p><em>(thanks to Théo Delrieu for contributing this support)</em></p>
  30. <p>At the command line, add the bintray repo for Outcome to conan:</p>
  31. <pre><code>conan remote add outcome https://api.bintray.com/conan/ned14/Outcome
  32. </code></pre>
  33. <p>Now simply add this to your Conan build:</p>
  34. <pre><code>[requires]
  35. Outcome/master@ned14/stable
  36. </code></pre>
  37. <p>Outcome will be made available by Conan at <code>&lt;outcome.hpp&gt;</code>.</p>
  38. <h2 id="usage-as-a-git-submodule">Usage as a git submodule</h2>
  39. <p>If you are very keen on tracking very latest Outcome, you can add it as a git
  40. submodule to your project so you can keep abreast of bug fixes. Here is how:</p>
  41. <pre><code>git submodule add https://github.com/ned14/outcome
  42. cd outcome
  43. git checkout master
  44. git submodule update --init --recursive
  45. </code></pre>
  46. <p>After this you can bring Outcome into your code using:</p>
  47. <pre><code>#include &quot;outcome/include/outcome.hpp&quot;
  48. </code></pre>
  49. <p>That&rsquo;s it, you are ready to go. From time to time, you may wish to update to
  50. latest:</p>
  51. <pre><code>cd outcome
  52. git pull
  53. git submodule update
  54. </code></pre>
  55. <h2 id="usage-as-a-stable-source-tarball">Usage as a stable source tarball</h2>
  56. <p>If you would prefer a single source tarball of the stable branch containing
  57. all the documentation, tests and sources, this can always be retrieved from:</p>
  58. <p><a href="https://dedi5.nedprod.com/static/files/outcome-v2.0-source-latest.tar.xz">https://dedi5.nedprod.com/static/files/outcome-v2.0-source-latest.tar.xz</a></p>
  59. <p>This tarball is automatically generated when Outcome fully compiles and passes
  60. all unit tests on all platforms tested by the CIs. This currently includes:</p>
  61. <ul>
  62. <li>Linux: GCC 6.5, clang 4.0.1</li>
  63. <li>MacOS: XCode 9</li>
  64. <li>Windows: VS2017.9</li>
  65. </ul>
  66. <p>It should be emphasised that newer compilers are not tested, so there is
  67. an unlikely chance that the tarball may not work on a newer compiler.</p>
  68. <hr>
  69. <h1 id="running-the-unit-test-suite">Running the unit test suite</h1>
  70. <p>To run the unit test suite you will need cmake 3.1 or later installed.</p>
  71. <pre><code>mkdir build
  72. cd build
  73. cmake ..
  74. cmake --build .
  75. ctest
  76. </code></pre>
  77. <p>On some cmake generators (Visual Studio, Xcode) you may need to tell cmake build a configuration
  78. like Release or Debug. Similarly, ctest needs to be told the same e.g.</p>
  79. <pre><code>mkdir build
  80. cd build
  81. cmake ..
  82. cmake --build . --config Release
  83. ctest -C Release
  84. </code></pre>
  85. <p><a href="http://my.cdash.org/index.php?project=Boost.Outcome">Per commit, tests are run by Travis and uploaded to a CDash dashboard here</a>.</p>
  86. <hr>
  87. <h1 id="modular-cmake-build-support">Modular CMake build support</h1>
  88. <p>If you are using Outcome in a CMake project, Outcome is a &ldquo;modular cmake&rdquo; project
  89. using only modern cmake 3 throughout. This lets you add the Outcome directory as a
  90. cmake subdirectory with no unexpected consequence on the rest of your cmake. You will need
  91. to be using cmake 3.1 or better.</p>
  92. <pre><code>add_subdirectory(
  93. &quot;${CMAKE_CURRENT_SOURCE_DIR}/outcome&quot; # path to outcome source
  94. &quot;${CMAKE_CURRENT_BINARY_DIR}/outcome&quot; # your choice of where to put binaries
  95. EXCLUDE_FROM_ALL # please only lazy build outcome on demand
  96. )
  97. </code></pre>
  98. <p>Outcome&rsquo;s cmake has the following useful products:</p>
  99. <ul>
  100. <li><code>outcome::hl</code> (target): the Outcome header-only library. Add this to any
  101. <code>target_link_libraries()</code> in your cmake to bring in Outcome as a header-only library. This will also
  102. add to your link (via <code>PUBLIC</code>) any debugger visualisation support files, any system library
  103. dependencies and also force all consuming executables to be configured with a minimum
  104. of C++ 14 as Outcome requires a minimum of that.</li>
  105. <li><code>outcome_TEST_TARGETS</code> (list): a list of targets which generate Outcome&rsquo;s test
  106. suite. You can append this to your own test suite if you wish to run Outcome&rsquo;s test
  107. suite along with your own.</li>
  108. </ul>
  109. </div><p><small>Last revised: February 06, 2019 at 14:38:54 UTC</small></p>
  110. <hr>
  111. <div class="spirit-nav">
  112. <a accesskey="p" href="./requirements.html"><img src="./images/prev.png" alt="Prev"></a>
  113. <a accesskey="u" href="./index.html"><img src="./images/up.png" alt="Up"></a>
  114. <a accesskey="h" href="./index.html"><img src="./images/home.png" alt="Home"></a><a accesskey="n" href="./motivation.html"><img src="./images/next.png" alt="Next"></a></div></body>
  115. </html>