question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[feature] Support visual studio backend for meson

See original GitHub issue

Reading the docs https://docs.conan.io/en/latest/reference/build_helpers/meson.html

It would seem conan assumes that meson will always use ninja as the build backend. However meson allows you to build using msvc through the flan --backend.

This means that the following meson command:

meson setup build_vs --backend=vs2019 -Dpkg_config_path=build_vs

Cannot be assembled from the conan.py script.

If you try something like this:

        args = [f'-Dpkg_config_path={os.path.abspath("../" + str(self.folders.generators))}']
        if self.settings.compiler == "gcc":
            self.output.error("gcc")
            args += ["-Db_sanitize=undefined", "-Dcpp_std=c++20"]
        if self.settings.compiler == "Visual Studio":
            self.output.error("VS")
            args += ["--backend=vs2019", "-Dcpp_std=c++20"]

        meson = Meson(self)
        meson.configure(build_folder='.', args=args)
        meson.build(args=['-j2'])

You will get this error:

ERROR: conanfile.py: Error in build() method, line 123
        meson.build(args=['-j2'])
        ConanException: Error 1 while executing ninja -C "C:\Users\Makogan\Documents\neverengine\build_visual_studio_debug\." -j2 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (26 by maintainers)

github_iconTop GitHub Comments

1reaction
Makogancommented, Jan 27, 2022

I made a pull request, the change is so small this should not break compatibility, it handles a strict superset of cases:

https://github.com/conan-io/conan/pull/10447

1reaction
memshardedcommented, Jan 27, 2022

@franramirez688

I have wanted to do a conan new --template=meson_lib for a while, to help with this. Would it make sense to try to contribute this asap?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using with Visual Studio - The Meson Build system
If you wish to generate Visual Studio project files, pass --backend vs . At the time of writing the Ninja backend is more...
Read more >
Meson - PostgreSQL wiki
... meson only supports building out of tree. set up build tree for visual studio, perl src/tools/msvc/mkvcbuild.pl, meson setup --backend ...
Read more >
Compilation and Installation Using Meson - Mesa 3D
Meson only supports out-of-tree builds, and must be passed a directory to put ... passing --backend=vs to Meson will generate a Visual Studio...
Read more >
Meson (software) - Wikipedia
Meson is a software tool for automating the building (compiling) of software. The overall goal for Meson is to promote programmer productivity.
Read more >
Compilation and Installation using Meson
The meson program is used to configure the source directory and generates either a ninja build file or Visual Studio® build files.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found