Skip to content

Commit

Permalink
MakeDeps: Provide "require" information, and more styling tweaks (#14605
Browse files Browse the repository at this point in the history
)
  • Loading branch information
iskunk authored Aug 31, 2023
1 parent ea6b41b commit e836696
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions conan/tools/gnu/makedeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ class GlobalContentGenerator:
""")

template_deps = textwrap.dedent("""\
{{ define_variable_value("CONAN_DEPS", deps) }}
""")

Expand Down Expand Up @@ -371,10 +370,12 @@ class DepContentGenerator:

template = textwrap.dedent("""\
# {{ dep.ref }}
# {{ dep.ref }}{% if not req.direct %} (indirect dependency){% endif +%}
CONAN_NAME_{{ name }} = {{ dep.ref.name }}
CONAN_VERSION_{{ name }} = {{ dep.ref.version }}
CONAN_REFERENCE_{{ name }} = {{ dep.ref }}
CONAN_ROOT_{{ name }} = {{ root }}
{{ define_variable_value("CONAN_SYSROOT_{}".format(name), sysroot) -}}
Expand All @@ -398,8 +399,9 @@ class DepContentGenerator:
{{- define_variable_value("CONAN_COMPONENTS_{}".format(name), components) -}}
""")

def __init__(self, dependency, root: str, sysroot, dirs: dict, flags: dict):
def __init__(self, dependency, require, root: str, sysroot, dirs: dict, flags: dict):
self._dep = dependency
self._req = require
self._root = root
self._sysroot = sysroot
self._dirs = dirs or {}
Expand All @@ -411,6 +413,7 @@ def content(self) -> str:
"""
context = {
"dep": self._dep,
"req": self._req,
"name": _makefy(self._dep.ref.name),
"root": self._root,
"sysroot": self._sysroot,
Expand Down Expand Up @@ -507,8 +510,9 @@ class DepGenerator:
Process a dependency cpp_info variables and generate its Makefile content
"""

def __init__(self, dependency):
def __init__(self, dependency, require):
self._dep = dependency
self._req = require
self._info = MakeInfo(self._dep.ref.name, [], [])

@property
Expand Down Expand Up @@ -581,7 +585,7 @@ def generate(self) -> str:
sysroot = self._get_sysroot(root)
dirs = self._get_dependency_dirs(root, self._dep)
flags = self._get_dependency_flags(self._dep)
dep_content_gen = DepContentGenerator(self._dep, root, sysroot, dirs, flags)
dep_content_gen = DepContentGenerator(self._dep, self._req, root, sysroot, dirs, flags)
content = dep_content_gen.content()

for comp_name, comp in self._dep.cpp_info.get_sorted_components().items():
Expand Down Expand Up @@ -627,7 +631,7 @@ def generate(self) -> None:
if require.build:
continue

dep_gen = DepGenerator(dep)
dep_gen = DepGenerator(dep, require)
make_infos.append(dep_gen.makeinfo)
deps_buffer += dep_gen.generate()

Expand Down

0 comments on commit e836696

Please sign in to comment.