blob: 9681caf0c3bd33d00aba278ac0c341eaa59da670 [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Working with VSCode &mdash; OpenPASS Documentation</title>
<link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<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/tabs.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/css/custom.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 type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
<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 type="text/javascript" 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="Working with Qt Creator" href="20_qt_creator.html" />
<link rel="prev" title="Building under Linux" href="../installation/60_linux.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">
9999.9999.9999
</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="main navigation">
<p class="caption"><span class="caption-text">Installation Guides</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../10_gui_installation_guide.html">GUI Installation Guide</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../20_sim_installation_guide.html">Simulation Installation Guide</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../meta/sphinx.html">Sphinx</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/10_quickstart.html">Quick Start</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/20_prerequisites.html">Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/30_build_prerequisites.html">Building Prerequisites</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/40_cmake.html">Cmake Build Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/50_windows.html">Building under Windows</a></li>
<li class="toctree-l2"><a class="reference internal" href="../installation/60_linux.html">Building under Linux</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Working with VSCode</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#assumptions">Assumptions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#install-and-config">Install and Config</a></li>
<li class="toctree-l3"><a class="reference internal" href="#testing">Testing</a></li>
<li class="toctree-l3"><a class="reference internal" href="#debugging">Debugging</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="20_qt_creator.html">Working with Qt Creator</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../21_pcm_installation_guide.html">PCM Installation Guide</a></li>
</ul>
<p class="caption"><span class="caption-text">User Guides</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../user_guide/10_gui_user_guide.html">GUI User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../user_guide/20_sim_user_guide.html">Simulation User Guide</a></li>
</ul>
<p class="caption"><span class="caption-text">Advanced topics</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../advanced_topics/10_documentation.html">Documentation Concept</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../advanced_topics/20_simulator_advanced.html">Simulator</a></li>
</ul>
<p class="caption"><span class="caption-text">Other Information</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary.html">Glossary</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../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="top navigation">
<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="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="../../20_sim_installation_guide.html">Simulation Installation Guide</a> &raquo;</li>
<li>Working with VSCode</li>
<li class="wy-breadcrumbs-aside">
<a href="../../../_sources/installation_guide/sim_installation_guide/ides/10_vscode.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">
<div class="section" id="working-with-vscode">
<h1>Working with VSCode<a class="headerlink" href="#working-with-vscode" title="Permalink to this headline"></a></h1>
<p>This section describes the basic setup for Visual Studio Code.
Use it as a template for starting.</p>
<div class="figure align-center" id="id1">
<a class="reference internal image-reference" href="../../../_images/vscode.png"><img alt="../../../_images/vscode.png" src="../../../_images/vscode.png" style="width: 794.4px; height: 427.8px;" /></a>
<p class="caption"><span class="caption-text">Proper setup VSCode showing <strong>left</strong>, debugging, testmate, and cmake pane selectors, and at the <strong>bottom</strong>, build type, kit, current target, and CTest runner.</span><a class="headerlink" href="#id1" title="Permalink to this image"></a></p>
</div>
<div class="section" id="assumptions">
<h2>Assumptions<a class="headerlink" href="#assumptions" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>For Windows, it is expected, that a <strong>MSYS2/MinGW 64 Bit</strong> is used.</p></li>
<li><p>For brevity, non-standard libraries are expected to be in the folder <code class="docutils literal notranslate"><span class="pre">deps/thirdParty</span></code>.</p></li>
</ul>
</div>
<div class="section" id="install-and-config">
<h2>Install and Config<a class="headerlink" href="#install-and-config" title="Permalink to this headline"></a></h2>
<ol class="arabic">
<li><p>Install Visual Studio Code</p></li>
<li><p>Install extensions</p>
<ul class="simple">
<li><p>C/C++</p></li>
<li><p>CMake Tools</p></li>
<li><p>C++ Testmate</p></li>
</ul>
</li>
<li><p>Open the repository as folder, e.g. by calling <code class="docutils literal notranslate"><span class="pre">code</span> <span class="pre">simopenpass</span></code> after checking out.
If CMakeTools are setup right, it should as, if you like to configure it now and always on opening.
Say yes to configuration, which will create a <code class="docutils literal notranslate"><span class="pre">build</span></code> folder, but fails to do more (config follows below).</p></li>
<li><p><strong>Windows only</strong> Make Kit available:</p>
<ol class="arabic">
<li><p><code class="docutils literal notranslate"><span class="pre">Ctrk+Shift+P</span></code>: <code class="docutils literal notranslate"><span class="pre">CMake:</span> <span class="pre">Edit</span> <span class="pre">User-Local</span> <span class="pre">CMake</span> <span class="pre">Kits</span></code></p></li>
<li><p>Insert/Update:</p>
<div class="highlight-JSON notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;MinGW64 GCC&quot;</span><span class="p">,</span>
<span class="nt">&quot;compilers&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;C&quot;</span><span class="p">:</span> <span class="s2">&quot;C:\\msys64\\mingw64\\bin\\gcc.exe&quot;</span><span class="p">,</span>
<span class="nt">&quot;CXX&quot;</span><span class="p">:</span> <span class="s2">&quot;C:\\msys64\\mingw64\\bin\\g++.exe&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;preferredGenerator&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;MinGW Makefiles&quot;</span>
<span class="p">},</span>
<span class="nt">&quot;environmentVariables&quot;</span><span class="p">:</span> <span class="p">{</span>
<span class="nt">&quot;PATH&quot;</span><span class="p">:</span> <span class="s2">&quot;C:\\msys64\\mingw64\\bin&quot;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</li>
</ol>
<p>+. <code class="docutils literal notranslate"><span class="pre">Ctrk+Shift+P</span></code>: <code class="docutils literal notranslate"><span class="pre">CMake:</span> <span class="pre">Select</span> <span class="pre">a</span> <span class="pre">Kit</span></code> = <code class="docutils literal notranslate"><span class="pre">MinGW64</span> <span class="pre">GCC</span></code></p>
</li>
<li><p>Configure:</p>
<ol class="arabic">
<li><p><code class="docutils literal notranslate"><span class="pre">Ctrk+Shift+P</span></code>: <code class="docutils literal notranslate"><span class="pre">Preferences</span> <span class="pre">Open</span> <span class="pre">Workspace</span> <span class="pre">Settings</span> <span class="pre">(JSON)</span></code></p></li>
<li><p>Insert/Update:</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</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</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-JSON notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="nt">&quot;cmake.cmakePath&quot;</span><span class="p">:</span> <span class="s2">&quot;C:\\msys64\\mingw64\\bin\\cmake.exe&quot;</span><span class="p">,</span>
<span class="nt">&quot;cmake.mingwSearchDirs&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;C:\\msys64\\mingw64\\bin&quot;</span>
<span class="p">],</span>
<span class="nt">&quot;cmake.generator&quot;</span><span class="p">:</span> <span class="s2">&quot;MinGW Makefiles&quot;</span><span class="p">,</span>
<span class="nt">&quot;cmake.parallelJobs&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
<span class="nt">&quot;cmake.configureArgs&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;-DCMAKE_PREFIX_PATH=${workspaceRoot}/deps/thirdParty/win64/FMILibrary;${workspaceRoot}/deps/thirdParty/win64/osi&quot;</span><span class="p">,</span>
<span class="s2">&quot;-DUSE_CCACHE=ON&quot;</span><span class="p">,</span>
<span class="s2">&quot;-DWITH_EXTENDED_OSI=ON&quot;</span><span class="p">,</span>
<span class="s2">&quot;-DWITH_DEBUG_POSTFIX=OFF&quot;</span><span class="p">,</span>
<span class="s2">&quot;-DOPENPASS_ADJUST_OUTPUT=OFF&quot;</span>
<span class="p">]</span>
<span class="p">}</span>
</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-JSON notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="nt">&quot;cmake.parallelJobs&quot;</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
<span class="nt">&quot;cmake.configureArgs&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s2">&quot;-DCMAKE_PREFIX_PATH=${workspaceRoot}/deps/thirdParty/linux64/FMILibrary;${workspaceRoot}/deps/thirdParty/linux64/osi&quot;</span><span class="p">,</span>
<span class="s2">&quot;-DUSE_CCACHE=ON&quot;</span><span class="p">,</span>
<span class="s2">&quot;-DCMAKE_INSTALL_PREFIX=/OpenPASS/bin&quot;</span>
<span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
</div></div>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">Ctrk+Shift+P</span></code>: <code class="docutils literal notranslate"><span class="pre">CMake:</span> <span class="pre">Configure</span></code> - cmake should now be able to configure the project.
If not, cmake should give you at least a hint, what’s missing (normally external libraries).
Read <a class="reference internal" href="../installation/40_cmake.html#cmake"><span class="std std-ref">Cmake Build Environment</span></a> or <a class="reference internal" href="../installation/20_prerequisites.html#prerequisites"><span class="std std-ref">Prerequisites</span></a> for more information.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>When changing libraries, it’s recommended to wipe the cmake cache before reconfiguration:
<code class="docutils literal notranslate"><span class="pre">Ctrk+Shift+P</span></code> &gt; <code class="docutils literal notranslate"><span class="pre">CMake:</span> <span class="pre">Delete</span> <span class="pre">Cache</span> <span class="pre">and</span> <span class="pre">Reconfigure</span></code></p>
</div>
</li>
</ol>
</li>
</ol>
</div>
<div class="section" id="testing">
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline"></a></h2>
<p>Testmate discovers tests only after they are built for the first time.
It pays to run <code class="docutils literal notranslate"><span class="pre">ctest</span></code> on the console to build all test targets.
After this, you should see all tests in the testing pane on the left.
If not, check the extension setting <code class="docutils literal notranslate"><span class="pre">testMate.cpp.test.executables</span></code> and <code class="docutils literal notranslate"><span class="pre">testMate.cpp.test.workingDirectory</span></code></p>
</div>
<div class="section" id="debugging">
<h2>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline"></a></h2>
<p>Cmake offers its own debugging functionality, but does not respect the dependencies between the <strong>openPASS</strong> core and its components.
This means, it tries to run the executable from within the build folder, e.g. <code class="docutils literal notranslate"><span class="pre">./build/sim/src/core/slave/OpenPassSlave</span></code>.
Unfortunately, in here, the core does not find any libraries or configurations.</p>
<p>As a solution, setup a debug target, pointing at the installed executable instead:</p>
<ol class="arabic simple">
<li><p>Got to “Run and Debug” (<code class="docutils literal notranslate"><span class="pre">Ctrl+Shift+D</span></code>) and <em>create a launch.json file</em>.</p></li>
<li><p>Insert/Update:</p></li>
</ol>
<div class="sphinx-tabs docutils container">
<div aria-label="Tabbed content" class="closeable" role="tablist"><button aria-controls="panel-1-1-0" aria-selected="true" class="sphinx-tabs-tab" id="tab-1-1-0" name="1-0" role="tab" tabindex="0">Windows</button><button aria-controls="panel-1-1-1" aria-selected="false" class="sphinx-tabs-tab" id="tab-1-1-1" name="1-1" role="tab" tabindex="-1">Linux</button></div><div aria-labelledby="tab-1-1-0" class="sphinx-tabs-panel" id="panel-1-1-0" name="1-0" role="tabpanel" tabindex="0"><div class="highlight-JSON notranslate"><div class="highlight"><pre><span></span>{
&quot;configurations&quot;: [
{
&quot;name&quot;: &quot;Debug OpenPass&quot;,
&quot;type&quot;: &quot;cppdbg&quot;,
&quot;request&quot;: &quot;launch&quot;,
&quot;program&quot;: &quot;C:/OpenPASS/bin/core/OpenPassSlave.exe&quot;,
&quot;args&quot;: [],
&quot;stopAtEntry&quot;: false,
&quot;cwd&quot;: &quot;c:/openpass/bin/core&quot;,
&quot;environment&quot;: [],
&quot;externalConsole&quot;: false,
&quot;MIMode&quot;: &quot;gdb&quot;,
&quot;miDebuggerPath&quot;: &quot;C:/msys64/mingw64/bin/gdb.exe&quot;,
&quot;setupCommands&quot;: [
{
&quot;description&quot;: &quot;Enable pretty-printing for gdb&quot;,
&quot;text&quot;: &quot;-enable-pretty-printing&quot;,
&quot;ignoreFailures&quot;: true
}
]
}
}
</pre></div>
</div>
</div><div aria-labelledby="tab-1-1-1" class="sphinx-tabs-panel" hidden="true" id="panel-1-1-1" name="1-1" role="tabpanel" tabindex="0"><div class="highlight-JSON notranslate"><div class="highlight"><pre><span></span>{
&quot;configurations&quot;: [
{
&quot;name&quot;: &quot;Debug OpenPass&quot;,
&quot;type&quot;: &quot;cppdbg&quot;,
&quot;request&quot;: &quot;launch&quot;,
&quot;program&quot;: &quot;/openPASS/bin/core/OpenPassSlave&quot;,
&quot;args&quot;: [],
&quot;stopAtEntry&quot;: false,
&quot;cwd&quot;: &quot;/openPASS/bin/core/&quot;,
&quot;environment&quot;: [],
&quot;externalConsole&quot;: false,
&quot;MIMode&quot;: &quot;gdb&quot;,
&quot;setupCommands&quot;: [
{
&quot;description&quot;: &quot;Enable pretty-printing for gdb&quot;,
&quot;text&quot;: &quot;-enable-pretty-printing&quot;,
&quot;ignoreFailures&quot;: true
}
]
}
}
</pre></div>
</div>
</div></div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>Don’t forget to run the target <code class="docutils literal notranslate"><span class="pre">install</span></code> before debugging.</p>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="20_qt_creator.html" class="btn btn-neutral float-right" title="Working with Qt Creator" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="../installation/60_linux.html" class="btn btn-neutral float-left" title="Building under Linux" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&#169; Copyright 2021 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 type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>