<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Subprojects</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>Recent changes to Subprojects</description><atom:link href="https://sourceforge.net/p/meson/wiki/Subprojects/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 04 Sep 2014 08:03:06 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/meson/wiki/Subprojects/feed" rel="self" type="application/rss+xml"/><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v7
+++ v8
@@ -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.
+
+-------
+
 Subprojects
 ==

&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 08:03:06 -0000</pubDate><guid>https://sourceforge.net0ddd73ae58143ccab85690d2876a7409a934ea3b</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v6
+++ v7
@@ -40,6 +40,8 @@

 It should be noted that this only works for subprojects that are built with Meson. It can not be used with any other build system. The reason is the simple fact that there is no possible way to do this reliably with mixed build systems.

+Subprojects can use other subprojects, but all subprojects must reside in the top level &lt;tt&gt;subprojects&lt;/tt&gt; directory. Recursive use of subprojects is not allowed, though, so you can't have subproject &lt;tt&gt;a&lt;/tt&gt; that uses subproject &lt;tt&gt;b&lt;/tt&gt; and have &lt;tt&gt;b&lt;/tt&gt; also use &lt;tt&gt;a&lt;/tt&gt;.
+
 ---

 [Back to index](Manual).
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 24 Feb 2014 20:11:14 -0000</pubDate><guid>https://sourceforge.net46fe4eaf28a42de929bcf90c5591b7ed44f5750f</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v5
+++ v6
@@ -13,7 +13,7 @@
       # set up rest of project as if foo was provided by this project
     endif

-All Meson features of the subproject, such as project options keep working and can be set in the master project. There are a few limitations, though. First of all, subprojects of subprojects are not currently supported. Secondly, global compiler arguments must be set in the main project before calling subproject. Subprojects must not set global arguments because there is no way to do that reliably over multiple subprojects. To check whether you are running as a subproject, use the &lt;tt&gt;is_subproject&lt;/tt&gt; function.
+All Meson features of the subproject, such as project options keep working and can be set in the master project. There are a few limitations, the most imporant being that global compiler arguments must be set in the main project before calling subproject. Subprojects must not set global arguments because there is no way to do that reliably over multiple subprojects. To check whether you are running as a subproject, use the &lt;tt&gt;is_subproject&lt;/tt&gt; function.

 As an example, suppose we have a simple project that provides a shared library.

@@ -21,7 +21,7 @@
     i = include_directories('include')
     l = shared_library('simple', 'simple.c', include_dirs : i, install : true)

-Then we could use that from a master project like this.
+Then we could use that from a master project. First we generate a subdirectory called &lt;tt&gt;subprojects&lt;/tt&gt; in the root of the master directory. Then we create a subdirectory called &lt;tt&gt;simple&lt;/tt&gt; and put the subproject in that directory. Now the subproject can be used like this.

     project('master', 'c')
     dep = dependency('simple', required : false)
@@ -29,7 +29,7 @@
       i = []
       l = []
     else
-      sp = subproject('simple') # This is a name of a subdirectory.
+      sp = subproject('simple') # This is a name of a subdirectory in subprojects.
       i = sp.get_variable('i')
       l = sp.get_variable('l')
     endif
@@ -38,7 +38,7 @@

 With this setup the system dependency is used when it is available, otherwise we fall back on the bundled version.

-It should be noted that this only works for subprojects that are built with Meson. It can not be used with any other build system. The reason is, again, that there is no possible way to do this reliably with mixed build systems.
+It should be noted that this only works for subprojects that are built with Meson. It can not be used with any other build system. The reason is the simple fact that there is no possible way to do this reliably with mixed build systems.

 ---

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 24 Feb 2014 20:08:08 -0000</pubDate><guid>https://sourceforge.neteb56e783f7bc41d96a74c45cffd270597fcfadd0</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v4
+++ v5
@@ -34,7 +34,7 @@
       l = sp.get_variable('l')
     endif
     exe = executable('prog', 'prog.c', include_dirs : i, link_with : l,
-                     deps : dep)
+                     deps : dep, install : true)

 With this setup the system dependency is used when it is available, otherwise we fall back on the bundled version.

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 09 Dec 2013 23:18:41 -0000</pubDate><guid>https://sourceforge.net389cbc362f9cf7d024e74a4a6569d70543b2fc23</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v3
+++ v4
@@ -3,7 +3,7 @@

 Some platforms do not provide a native packaging system. In these cases it is common to bundle all third party libraries in your source tree. This is usually frowned upon because it makes it hard to add these kinds of projects into e.g. those Linux distributions that forbid bundled libraries.

-Meson tries to solve this problem by making it extremely easy to do both of these. The way this is done is that Meson allows you to take any other Meson project and make it a part of your build without (in the best case) any changes to its Meson setup. It becomes a transparent part of the project. The basic idiom goes something like this.
+Meson tries to solve this problem by making it extremely easy to provide both at the same time. The way this is done is that Meson allows you to take any other Meson project and make it a part of your build without (in the best case) any changes to its Meson setup. It becomes a transparent part of the project. The basic idiom goes something like this.

     dep = dependency('foo', required : false)
     if dep.found()
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 09 Dec 2013 20:58:59 -0000</pubDate><guid>https://sourceforge.netb2198115f83c14050b07afdc54f0d8cd3f14d395</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v2
+++ v3
@@ -24,12 +24,21 @@
 Then we could use that from a master project like this.

     project('master', 'c')
-    sp = subproject('simple') # This is a name of a subdirectory.
-    i = sp.get_variable('i')
-    l = sp.get_variable('l')
-    exe = executable('prog', 'prog.c', include_dirs : i, link_with : l)
+    dep = dependency('simple', required : false)
+    if dep.found()
+      i = []
+      l = []
+    else
+      sp = subproject('simple') # This is a name of a subdirectory.
+      i = sp.get_variable('i')
+      l = sp.get_variable('l')
+    endif
+    exe = executable('prog', 'prog.c', include_dirs : i, link_with : l,
+                     deps : dep)

-This is very simple, but it should be noted that this only works for subprojects that are built with Meson. It can not be used with any other build system. The reason is, again, that there is no possible way to do this reliably.
+With this setup the system dependency is used when it is available, otherwise we fall back on the bundled version.
+
+It should be noted that this only works for subprojects that are built with Meson. It can not be used with any other build system. The reason is, again, that there is no possible way to do this reliably with mixed build systems.

 ---

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 09 Dec 2013 20:57:01 -0000</pubDate><guid>https://sourceforge.net291ce3e0b7a467040677102bb240e112f81aad4f</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v1
+++ v2
@@ -1,7 +1,35 @@
 Subprojects
 ==

+Some platforms do not provide a native packaging system. In these cases it is common to bundle all third party libraries in your source tree. This is usually frowned upon because it makes it hard to add these kinds of projects into e.g. those Linux distributions that forbid bundled libraries.

+Meson tries to solve this problem by making it extremely easy to do both of these. The way this is done is that Meson allows you to take any other Meson project and make it a part of your build without (in the best case) any changes to its Meson setup. It becomes a transparent part of the project. The basic idiom goes something like this.
+
+    dep = dependency('foo', required : false)
+    if dep.found()
+      # set up project using external dependency
+    else
+      subproject('foo')
+      # set up rest of project as if foo was provided by this project
+    endif
+
+All Meson features of the subproject, such as project options keep working and can be set in the master project. There are a few limitations, though. First of all, subprojects of subprojects are not currently supported. Secondly, global compiler arguments must be set in the main project before calling subproject. Subprojects must not set global arguments because there is no way to do that reliably over multiple subprojects. To check whether you are running as a subproject, use the &lt;tt&gt;is_subproject&lt;/tt&gt; function.
+
+As an example, suppose we have a simple project that provides a shared library.
+
+    project('simple', 'c')
+    i = include_directories('include')
+    l = shared_library('simple', 'simple.c', include_dirs : i, install : true)
+
+Then we could use that from a master project like this.
+
+    project('master', 'c')
+    sp = subproject('simple') # This is a name of a subdirectory.
+    i = sp.get_variable('i')
+    l = sp.get_variable('l')
+    exe = executable('prog', 'prog.c', include_dirs : i, link_with : l)
+
+This is very simple, but it should be noted that this only works for subprojects that are built with Meson. It can not be used with any other build system. The reason is, again, that there is no possible way to do this reliably.

 ---

&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 09 Dec 2013 20:53:44 -0000</pubDate><guid>https://sourceforge.net365fd429b0096b260d9eef5e8fe54289e22dedd6</guid></item><item><title>Subprojects modified by Jussi Pakkanen</title><link>https://sourceforge.net/p/meson/wiki/Subprojects/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="subprojects"&gt;Subprojects&lt;/h1&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;a class="" href="/p/meson/wiki/Manual/"&gt;Back to index&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jussi Pakkanen</dc:creator><pubDate>Mon, 09 Dec 2013 20:28:46 -0000</pubDate><guid>https://sourceforge.netc9b980120c917b6d5ef5979c74fadb06b923d5d6</guid></item></channel></rss>