<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>lighty's life: Tag cmake</title>
    <link>http://blog.lighttpd.net/articles/tag/cmake</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>1.5.0 goes cmake</title>
      <description>&lt;p&gt;It is a tradition now to change the build-system from lighttpd on each &lt;a href="http://blog.lighttpd.net/articles/2005/09/27/lighttpd-goes-scons"&gt;major release&lt;/a&gt;
For now we have the autotools as the user-visible build-system and &lt;a href="http://www.scons.org/"&gt;scons&lt;/a&gt; as the system for the developers.&lt;/p&gt;


	&lt;p&gt;Currently we are testing &lt;a href="http://www.cmake.org/"&gt;cmake&lt;/a&gt; as a replacement for the scons part.&lt;/p&gt;
&lt;h3&gt;Build Systems&lt;/h3&gt;
Before you can build a C-program you first have to find out which functions the system you compile on supports. Not only that &lt;span class="caps"&gt;UNIX&lt;/span&gt; has various flavours, no, there is also Windows.

	&lt;p&gt;The natural way on &lt;span class="caps"&gt;UNIX&lt;/span&gt; is using autotools (autoconf, automake, ...) which creates a shell script (configure) which generates the Makefiles which are process by make to build the application.&lt;/p&gt;


	&lt;p&gt;Using automake reduced the pain of autoconf when it was released, but it none the less is still enough pain to look for something else. Not to forget that win32 and shell-scripts aren&amp;#8217;t real friends.&lt;/p&gt;


&lt;h3&gt;scons&lt;/h3&gt;
SCons going another route. It replaces make and the autotools by a python based build-system. You can do everything with just a few lines of python code. Very neat.

	&lt;p&gt;The bad side: its development is more or less sleeping. The unstable 0.96.9x branch which fixes various nasty bugs is unstable since 2004-08-22, the release of 0.96.1.&lt;/p&gt;


&lt;h3&gt;cmake&lt;/h3&gt;
cmake is more relaxed and doesn&amp;#8217;t want to solve the whole problem. It does the configure checks and leaves the building to the native build-system. On Unix it is either make or kdevelop3, on MacOSX it is XCode and on windows it is nmake.

	&lt;p&gt;As extra cmake supports basic packaging and has very nice integration with test-tools like Dart.&lt;/p&gt;


&lt;h3&gt;Cross-Compiling&lt;/h3&gt;
As a proof-of-concept I&amp;#8217;ve added cmake support to trunk used the &lt;a href="http://openwrt.org/"&gt;openwrt&lt;/a&gt; SDK to build lighttpd with openwrt.

&lt;pre&gt;
$ cmake .
$ rm CMakeCache.txt
$ OPENWRT=.../OpenWrt-SDK-Linux-x86_64-1/staging_dir_mipsel/ \
CC=$OPENWRT/bin/mipsel-linux-gcc \
LD=$OPENWRT/bin/mipsel-linux-uclibc-ld make
&lt;/pre&gt;

&lt;h3&gt;Command Line Options&lt;/h3&gt;
&lt;pre&gt;
$ cmake -L .
...
CMAKE_INSTALL_PREFIX:PATH=
...
WITH_BZIP:BOOL=OFF
WITH_MYSQL:BOOL=OFF
WITH_OPENSSL:BOOL=OFF
WITH_PCRE:BOOL=ON
WITH_SQLITE3:BOOL=OFF
WITH_WEBPAV_PROPS:BOOL=OFF
WITH_XATTR:BOOL=OFF
WITH_ZLIB:BOOL=ON
$ cmake -DWITH_BZIP:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/home/jan/l-1.5.0-cmake/
&lt;/pre&gt;

&lt;h3&gt;Static Linking&lt;/h3&gt;

	&lt;p&gt;To make it easier for embedded systems which don&amp;#8217;t have support for dlopen() I added the option:&lt;/p&gt;


&lt;pre&gt;
$ cmake -DBUILD_STATIC:BOOL=ON .
&lt;/pre&gt;

	&lt;p&gt;It will build all the modules as static libraries which are linked into the server at build-time. server.modules is used to initialized the modules as before.&lt;/p&gt;</description>
      <pubDate>Mon, 25 Dec 2006 20:37:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5263ca7e-783a-4a52-9b31-4f4ff998b171</guid>
      <author>jan</author>
      <link>http://blog.lighttpd.net/articles/2006/12/25/1-5-0-goes-cmake</link>
      <category>lighttpd</category>
      <category>scons</category>
      <category>cmake</category>
      <trackback:ping>http://blog.lighttpd.net/articles/trackback/2603</trackback:ping>
    </item>
  </channel>
</rss>
