|  |  
 |   |   
 NAMEmeson.build - a build system dsl DESCRIPTIONThe meson dsl is a dynamically typed language, similar to other interpreted languages like python and ruby. All objects are immutable. Functions cannot be defined, only built-in functions are available. 
 STRUCTUREAll meson projects must have a file called `meson.build` at the project root. This is the root build file. This file must have a call to the `project()` function as its first statement. Additional `meson.build` files may reside in any subdirectories of the project. These build files are then executed with the `subdir()` function. TYPESThe meson build system dsl contains most of the common types that would be expected: 
 BooleansBooleans are either `true` or `false`. OPERATORS 
 IntegersYou can specify an integer literal using decimal, hexadecimal, octal, and binary. int_1 = 1 int_42 = 42 int_255 = 0xFF int_493 = 0o755 int_1365 = 0b10101010101 All common arithmetic operations are implemented for integers: addition, subtraction, division, multiplication, and modulo. OPERATORS 
 StringsStrings in Meson are declared with single quotes. `` is the escape character. The full list of escape sequences is: 
 Multi-line strings are surrounded by 3 consecutive quotes. These are raw strings that do not support the escape sequences listed above. Format strings are expressed by a placing leading `f` before the first opening quote. Inside of a format string, sequences of the form `@[a-z_]+@` will be substituted with the value of the matching variable. This variable can be of type bool, int, or str. name = 'Alice' # prints "Hello Alice" message(f'Hello @name@') OPERATORS 
 ArraysArrays are delimited by brackets. An array can contain an arbitrary number of objects of any type. OPERATORS 
 DictionariesDictionaries are delimited by curly braces. A dictionary can contain an arbitrary number of key: value pairs. Keys are required to be strings, but values can be objects of any type. Dictionaries are immutable and do not have a guaranteed order. OPERATORS 
 SYNTAXA meson build file is composed of statements, which are terminated by newlines. Other than the statement-terminating newline, white space has no syntactic meaning. CommentsA comment starts with the `#` character and extends until the end of the line. VariablesA variable can contain a value of any type, and does not need to be predeclared. var1 = 'hello' var2 = 102 One important difference in how variables work in the dsl is that all objects are immutable. When you see an operation which appears like a mutation, actually a new object is created and assigned to the name. var1 = [1, 2, 3] var2 = var1 var2 += [4] # var2 is now [1, 2, 3, 4] # var1 is still [1, 2, 3] Function and method callsBuiltin functions are called by their name followed by parenthesis containing optional, comma-separated arguments. Arguments are either positional or keyword. Keyword arguments are expressed using the keyword without quotes, followed by a colon. foo()
foo('bar')
foo('bar', baz: true)Method calls are expressed by a `.` followed by the same function call syntax as above. foo.bar()
foo.bar('baz', qux: false)For a complete list of functions and methods, please see `meson-reference(3)`. If statementsStart an if statement with the `if` keyword followed by a boolean expression. Further conditions can be expressed using the `elif` keyword followed by a boolean expression. The `else` keyword can be used to handle the case when no conditions are matched. An if statement is terminated with the `endif` keyword. if conditon1 ... elif condition2 ... else condition3 ... endif Foreach statementsTo loop over values in an iterable, use the `foreach` keyword followed by a comma separated list of names to assign the values of the iterable to, a colon, and an iterable expression. Only arrays and dictionaries are iterable. A foreach statement is terminated with the `endforeach` keyword. Arrays have one value to assign to. foreach value : array foo(value) endforeach Dictionaries have one two values to assign to. foreach key, value : dictionary foo(key) bar(value) endforeach Inside a `foreach` block you may use the `break` and `continue` keywords. `break` exits the loop immediately. `continue` skips the rest of the current iteration. SEE ALSOmeson-reference(3) meson(1) muon(1) 
 
 |