blob: 7db8b0579990acfdff03ab467286fa7134a192ba [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Building with Conan &mdash; OpenPASS Documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/custom.css" type="text/css" />
<link rel="stylesheet" href="../_static/tabs.css" type="text/css" />
<link rel="shortcut icon" href="../_static/openPASS.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/tabs.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Overview" href="../user_guide/10_overview.html" />
<link rel="prev" title="Custom Protobuf Build" href="further_guidance/40_custom_proto.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> openPASS
<img src="../_static/openPASS.png" class="logo" alt="Logo"/>
</a>
<div class="version">
0.9.0
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Installation Guide</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="10_getting_started.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="20_install_prerequisites.html">Installing Prerequisites</a></li>
<li class="toctree-l1"><a class="reference internal" href="30_install_openpass.html">Installing OpenPASS</a></li>
<li class="toctree-l1"><a class="reference internal" href="50_further_guidance.html">Further Guidance</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Building with Conan</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#general">General</a></li>
<li class="toctree-l2"><a class="reference internal" href="#additional-prerequisites">Additional Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="#export-recipes">Export Recipes</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#conan-export">Conan Export</a></li>
<li class="toctree-l3"><a class="reference internal" href="#conan-install">Conan Install</a></li>
<li class="toctree-l3"><a class="reference internal" href="#conan-create">Conan Create</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#build-op">Build <strong>openPASS</strong></a></li>
<li class="toctree-l2"><a class="reference internal" href="#build-only-thirdparties">Build only ThirdParties</a></li>
</ul>
</li>
</ul>
<p class="caption" role="heading"><span class="caption-text">User Guides</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/10_overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/20_tutorials.html">Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/30_gui_plugins.html">GUI Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/40_configs_in_depth.html">Configs in Depth</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/50_outputs_in_depth.html">Outputs in Depth</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide/60_scenario_simulation.html">Simulator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Advanced topics</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../advanced_topics/20_simulator_advanced.html">Simulator</a></li>
<li class="toctree-l1"><a class="reference internal" href="../advanced_topics/30_testing.html">EndToEnd Test Framework</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Developer Information</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../developer_information/10_ide_support.html">IDE Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../developer_information/20_documentation.html">Documentation Concept</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Other Information</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../other_information/10_external_dependencies.html">External Dependencies</a></li>
<li class="toctree-l1"><a class="reference internal" href="../other_information/20_glossary.html">Glossary</a></li>
<li class="toctree-l1"><a class="reference internal" href="../other_information/30_license.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">openPASS</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li>Building with Conan</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/installation_guide/60_conan.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="building-with-conan">
<span id="id1"></span><h1>Building with Conan<a class="headerlink" href="#building-with-conan" title="Permalink to this headline"></a></h1>
<img alt="https://conan.io/img/logo-conan.svg" src="https://conan.io/img/logo-conan.svg" /><section id="general">
<h2>General<a class="headerlink" href="#general" title="Permalink to this headline"></a></h2>
<p>Conan is an open source, decentralized and multi-platform package manager to create and share native binaries.</p>
<p>To learn more about Conan itself you can visit <a class="reference external" href="https://conan.io/">Conan</a>.</p>
<p>Conan is used in the <strong>openPASS</strong> project to create and manage the binaries of the used ThirdParty libraries.</p>
</section>
<section id="additional-prerequisites">
<h2>Additional Prerequisites<a class="headerlink" href="#additional-prerequisites" title="Permalink to this headline"></a></h2>
<p>To be able to work with Conan it´s necessary to add additional packages.</p>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-0-0-0" aria-selected="true" class="sphinx-tabs-tab" id="tab-0-0-0" name="0-0" role="tab" tabindex="0">Windows (MSYS2)</button><button aria-controls="panel-0-0-1" aria-selected="false" class="sphinx-tabs-tab" id="tab-0-0-1" name="0-1" role="tab" tabindex="-1">Linux (Debian Bullseye)</button></div><div aria-labelledby="tab-0-0-0" class="sphinx-tabs-panel" id="panel-0-0-0" name="0-0" role="tabpanel" tabindex="0"><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>pip install conan
</pre></div>
</div>
</div><div aria-labelledby="tab-0-0-1" class="sphinx-tabs-panel" hidden="true" id="panel-0-0-1" name="0-1" role="tabpanel" tabindex="0"><div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>apt install conan
</pre></div>
</div>
</div></div>
</section>
<section id="export-recipes">
<h2>Export Recipes<a class="headerlink" href="#export-recipes" title="Permalink to this headline"></a></h2>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>A <em>recipe</em> is python file, which is used by conan to build and create a package.
In this file there are several hooks available, which can be used for several tasks.
E.g. Retrieving the source files, building from source, configuring dependencies, packaging, etc.
Visit <a class="reference external" href="https://conan.io/">Conan</a>. for detailed information about <em>recipes</em>.</p>
</div>
<p>To make Conan aware and to use the custom recipes for the ThirdParty libraries, these recipes have to be exported to the <em>local cache</em> of Conan.
This can be done in different ways.</p>
<section id="conan-export">
<h3>Conan Export<a class="headerlink" href="#conan-export" title="Permalink to this headline"></a></h3>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> &lt;path to conanfile.py of recipe&gt;
conan <span class="nb">export</span> . &lt;optional user&gt;/&lt;optional channel&gt;
</pre></div>
</div>
<p>The optional user and channel flags can be used to export a recipe while it´s still in development.
In that case there could be several different versions and their corresponding binaries of the same library available at the same time.
The <em>local cache</em> could then show the following packages.
E.g.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>packagename/3.2.0
packagename/3.2.0@openpassWG/stable
packagename/3.3.0@myUserName/testing
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>At least this step has to be done in prior before any ThirdParty library can be installed by Conan.
Every upcoming step is optional, but can be useful while developing or debugging.
Also with these steps it´s possible to install ThirdParty libraries separately.</p>
</div>
</section>
<section id="conan-install">
<h3>Conan Install<a class="headerlink" href="#conan-install" title="Permalink to this headline"></a></h3>
<p>Conan is now able to differentiate different version and the user can now install exactly the version he wishes to.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>conan install &lt;package_name&gt;
</pre></div>
</div>
<p>This command has a look into the <em>local cache</em> for the recipe and the binaries of the package and installs them into the <em>local cache</em>.
If no binaries where found an error is thrown.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>To make conan also build the package the command can be appended with the following argument: <code class="docutils literal notranslate"><span class="pre">--build=missing</span></code>.</p>
</div>
</section>
<section id="conan-create">
<h3>Conan Create<a class="headerlink" href="#conan-create" title="Permalink to this headline"></a></h3>
<p>Both of the previous commands can be combined with the <code class="docutils literal notranslate"><span class="pre">create`</span></code> command. What it basically does is calling <code class="docutils literal notranslate"><span class="pre">export</span></code> and <code class="docutils literal notranslate"><span class="pre">install</span></code> after another.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nb">cd</span> &lt;path to conanfile.py of recipe&gt;
conan create . &lt;optional user&gt;/&lt;optional channel&gt;
</pre></div>
</div>
<p>At this step the binaries of this package are now available in the <em>local cache</em>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>There are several additional commands, arguments and fields for these commands available.
Please see <a class="reference external" href="https://docs.conan.io/en/latest/">Conan Docs</a> for additional information.</p>
</div>
</section>
</section>
<section id="build-op">
<h2>Build <strong>openPASS</strong><a class="headerlink" href="#build-op" title="Permalink to this headline"></a></h2>
<p>If you followed the previous steps and export all dependencies and <strong>openPASS</strong> recipes to Conans <em>local cache</em>, then you can go on with the next steps.
If not then at least the <code class="docutils literal notranslate"><span class="pre">export</span></code> should be done.
Else Conan is not able to know how to build the dependencies and <strong>openPASS</strong>.</p>
<p><strong>openPASS</strong> can be build using a <code class="docutils literal notranslate"><span class="pre">conanfile.txt</span></code>.
It holds every Information which is needed to build and install <strong>openPASS</strong>.</p>
<p>The following file shows an example which can be used.
This example is also available in the <code class="docutils literal notranslate"><span class="pre">conan</span></code> folder in the <code class="docutils literal notranslate"><span class="pre">simopenpass</span></code> repository.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">requires</span><span class="p">]</span>
<span class="n">openpass</span><span class="o">/</span><span class="mf">0.8</span>
<span class="p">[</span><span class="n">generators</span><span class="p">]</span>
<span class="n">cmake</span>
<span class="p">[</span><span class="n">imports</span><span class="p">]</span>
<span class="o">.</span> <span class="p">,</span> <span class="o">*</span> <span class="o">-&gt;</span> <span class="n">C</span><span class="p">:</span><span class="o">/</span><span class="n">openpass</span> <span class="o">@</span>
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">requires</span></code> field describes what package with what version shall be installed.
It´s also possible to add more packages here or change the version.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">generator</span></code> field is used to add different generators to the process.
In this example the <code class="docutils literal notranslate"><span class="pre">cmake</span></code> generator would generate cmake files, which describe where to find the <strong>openPASS</strong> in the <em>local cache</em>.
There are also other possibilities like a <code class="docutils literal notranslate"><span class="pre">cmake_find_package</span></code> generator, which generates <em>cmake</em> <em>FindPackage</em> files.</p>
<p>At this point <strong>openPASS</strong> only exists in the <em>local cache</em> of Conan.
With the <code class="docutils literal notranslate"><span class="pre">imports</span></code> field it´s possible to specify where and how the binaries shall be copied from the <em>local cache</em> to the <em>user space</em>.
The example follows the following pattern:</p>
<blockquote>
<div><p>&lt;source&gt;, &lt;pattern&gt; -&gt; &lt;destination&gt;</p>
</div></blockquote>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is possible to add several lines for more specific copying operations.
Also there are more field available than this simple example shows.
See <a class="reference external" href="https://docs.conan.io/en/latest/">Conan Docs</a> for additional information.</p>
</div>
<p>Conan can simply install <strong>openPASS</strong> with the following command.
If the dependencies or <strong>openPASS</strong> were not build in any previous step, the binaries will not be available in the <em>local cache</em> of Conan.
Conan can build them by adding <code class="docutils literal notranslate"><span class="pre">--build=missing</span></code> to the following command.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>conan install &lt;path to conanfile.txt&gt;
</pre></div>
</div>
</section>
<section id="build-only-thirdparties">
<h2>Build only ThirdParties<a class="headerlink" href="#build-only-thirdparties" title="Permalink to this headline"></a></h2>
<p>The ThirdParty libraries can be build and installed the same way.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">requires</span><span class="p">]</span>
<span class="n">OSI</span><span class="o">/</span><span class="mf">3.2</span><span class="o">.</span><span class="mi">0</span>
<span class="n">FMILibrary</span><span class="o">/</span><span class="mf">2.0</span><span class="o">.</span><span class="mi">3</span>
<span class="p">[</span><span class="n">generators</span><span class="p">]</span>
<span class="n">cmake_find_package</span>
<span class="n">cmake_paths</span>
<span class="p">[</span><span class="n">imports</span><span class="p">]</span>
<span class="o">.</span> <span class="p">,</span> <span class="o">*</span> <span class="o">-&gt;</span> <span class="n">C</span><span class="p">:</span><span class="o">/</span><span class="n">openpass</span><span class="o">/</span><span class="n">ThirdParty</span> <span class="o">@</span>
</pre></div>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="further_guidance/40_custom_proto.html" class="btn btn-neutral float-left" title="Custom Protobuf Build" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../user_guide/10_overview.html" class="btn btn-neutral float-right" title="Overview" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2022 OpenPASS Working Group.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>