The Meson Build System

Tutorial

To create a Meson build definition for a simple project.

It assumes that you have GTK development environment installed:


sudo apt install libgtk-3-dev

Hello

  1. Prepare the source
  2. Create a file main.c:
    
    #include <stdio.h>
    
    int main(int argc, char **argv) {
      printf("Hello world.\n");
      return 0;
    }
    
  3. create a Meson build description
  4. Create a file called meson.build:
    
    project('tutorial', 'c')
    executable('demo', 'main.c')  
      	
  5. initialize the build
  6. Going into the source directory and issuing the following commands.
    
    $ meson setup builddir   
        
    This will create a separate build directory called builddir.
  7. to build the code
  8. 
    $ cd builddir
    $ ninja  
    	

Adding library dependencies

留言

熱門文章