<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Tutorial</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>Recent changes to Tutorial</description><atom:link href="https://sourceforge.net/p/meson/wiki/Tutorial/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 04 Sep 2014 07:54:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/meson/wiki/Tutorial/feed" rel="self" type="application/rss+xml"/><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -1,3 +1,10 @@
+The Meson build system has moved
+==
+
+The new home of Meson's documentation is [here](https://github.com/jpakkane/meson/wiki). The information below is preserved only for posterity. It should be considered out of date.
+
+-------
+
 Tutorial
 ==

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Thu, 04 Sep 2014 07:54:01 -0000</pubDate><guid>https://sourceforge.neta0f4ebf869c87d38c830fa5c1e449e104bace738</guid></item><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -25,7 +25,7 @@
     mkdir build
     meson build

-Note how we create a separate build directory to hold all of the compiler output. Meson is different from some other build systems in that it does not permit in-source builds. You must always create a separate build directory. Common convention is to put the default build directory in a subdirectory of your toplevel source directory.
+We create a separate build directory to hold all of the compiler output. Meson is different from some other build systems in that it does not permit in-source builds. You must always create a separate build directory. Common convention is to put the default build directory in a subdirectory of your toplevel source directory.

 When Meson is run it prints the following output.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 03 Feb 2014 20:22:45 -0000</pubDate><guid>https://sourceforge.netea506ac708c034255fda43bcef55505251449532</guid></item><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -74,7 +74,7 @@
     gtkdep = dependency('gtk+-3.0')
     executable('demo', 'main.c', deps : gtkdep)

-Now we are ready to build. The thing to notice is that we do *not* need to recreate our build directory, run any sort of magical commands or the like. Instead we just type the exact same command as if we were rebuilding our code.
+Now we are ready to build. The thing to notice is that we do *not* need to recreate our build directory, run any sort of magical commands or the like. Instead we just type the exact same command as if we were rebuilding our code without any build system changes.

     ninja

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 03 Feb 2014 20:21:56 -0000</pubDate><guid>https://sourceforge.net958c1157308dc53bd5140022d24d6bd117bf1b7f</guid></item><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -18,7 +18,6 @@
 Then we create a Meson build description and put it in a file called &lt;tt&gt;meson.build&lt;/tt&gt; in the same directory. Its contents are the following.

     project('tutorial', 'c')
-    
     executable('demo', 'main.c')

 That is all. We are now ready to build our application. First we need to initialise the build by going into the source directory and issuing the following commands.
@@ -72,7 +71,6 @@
 Then we edit the Meson file, instructing it to find and use the Gtk libraries.

     project('tutorial', 'c')
-    
     gtkdep = dependency('gtk+-3.0')
     executable('demo', 'main.c', deps : gtkdep)

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 03 Feb 2014 20:20:33 -0000</pubDate><guid>https://sourceforge.net2cbed9c7da8701f812d182d32dac4066171f2015</guid></item><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -101,3 +101,5 @@
     ./demo

 This creates the following GUI application.
+
+![Gtk sample application screenshot](https://sourceforge.net/p/meson/wiki/Tutorial/attachment/gtksample.png)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 03 Feb 2014 20:19:42 -0000</pubDate><guid>https://sourceforge.netfe029783aa85bd8f25542092a09d687b0903f1fe</guid></item><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -52,3 +52,52 @@

     Hello there.

+Adding dependencies
+-----
+
+Just printing text is a bit old fashioned. Let's update our program to create a graphical window instead. We'll use the [GTK+](https://gtk.org) widget toolkit. First we edit the main file to use Gtk. The new version looks like this.
+
+    #includegtk.h&gt;
+    
+    int main(int argc, char **argv) {
+      GtkWidget *win;
+      gtk_init(&amp;argc;, &amp;argv;);
+      win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+      gtk_window_set_title(GTK_WINDOW(win), "Hello there");
+      g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);
+      gtk_widget_show(win);
+      gtk_main();
+    }
+
+Then we edit the Meson file, instructing it to find and use the Gtk libraries.
+
+    project('tutorial', 'c')
+    
+    gtkdep = dependency('gtk+-3.0')
+    executable('demo', 'main.c', deps : gtkdep)
+
+Now we are ready to build. The thing to notice is that we do *not* need to recreate our build directory, run any sort of magical commands or the like. Instead we just type the exact same command as if we were rebuilding our code.
+
+    ninja
+
+Once you have set up your build directory the first time, you don't ever need to run the &lt;tt&gt;meson&lt;/tt&gt;&lt;tt&gt; command again. You always just run &lt;/tt&gt;&lt;tt&gt;ninja&lt;/tt&gt;. Meson will automatically detect when you have done changes to build definitions and will take care of everything so users don't have to care. In this case the following output is produced.
+
+    [1/1] Regenerating build files
+    The Meson build system
+     version: 0.13.0-research
+    Source dir: /home/jpakkane/mesontutorial
+    Build dir: /home/jpakkane/mesontutorial/build
+    Build type: native build
+    Project name is "tutorial".
+    Using native c compiler "ccache cc". (gcc 4.8.2)
+    Found pkg-config version 0.26.
+    Dependency gtk+-3.0 found: YES
+    Creating build target "demo" with 1 files.
+    [1/2] Compiling c object demo.dir/main.c.o
+    [2/2] Linking target demo
+
+Note how Meson noticed that the build definition has changed and reran itself automatically. The program is now ready to be run:
+
+    ./demo
+
+This creates the following GUI application.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 03 Feb 2014 20:17:23 -0000</pubDate><guid>https://sourceforge.net5ba3f2d4a772e0be590c7dc13340f89b8158f917</guid></item><item><title>Tutorial modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Tutorial/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="tutorial"&gt;Tutorial&lt;/h1&gt;
&lt;p&gt;This page shows from the ground up how to create a Meson build definition for a simple project. Then we expand it to use external dependencies to show how easily they can be integrated into your project.&lt;/p&gt;
&lt;h2 id="the-humble-beginning"&gt;The humble beginning&lt;/h2&gt;
&lt;p&gt;Let's start with the most basic of programs, the classic hello example. First we create a file &lt;tt&gt;main.c&lt;/tt&gt; which holds the source. It looks like this.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="cp"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;argc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;Hello there.&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then we create a Meson build description and put it in a file called &lt;tt&gt;meson.build&lt;/tt&gt; in the same directory. Its contents are the following.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;tutorial&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sc"&gt;'c'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;executable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;demo&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That is all. We are now ready to build our application. First we need to initialise the build by going into the source directory and issuing the following commands.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;mkdir&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;
&lt;span class="n"&gt;meson&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note how we create a separate build directory to hold all of the compiler output. Meson is different from some other build systems in that it does not permit in-source builds. You must always create a separate build directory. Common convention is to put the default build directory in a subdirectory of your toplevel source directory.&lt;/p&gt;
&lt;p&gt;When Meson is run it prints the following output.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;Meson&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt;
 &lt;span class="nl"&gt;version:&lt;/span&gt; &lt;span class="mf"&gt;0.13.0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;research&lt;/span&gt;
&lt;span class="n"&gt;Source&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;jpakkane&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mesontutorial&lt;/span&gt;
&lt;span class="n"&gt;Build&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;home&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;jpakkane&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;mesontutorial&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;build&lt;/span&gt;
&lt;span class="n"&gt;Build&lt;/span&gt; &lt;span class="n"&gt;type&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;native&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;
&lt;span class="n"&gt;Project&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="n"&gt;is&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;tutorial&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;Using&lt;/span&gt; &lt;span class="n"&gt;native&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="n"&gt;compiler&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;ccache cc&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gcc&lt;/span&gt; &lt;span class="mf"&gt;4.8.2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;Creating&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="s"&gt;&amp;quot;demo&amp;quot;&lt;/span&gt; &lt;span class="n"&gt;with&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now we are ready to build our code.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;cd&lt;/span&gt; &lt;span class="n"&gt;build&lt;/span&gt;
&lt;span class="n"&gt;ninja&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once that is done we can run the resulting binary.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;demo&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This produces the expected output.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;Hello&lt;/span&gt; &lt;span class="n"&gt;there&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 03 Feb 2014 20:04:17 -0000</pubDate><guid>https://sourceforge.net3587690e4e9518b27e37e219bd1a972e9b3faf12</guid></item></channel></rss>