Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > f9b5dcfeb836768bfb331dda569b6c02 > files > 313

waf-doc-1.7.13-1.fc18.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="Content-Type" content="text/html; charset=utf-8" />
    
    <title>compiler_c &mdash; Waf 1.7.11 documentation</title>
    
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.7.11',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </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>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Waf 1.7.11 documentation" href="../index.html" />
    <link rel="up" title="Waf Tools" href="../tools.html" />
    <link rel="next" title="compiler_cxx" href="compiler_cxx.html" />
    <link rel="prev" title="Waf Tools" href="../tools.html" /> 
  </head>
  <body>
    <div class="related">
      <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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="compiler_cxx.html" title="compiler_cxx"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="../tools.html" title="Waf Tools"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Waf 1.7.11 documentation</a> &raquo;</li>
          <li><a href="../tools.html" accesskey="U">Waf Tools</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-waflib.Tools.compiler_c">
<span id="compiler-c"></span><h1>compiler_c<a class="headerlink" href="#module-waflib.Tools.compiler_c" title="Permalink to this headline">¶</a></h1>
<p>Try to detect a C compiler from the list of supported compilers (gcc, msvc, etc):</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">options</span><span class="p">(</span><span class="n">opt</span><span class="p">):</span>
        <span class="n">opt</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">&#39;compiler_c&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="n">cnf</span><span class="p">):</span>
        <span class="n">cnf</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">&#39;compiler_c&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="n">bld</span><span class="p">):</span>
        <span class="n">bld</span><span class="o">.</span><span class="n">program</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s">&#39;main.c&#39;</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s">&#39;app&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The compilers are associated to platforms in <a class="reference internal" href="#waflib.Tools.compiler_c.c_compiler" title="waflib.Tools.compiler_c.c_compiler"><tt class="xref py py-attr docutils literal"><span class="pre">waflib.Tools.compiler_c.c_compiler</span></tt></a>. To register
a new C compiler named <em>cfoo</em> (assuming the tool <tt class="docutils literal"><span class="pre">waflib/extras/cfoo.py</span></tt> exists), use:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">options</span><span class="p">(</span><span class="n">opt</span><span class="p">):</span>
        <span class="n">opt</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">&#39;compiler_c&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">configure</span><span class="p">(</span><span class="n">cnf</span><span class="p">):</span>
        <span class="kn">from</span> <span class="nn">waflib.Tools.compiler_c</span> <span class="kn">import</span> <span class="n">c_compiler</span>
        <span class="n">c_compiler</span><span class="p">[</span><span class="s">&#39;win32&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;cfoo&#39;</span><span class="p">,</span> <span class="s">&#39;msvc&#39;</span><span class="p">,</span> <span class="s">&#39;gcc&#39;</span><span class="p">]</span>
        <span class="n">cnf</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s">&#39;compiler_c&#39;</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="n">bld</span><span class="p">):</span>
        <span class="n">bld</span><span class="o">.</span><span class="n">program</span><span class="p">(</span><span class="n">source</span><span class="o">=</span><span class="s">&#39;main.c&#39;</span><span class="p">,</span> <span class="n">target</span><span class="o">=</span><span class="s">&#39;app&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Not all compilers need to have a specific tool. For example, the clang compilers can be detected by the gcc tools when using:</p>
<div class="highlight-python"><pre>$ CC=clang waf configure</pre>
</div>
<dl class="data">
<dt id="waflib.Tools.compiler_c.c_compiler">
<tt class="descclassname">waflib.Tools.compiler_c.</tt><tt class="descname">c_compiler</tt><em class="property"> = {'sunos': ['suncc', 'gcc'], 'cygwin': ['gcc'], 'linux': ['gcc', 'icc'], 'darwin': ['gcc'], 'java': ['gcc', 'msvc', 'icc'], 'aix': ['xlc', 'gcc'], 'gnu': ['gcc'], 'default': ['gcc'], 'irix': ['gcc', 'irixcc'], 'win32': ['msvc', 'gcc'], 'hpux': ['gcc']}</em><a class="headerlink" href="#waflib.Tools.compiler_c.c_compiler" title="Permalink to this definition">¶</a></dt>
<dd><p>Dict mapping the platform names to waf tools finding specific compilers:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">waflib.Tools.compiler_c</span> <span class="kn">import</span> <span class="n">c_compiler</span>
<span class="n">c_compiler</span><span class="p">[</span><span class="s">&#39;linux&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;gcc&#39;</span><span class="p">,</span> <span class="s">&#39;icc&#39;</span><span class="p">,</span> <span class="s">&#39;suncc&#39;</span><span class="p">]</span>
</pre></div>
</div>
</dd></dl>

<dl class="function">
<dt id="waflib.Tools.compiler_c.configure">
<tt class="descclassname">waflib.Tools.compiler_c.</tt><tt class="descname">configure</tt><big>(</big><em>conf</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/compiler_c.html#configure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.compiler_c.configure" title="Permalink to this definition">¶</a></dt>
<dd><p>Try to find a suitable C compiler or raise a <a class="reference internal" href="../Errors.html#waflib.Errors.ConfigurationError" title="waflib.Errors.ConfigurationError"><tt class="xref py py-class docutils literal"><span class="pre">waflib.Errors.ConfigurationError</span></tt></a>.</p>
</dd></dl>

<dl class="function">
<dt id="waflib.Tools.compiler_c.options">
<tt class="descclassname">waflib.Tools.compiler_c.</tt><tt class="descname">options</tt><big>(</big><em>opt</em><big>)</big><a class="reference internal" href="../_modules/waflib/Tools/compiler_c.html#options"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#waflib.Tools.compiler_c.options" title="Permalink to this definition">¶</a></dt>
<dd><p>Restrict the compiler detection from the command-line:</p>
<div class="highlight-python"><pre>$ waf configure --check-c-compiler=gcc</pre>
</div>
</dd></dl>

<dl class="function">
<dt id="waflib.Tools.compiler_c.debug">
<tt class="descclassname">waflib.Tools.compiler_c.</tt><tt class="descname">debug</tt><big>(</big><em>*k</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#waflib.Tools.compiler_c.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Wrap logging.debug, the output is filtered for performance reasons</p>
</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="../tools.html"
                        title="previous chapter">Waf Tools</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="compiler_cxx.html"
                        title="next chapter">compiler_cxx</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/tools/compiler_c.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <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>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="compiler_cxx.html" title="compiler_cxx"
             >next</a> |</li>
        <li class="right" >
          <a href="../tools.html" title="Waf Tools"
             >previous</a> |</li>
        <li><a href="../index.html">Waf 1.7.11 documentation</a> &raquo;</li>
          <li><a href="../tools.html" >Waf Tools</a> &raquo;</li> 
      </ul>
    </div>

    <div class="footer">
        &copy; <a href="../copyright.html">Copyright</a> 2010, Thomas Nagy.
    </div>

  </body>
</html>