Skip to content

Commit

Permalink
Don't require build machine compilers for project() languages
Browse files Browse the repository at this point in the history
This means that, in the common case of a simple meson.build which
doesn't contain any 'native: true' targets, we won't require a native
compiler when cross-compiling, without needing any changes in the
meson.build.
  • Loading branch information
jon-turney authored and nirbheek committed Sep 10, 2020
1 parent 4cef45a commit fc0f0df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
18 changes: 13 additions & 5 deletions docs/markdown/Reference-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1312,11 +1312,7 @@ My Project 1.0
```

The first argument to this function must be a string defining the name
of this project. It is followed by programming languages that the
project uses. Supported values for languages are `c`, `cpp` (for
`C++`), `cuda`, `d`, `objc`, `objcpp`, `fortran`, `java`, `cs` (for `C#`),
`vala` and `rust`. *(since 0.40.0)* The list of languages
is optional.
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
Expand All @@ -1325,6 +1321,18 @@ 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 list of programming languages that the project uses.

*(since 0.40.0)* The list 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`, `d`,
`objc`, `objcpp`, `fortran`, `java`, `cs` (for `C#`), `vala` and `rust`.

Project supports the following keyword arguments.

- `default_options`: takes an array of strings. The strings are in the
Expand Down
4 changes: 3 additions & 1 deletion mesonbuild/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3135,8 +3135,10 @@ def func_project(self, node, args, kwargs):
self.build.projects[self.subproject] = proj_name
mlog.log('Project name:', mlog.bold(proj_name))
mlog.log('Project version:', mlog.bold(self.project_version))
self.add_languages(proj_langs, True, MachineChoice.BUILD)

self.add_languages(proj_langs, True, MachineChoice.HOST)
self.add_languages(proj_langs, False, MachineChoice.BUILD)

self.set_backend()
if not self.is_subproject():
self.check_stdlibs()
Expand Down

0 comments on commit fc0f0df

Please sign in to comment.