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

[develop2] remove MesonDeps #13134

Merged
merged 1 commit into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion conan/tools/meson/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from conan.tools.meson.meson import Meson
from conan.tools.meson.mesondeps import MesonDeps
from conan.tools.meson.toolchain import MesonToolchain

5 changes: 0 additions & 5 deletions conan/tools/meson/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from conan.tools.build import build_jobs
from conan.tools.meson.toolchain import MesonToolchain
from conan.tools.meson.mesondeps import MesonDeps


class Meson(object):
Expand Down Expand Up @@ -31,7 +30,6 @@ def configure(self, reconfigure=False):
generators_folder = self._conanfile.generators_folder
cross = os.path.join(generators_folder, MesonToolchain.cross_filename)
native = os.path.join(generators_folder, MesonToolchain.native_filename)
deps_flags = os.path.join(generators_folder, MesonDeps.filename) # extra machine files layer
meson_filenames = []
if os.path.exists(cross):
cmd_param = " --cross-file"
Expand All @@ -40,9 +38,6 @@ def configure(self, reconfigure=False):
cmd_param = " --native-file"
meson_filenames.append(native)

if os.path.exists(deps_flags):
meson_filenames.append(deps_flags)

machine_files = self._conanfile.conf.get("tools.meson.mesontoolchain:extra_machine_files",
default=[], check_type=list)
if machine_files:
Expand Down
107 changes: 0 additions & 107 deletions conan/tools/meson/mesondeps.py

This file was deleted.

2 changes: 1 addition & 1 deletion conans/client/generators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from conans.util.files import save, mkdir, chdir

_generators = {"CMakeToolchain": "conan.tools.cmake", "CMakeDeps": "conan.tools.cmake",
"MesonToolchain": "conan.tools.meson", "MesonDeps": "conan.tools.meson",
"MesonToolchain": "conan.tools.meson",
"MSBuildDeps": "conan.tools.microsoft", "MSBuildToolchain": "conan.tools.microsoft",
"NMakeToolchain": "conan.tools.microsoft", "NMakeDeps": "conan.tools.microsoft",
"VCVars": "conan.tools.microsoft",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,19 @@
import platform
import textwrap

from conans.test.assets.sources import gen_function_cpp
import pytest

from conans.test.functional.toolchains.meson._base import TestMesonBase
from conans.test.utils.tools import TestClient


class TestMesonToolchainAndGnuFlags(TestMesonBase):

def test_mesondeps(self):
client = TestClient(path_with_spaces=False)
client.run("new cmake_lib -d name=hello -d version=0.1")
client.run("create .")
app = gen_function_cpp(name="main", includes=["hello"], calls=["hello"])

conanfile_py = textwrap.dedent("""
from conan import ConanFile
from conan.tools.meson import Meson

class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
requires = "hello/0.1"
generators = "MesonDeps", "MesonToolchain"

def layout(self):
self.folders.build = "build"

def build(self):
meson = Meson(self)
meson.configure()
meson.build()
""")

meson_build = textwrap.dedent("""
project('tutorial', 'cpp')
cxx = meson.get_compiler('cpp')
hello = cxx.find_library('hello', required: true)
executable('demo', 'main.cpp', dependencies: hello)
""")

client.save({"conanfile.py": conanfile_py,
"meson.build": meson_build,
"main.cpp": app},
clean_first=True)

client.run("build .")
assert "[2/2] Linking target demo" in client.out

@pytest.mark.tool("meson")
@pytest.mark.tool("pkg_config")
def test_mesondeps_flags_are_being_appended_and_not_replacing_toolchain_ones(self):
"""
Test MesonDeps and MesonToolchain are keeping all the flags/definitions defined
Test PkgConfigDeps and MesonToolchain are keeping all the flags/definitions defined
from both generators and nothing is being messed up.
"""
client = TestClient(path_with_spaces=False)
Expand All @@ -69,7 +33,6 @@ class HelloConan(ConanFile):
version = "0.1"

def package_info(self):
self.cpp_info.libs = ["hello"]
self.cpp_info.cxxflags = [{}]
self.cpp_info.defines = ['DEF1=one_string', 'DEF2=other_string']
""".format(deps_flags))
Expand All @@ -84,16 +47,16 @@ class OtherConan(ConanFile):
version = "0.1"

def package_info(self):
self.cpp_info.libs = ["other"]
self.cpp_info.defines = ['DEF3=simple_string']
""")
client.save({"conanfile.py": conanfile_py}, clean_first=True)
client.run("create .")

# Consumer using MesonDeps and MesonToolchain
# Consumer using PkgConfigDeps and MesonToolchain
conanfile_py = textwrap.dedent("""
from conan import ConanFile
from conan.tools.meson import Meson, MesonDeps, MesonToolchain
from conan.tools.meson import Meson, MesonToolchain
from conan.tools.gnu import PkgConfigDeps

class App(ConanFile):
settings = "os", "arch", "compiler", "build_type"
Expand All @@ -103,8 +66,8 @@ def layout(self):
self.folders.build = "build"

def generate(self):
tc = MesonDeps(self)
tc.generate()
deps = PkgConfigDeps(self)
deps.generate()
tc = MesonToolchain(self)
tc.preprocessor_definitions["VAR"] = "VALUE"
tc.preprocessor_definitions["VAR2"] = "VALUE2"
Expand All @@ -119,8 +82,10 @@ def build(self):
meson_build = textwrap.dedent("""
project('tutorial', 'cpp')
cxx = meson.get_compiler('cpp')
hello = dependency('hello', version : '>=0.1')
other = dependency('other', version : '>=0.1')
# It's not needed to declare "hello/0.1" as a dependency, only interested in flags
executable('demo', 'main.cpp')
executable('demo', 'main.cpp', dependencies: [hello, other])
""")

main = textwrap.dedent("""
Expand Down