summaryrefslogtreecommitdiff
path: root/docs/markdown/Tutorial.md
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-08-24 17:51:44 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2017-08-24 17:51:44 +0300
commit90c7b5ea58c7d1fea83236cd05b0680dc1c52cac (patch)
tree27a1a20bded658abf30690107d626145d8104460 /docs/markdown/Tutorial.md
parent48e7398add38685590ca85526b4e5cd68cd72872 (diff)
downloadmeson-90c7b5ea58c7d1fea83236cd05b0680dc1c52cac.tar.gz
Rewrapped some markdown files.
Diffstat (limited to 'docs/markdown/Tutorial.md')
-rw-r--r--docs/markdown/Tutorial.md44
1 files changed, 34 insertions, 10 deletions
diff --git a/docs/markdown/Tutorial.md b/docs/markdown/Tutorial.md
index b8e268e70..c555abc51 100644
--- a/docs/markdown/Tutorial.md
+++ b/docs/markdown/Tutorial.md
@@ -4,12 +4,17 @@ short-description: Simplest tutorial
# Tutorial
-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.
+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.
The humble beginning
-----
-Let's start with the most basic of programs, the classic hello example. First we create a file `main.c` which holds the source. It looks like this.
+Let's start with the most basic of programs, the classic hello
+example. First we create a file `main.c` which holds the source. It
+looks like this.
```c
#include<stdio.h>
@@ -20,20 +25,27 @@ int main(int argc, char **argv) {
}
```
-Then we create a Meson build description and put it in a file called `meson.build` in the same directory. Its contents are the following.
+Then we create a Meson build description and put it in a file called
+`meson.build` in the same directory. Its contents are the following.
```meson
project('tutorial', 'c')
executable('demo', 'main.c')
```
-That is all. We are now ready to build our application. First we need to initialize the build by going into the source directory and issuing the following commands.
+That is all. We are now ready to build our application. First we need
+to initialize the build by going into the source directory and issuing
+the following commands.
```console
$ meson builddir
```
-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 top level 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 top level source directory.
When Meson is run it prints the following output.
@@ -66,7 +78,10 @@ This produces the expected output.
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.
+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.
```c
#include<gtk/gtk.h>
@@ -82,7 +97,8 @@ int main(int argc, char **argv) {
}
```
-Then we edit the Meson file, instructing it to find and use the GTK+ libraries.
+Then we edit the Meson file, instructing it to find and use the GTK+
+libraries.
```meson
project('tutorial', 'c')
@@ -90,13 +106,20 @@ gtkdep = dependency('gtk+-3.0')
executable('demo', 'main.c', dependencies : 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 without any build system changes.
+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
```
-Once you have set up your build directory the first time, you don't ever need to run the `meson` command again. You always just run `ninja`. 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.
+Once you have set up your build directory the first time, you don't
+ever need to run the `meson` command again. You always just run
+`ninja`. 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
@@ -112,7 +135,8 @@ Once you have set up your build directory the first time, you don't ever need to
[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:
+Note how Meson noticed that the build definition has changed and reran
+itself automatically. The program is now ready to be run:
```
$ ./demo