project()
The first function called in each project, to initialize Meson.
The first argument to this function must be a string defining the name of this project.
The project name can be any string you want, it's not used for anything except descriptive purposes. However since it is written to e.g. the dependency manifest is usually makes sense to have it be the same as the project tarball or pkg-config name. So for example you would probably want to use the name libfoobar instead of The Foobar Library.
It may be followed by the array of programming languages that the project uses.
(since 0.40.0) The array of languages is optional.
These languages may be used both for native: false (the default)
(host machine) targets and for native: true (build machine) targets.
(since 0.56.0) The build machine compilers for the specified
languages are not required.
Supported values for languages are c, cpp (for C++), cuda,
cython, d, objc, objcpp, fortran, java, cs (for C#),
swift, nasm, masm, linearasm, vala and rust.
Signature
# The first function called in each project, to initialize Meson
void project(
str project_name, # The name of the project
str language..., # The languages that Meson should initialize
# Keyword arguments:
default_options : array[str] | dict[str | bool | int | array[str]] # Accepts strings in the form `key=value`
license : str | array[str] # Takes a string or array of strings describing the license(s) the code is under
license_files : str | array[str] # Takes a string or array of strings with the paths to the license file(s)
meson_version : str # Takes a string describing which Meson version the project requires
subproject_dir : str # Specifies the top level directory name that holds Meson subprojects
version : str | file # A free form string describing the version of this project
)
Arguments
The function project() accepts the following positional arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
project_name |
str |
The name of the project. |
|
Additionally, the
function accepts between 0 and infinity variadic
arguments (language...) of type .str
The languages that Meson should initialize.
Finally, project()
accepts the following keyword arguments:
| Name | Type | Description | Tags |
|---|---|---|---|
default_options |
array[str] | dict[str | bool | int | array[str]] |
Accepts strings in the form Note that some options can override the default behavior;
for example, using Also note that not all options are taken into account when building as a subproject, and the exact set of options that are per-subproject has increased over time; for more information, see core options and compiler options. (since 1.2.0): A dictionary may now be passed. |
|
license |
str | array[str] |
Takes a string or array of strings describing the license(s) the code is under. This should be an SPDX license expression,
using the standardized license identifier from the SPDX license
list. Usually this would be something like
For backwards compatibility reasons you can also pass an array of
licenses here. This is not recommended, as it is ambiguous: Note that the text is informal and is only written to the dependency
manifest. Meson does not do any license validation, you are responsible
for verifying that you abide by all licensing terms. You can access the
value in your Meson build files with |
|
license_files |
str | array[str] |
Takes a string or array of strings with the paths to the license file(s) the code is under. This enhances the value of the Note that the files are informal and are only installed with the dependency
manifest. Meson does not do any license validation, you are responsible
for verifying that you abide by all licensing terms. You can access the
value in your Meson build files with |
(since 1.1.0) |
meson_version |
str |
Takes a string describing which Meson version the project requires.
Usually something like |
|
subproject_dir |
str |
Specifies the top level directory name that holds Meson subprojects. This is only meant as a compatibility option for existing code bases that house their embedded source code in a custom directory. All new projects should not set this but instead use the default value. It should be noted that this keyword argument is ignored inside subprojects. There can be only one subproject dir and it is set in the top level Meson file. |
|
version |
str | file
|
A free form string describing the version of this project.
You can access the value in your Meson build files
with |
|
The results of the search are