Skip to content
Draft
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
11 changes: 8 additions & 3 deletions mesonbuild/cmake/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def __init__(self, target: CMakeTarget, env: 'Environment', for_machine: Machine
self.generated: T.List[Path] = []
self.generated_ctgt: T.List[CustomTargetReference] = []
self.includes: T.List[Path] = []
self.public_includes: T.List[Path] = []
self.sys_includes: T.List[Path] = []
self.link_with: T.List[T.Union[ConverterTarget, ConverterCustomTarget]] = []
self.object_libs: T.List[ConverterTarget] = []
Expand Down Expand Up @@ -371,7 +372,8 @@ def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: Path, su
self.soversion = trace.targets[self.cmake_name].properties.get('SOVERSION', [None])[0]

rtgt = resolve_cmake_trace_targets(self.cmake_name, trace, self.env, clib_compiler=self.clib_compiler)
self.includes += [Path(x) for x in rtgt.include_directories]
self.public_includes += [Path(x) for x in rtgt.include_directories]
self.includes += [Path(x) for x in rtgt.private_include_directories]
self.link_flags += rtgt.link_flags
self.public_link_flags += rtgt.public_link_flags
self.public_compile_opts += rtgt.public_compile_opts
Expand Down Expand Up @@ -1171,6 +1173,7 @@ def process_target(tgt: ConverterTarget) -> None:

# Determine the variable names
inc_var = f'{tgt.name}_inc'
public_inc_var = f'{tgt.name}_public_inc'
dir_var = f'{tgt.name}_dir'
sys_var = f'{tgt.name}_sys'
src_var = f'{tgt.name}_src'
Expand Down Expand Up @@ -1229,10 +1232,12 @@ def process_target(tgt: ConverterTarget) -> None:
generated += dependencies

# Generate the function nodes
dir_node = assign(dir_var, function('include_directories', tgt.includes))
dir_node = assign(dir_var, function('include_directories', tgt.includes + tgt.public_includes))
public_dir_node = assign(public_inc_var, function('include_directories', tgt.public_includes))
sys_node = assign(sys_var, function('include_directories', tgt.sys_includes, {'is_system': True}))
inc_node = assign(inc_var, array([id_node(dir_var), id_node(sys_var)]))
node_list = [dir_node, sys_node, inc_node]
node_list = [dir_node, public_dir_node, sys_node, inc_node]
dep_kwargs['include_directories'] = id_node(public_inc_var)
if tgt_func == 'header_only':
del dep_kwargs['link_with']
dep_node = assign(dep_var, function('declare_dependency', kwargs=dep_kwargs))
Expand Down
4 changes: 4 additions & 0 deletions mesonbuild/cmake/tracetargets.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def _get_framework_include_path(path: Path) -> T.Optional[str]:
class ResolvedTarget:
def __init__(self) -> None:
self.include_directories: T.List[str] = []
self.private_include_directories: T.List[str] = []
self.link_flags: T.List[str] = []
self.public_link_flags: T.List[str] = []
self.public_compile_opts: T.List[str] = []
Expand Down Expand Up @@ -113,6 +114,9 @@ def resolve_cmake_trace_targets(target_name: str,
if 'INTERFACE_INCLUDE_DIRECTORIES' in tgt.properties:
res.include_directories += [x for x in tgt.properties['INTERFACE_INCLUDE_DIRECTORIES'] if x]

if curr == target_name and 'INCLUDE_DIRECTORIES' in tgt.properties:
res.private_include_directories += [x for x in tgt.properties['INCLUDE_DIRECTORIES'] if x]

if 'INTERFACE_LINK_OPTIONS' in tgt.properties:
res.public_link_flags += [x for x in tgt.properties['INTERFACE_LINK_OPTIONS'] if x]
res.link_flags += res.public_link_flags
Expand Down
Loading