Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add meson compile command #6670

Closed
TheQwertiest opened this issue Feb 21, 2020 · 11 comments · Fixed by #6690
Closed

[Feature request] Add meson compile command #6670

TheQwertiest opened this issue Feb 21, 2020 · 11 comments · Fixed by #6690

Comments

@TheQwertiest
Copy link
Contributor

TheQwertiest commented Feb 21, 2020

Proposal:
Backend-agnostic build command meson compile - counterpart of cmake --build.

Reasoning:

  • Simplifies meson usage and integration: the same meson commands could be invoked for all backends.
  • Reduces the amount of knowledge required to use meson out-of-the-box (i.e. with default ninja backend). Since user won't have to know anything about ninja (apart from the fact that it's needed).

Proposed interface (based on `cmake --build):

usage: meson compile [-h] [-C WD] [--clean] [--backend-args ARGS] [args [args ...]]

positional arguments:
  args                            optional list of targets to build

optional arguments:
-h, --help                      show this help message and exit
-C WD                          directory to cd into before running
--clean                          invokes clean command of the native tool.
--backend-args ARGS    arguments to pass to the native tool.
@TheQwertiest
Copy link
Contributor Author

Note: most of the implementation code might be directly lifted from the test runner:

def get_backend_commands(backend, debug=False):

@xclaesse
Copy link
Member

Makes sense to me, we added 'meson install' recently too. Are you working on a patch?

@TheQwertiest
Copy link
Contributor Author

TheQwertiest commented Feb 21, 2020

Replaced --target with positional [args] for consistency with meson test and meson install.

@TheQwertiest
Copy link
Contributor Author

TheQwertiest commented Feb 21, 2020

Are you working on a patch?

Not yet, since my free time is currently pretty lacking. I will, however, take this on if nobody starts working on it in the next month or so (that is, a month from now, not the next calendar month :P).

@marc-h38
Copy link
Contributor

As the person developing the meson.build file itself, I would also like to have a single command meson setup_and_compile --wipe_ignore_missing. Would save writing wrapper scripts on top of meson (on top of ninja). See #6434 (comment)

And a poney.

dcbaker added a commit to dcbaker/meson that referenced this issue Feb 24, 2020
This is only tested with ninja/samu at the moment. I'll get to msbuild
next. Not sure what to do about xcode.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 24, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 25, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 25, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 25, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 26, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 26, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Feb 26, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 2, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 2, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 2, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 2, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
@Salamandar
Copy link
Contributor

meson build would make more sense IMHO. Meson does not always compile (if you have a project with only installed files, and a python-only project when it will be supported, i.e).

@xclaesse
Copy link
Member

xclaesse commented Mar 3, 2020

meson build would make more sense IMHO. Meson does not always compile (if you have a project with only installed files, and a python-only project when it will be supported, i.e).

The reason we picked 'compile' is because 'meson build' is too common to use 'build' as build directory.

@TheQwertiest
Copy link
Contributor Author

^ What he said =)
Quote from IRC discussion:

jpakkane: The "correct" solution would be to add a new command "meson compile" that does all the magic and call that. (It can't be called "meson build" because that is in common use for creating a build dir.)

@marc-h38
Copy link
Contributor

marc-h38 commented Mar 3, 2020

The documentation should be adjusted accordingly https://mesonbuild.com/Overview.html#terminology

Meson follows the overall structure of other popular build systems, such as CMake and GNU Autotools. This means that the build is divided into two discrete steps: configure step and build step.

(... because that is in common use for creating a build dir.)

Curious where.

@xclaesse
Copy link
Member

xclaesse commented Mar 4, 2020

(... because that is in common use for creating a build dir.)

Curious where.

GStreamer CI for instance: https://gitlab.freedesktop.org/gstreamer/gst-ci/-/blob/master/gitlab/ci_template.yml#L120

dcbaker added a commit to dcbaker/meson that referenced this issue Mar 4, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
dcbaker added a commit to dcbaker/meson that referenced this issue Mar 4, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes mesonbuild#6670
@marc-h38
Copy link
Contributor

marc-h38 commented Mar 4, 2020

Thanks @xclaesse for the example, I totally forgot about the potential collision between command names and parameters. The lack of command defaulting to setup always felt weird to me; but now I know why :-)

xclaesse pushed a commit that referenced this issue Mar 4, 2020
This is tested working with both msbuild and ninja/samu. Since our xcode
support is pretty much broken I didn't bother.

Fixes #6670
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants