Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 737a0d2434bad0661da784e0f3e0ca66 > files > 262

extra-cmake-modules-5.57.0-1.mga7.noarch.rpm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>AndroidToolchain &#8212; Extra CMake Modules 5.57.0 documentation</title>
    <link rel="stylesheet" href="../_static/ecm.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    
    <link rel="shortcut icon" href="../_static/kde-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="prev" title="ecm-toolchains(7)" href="../manual/ecm-toolchains.7.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../manual/ecm-toolchains.7.html" title="ecm-toolchains(7)"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">ECM 5.57 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../manual/ecm-toolchains.7.html" accesskey="U">ecm-toolchains(7)</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="androidtoolchain">
<span id="toolchain:Android"></span><h1>AndroidToolchain<a class="headerlink" href="#androidtoolchain" title="Permalink to this headline">¶</a></h1>
<p>Enable easy compilation of cmake projects on Android.</p>
<p>By using this android toolchain, the projects will be set up to compile the
specified project targeting an Android platform, depending on its input.
Furthermore, if desired, an APK can be directly generated by using the
<a class="reference external" href="https://doc.qt.io/qt-5/deployment-android.html">androiddeployqt</a> tool.</p>
<p>CMake upstream has Android support now. This module will still give us some
useful features offering androiddeployqt integration and adequate executables
format for our Android applications.</p>
<p>Since we are using CMake Android support, any information from CMake documentation
still applies:
<a class="reference external" href="https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android">https://cmake.org/cmake/help/v3.7/manual/cmake-toolchains.7.html#cross-compiling-for-android</a></p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This module requires CMake 3.7.</p>
</div>
<p>Since 1.7.0.</p>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>To use this file, you need to set the <code class="docutils literal notranslate"><span class="pre">CMAKE_TOOLCHAIN_FILE</span></code> to point to
<code class="docutils literal notranslate"><span class="pre">Android.cmake</span></code> on the command line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> <span class="o">-</span><span class="n">DCMAKE_TOOLCHAIN_FILE</span><span class="o">=/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">ECM</span><span class="o">/</span><span class="n">toolchain</span><span class="o">/</span><span class="n">Android</span><span class="o">.</span><span class="n">cmake</span>
</pre></div>
</div>
<p>You will also need to provide the locations of the Android NDK and SDK. This
can be done on the commandline or with environment variables; in either case
the variable names are:</p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">CMAKE_ANDROID_NDK</span></code></dt>
<dd>The NDK root path.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ANDROID_SDK_ROOT</span></code></dt>
<dd>The SDK root path.</dd>
</dl>
<p>Additional options are specified as cache variables (eg: on the command line):</p>
<dl class="docutils">
<dt><code class="docutils literal notranslate"><span class="pre">ANDROID_ABI</span></code></dt>
<dd>The ABI to use. See the <code class="docutils literal notranslate"><span class="pre">sources/cxx-stl/gnu-libstdc++/*/libs</span></code>
directories in the NDK. Default: <code class="docutils literal notranslate"><span class="pre">armeabi-v7a</span></code>.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ANDROID_SDK_BUILD_TOOLS_REVISION</span></code></dt>
<dd>The build tools version to use. Default: <code class="docutils literal notranslate"><span class="pre">21.1.1</span></code>.</dd>
<dt><code class="docutils literal notranslate"><span class="pre">ANDROID_EXTRA_LIBS</span></code></dt>
<dd>The “;”-separated list of full paths to libs to include in resulting APK.</dd>
</dl>
<p>For integrating other libraries which are not part of the Android toolchain,
like Qt5, and installed to a separate prefix on the host system, the install
prefixes of those libraries would be passed as alternative roots as list via
<code class="docutils literal notranslate"><span class="pre">ECM_ADDITIONAL_FIND_ROOT_PATH</span></code>. Since 5.30.0.</p>
<p>For example, for integrating a Qt5 for Android with armv7 target present at
<code class="docutils literal notranslate"><span class="pre">/opt/android/Qt5/5.7/android_armv7</span></code> and some other libraries installed to
the prefix <code class="docutils literal notranslate"><span class="pre">/opt/android/foo</span></code>, you would use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> \
  <span class="o">-</span><span class="n">DCMAKE_TOOLCHAIN_FILE</span><span class="o">=/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">ECM</span><span class="o">/</span><span class="n">toolchain</span><span class="o">/</span><span class="n">Android</span><span class="o">.</span><span class="n">cmake</span> \
  <span class="o">-</span><span class="n">DECM_ADDITIONAL_FIND_ROOT_PATH</span><span class="o">=</span><span class="s2">&quot;/opt/android/Qt5/5.7/android_armv7;/opt/android/foo&quot;</span>
</pre></div>
</div>
<p>If your project uses <code class="docutils literal notranslate"><span class="pre">find_package()</span></code> to locate build tools on the host
system, make sure to pass <code class="docutils literal notranslate"><span class="pre">CMAKE_FIND_ROOT_PATH_BOTH</span></code> or
<code class="docutils literal notranslate"><span class="pre">NO_CMAKE_FIND_ROOT_PATH</span></code> as argument in the call. See the
<code class="docutils literal notranslate"><span class="pre">find_package()</span></code> documentation for more details.</p>
</div>
<div class="section" id="deploying-qt-applications">
<h2>Deploying Qt Applications<a class="headerlink" href="#deploying-qt-applications" title="Permalink to this headline">¶</a></h2>
<p>After building the application, you will need to generate an APK that can be
deployed to an Android device. This module integrates androiddeployqt support
to help with this for Qt-based projects. To enable this, set the
<code class="docutils literal notranslate"><span class="pre">QTANDROID_EXPORTED_TARGET</span></code> variable to the targets you wish to export as an
APK (in a ;-separed list), as well as <code class="docutils literal notranslate"><span class="pre">ANDROID_APK_DIR</span></code> to a directory
containing some basic information. This will create a <code class="docutils literal notranslate"><span class="pre">create-apk-&lt;target&gt;</span></code>
target that will generate the APK file.  See the <a class="reference external" href="https://doc.qt.io/qt-5/deployment-android.html">Qt on Android deployment
documentation</a> for more
information.</p>
<p>For example, you could do:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cmake</span> \
  <span class="o">-</span><span class="n">DCMAKE_TOOLCHAIN_FILE</span><span class="o">=/</span><span class="n">usr</span><span class="o">/</span><span class="n">share</span><span class="o">/</span><span class="n">ECM</span><span class="o">/</span><span class="n">toolchain</span><span class="o">/</span><span class="n">Android</span><span class="o">.</span><span class="n">cmake</span> \
  <span class="o">-</span><span class="n">DQTANDROID_EXPORTED_TARGET</span><span class="o">=</span><span class="n">myapp</span> \
  <span class="o">-</span><span class="n">DANDROID_APK_DIR</span><span class="o">=</span><span class="n">myapp</span><span class="o">-</span><span class="n">apk</span>
<span class="n">make</span>
<span class="n">make</span> <span class="n">create</span><span class="o">-</span><span class="n">apk</span><span class="o">-</span><span class="n">myapp</span>
</pre></div>
</div>
<p>The APK would then be found in <code class="docutils literal notranslate"><span class="pre">myapp_build_apk/bin</span></code> in the build directory.</p>
<p>The create-apk-myapp target will be able to take an ARGS parameter with further
arguments for androiddeployqt. For example, one can use:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">create</span><span class="o">-</span><span class="n">apk</span><span class="o">-</span><span class="n">myapp</span> <span class="n">ARGS</span><span class="o">=</span><span class="s2">&quot;--install&quot;</span>
</pre></div>
</div>
<p>To install the apk to test. To generate a signed apk, one can do it with the
following syntax:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">make</span> <span class="n">create</span><span class="o">-</span><span class="n">apk</span><span class="o">-</span><span class="n">myapp</span> <span class="n">ARGS</span><span class="o">=</span><span class="s2">&quot;--sign ~/my.keystore alias_name&quot;</span>
</pre></div>
</div>
<p>In case it’s needed for your application to set the APK directory from cmake
scripting you can also set the directory as the ANDROID_APK_DIR property of
the create-apk-myapp target.</p>
<p>See Android documentation on how to create a keystore to use</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">AndroidToolchain</a><ul>
<li><a class="reference internal" href="#usage">Usage</a></li>
<li><a class="reference internal" href="#deploying-qt-applications">Deploying Qt Applications</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="../manual/ecm-toolchains.7.html"
                        title="previous chapter">ecm-toolchains(7)</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/toolchain/Android.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../manual/ecm-toolchains.7.html" title="ecm-toolchains(7)"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../index.html">ECM 5.57 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../manual/ecm-toolchains.7.html" >ecm-toolchains(7)</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright KDE Developers.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.4.
    </div>
  </body>
</html>