Skip to content

cppinfo improvements: components, exe, system deps... #5090

@lasote

Description

@lasote

Intro

The idea is to be able to specify different components (different libs, different exes) in the cpp_info object so it can help with:

Proposition

  • New fields to cpp_info:

    • self.cpp_info.name: It could be used by the generators to name the targets, config files etc. E.g: ZLIB. By default, the package name will be used.
    • self.cpp_info.exes: List of executable names (located in any self.cpp_info.bindirs). It could be used by the generators to export variables with the paths etc.
    • self.cpp_info.system_deps: List of system dependencies. (["dl", "pthread"])
  • Subcomponents:

Enable self.cpp_info["component_id"], that is a very similar object to cpp_info with some exceptions:

  • The component_id already gives the name of the component, can be used by the generators for example to name the component of the target: OpenSSL::Crypto for self.cpp_info["Crypto"].
  • self.cpp_info["component_id"].name: The name for the subcomponent, by default the component_id will be the name.
  • self.cpp_info["component_id"].lib: The library name
  • self.cpp_info["component_id"].exe: The executable name (incompatible with specifying .lib)
  • self.cpp_info["component_id"].deps: List with componen_ids.
  • self.cpp_info["component_id"].system_deps: List with system library names.
  • self.cpp_info["component_id"].libs: That won't exist
  • self.cpp_info["component_id"].exes: That won't exist
  • self.cpp_info["component_id"].name: The name doesn't exist, the "component_id" gives the name already.
  • self.cpp_info["component_id"].rootpath: No sense

The subcomponents will also have available:

self.cpp_info["component_id"].includedirs 
self.cpp_info["component_id"].libdirs 
self.cpp_info["component_id"].resdirs 
self.cpp_info["component_id"].bindirs
self.cpp_info["component_id"].builddirs 
self.cpp_info["component_id"].defines
self.cpp_info["component_id"].cflags 
self.cpp_info["component_id"].cppflags
self.cpp_info["component_id"].cxxflags
self.cpp_info["component_id"].sharedlinkflags
self.cpp_info["component_id"].exelinkflags

If some of these elements are adjusted in the "general" object, the subcomponents will extend the values automatically, even if they do not use the append syntax:

self.cpp_info.include_dirs = ["include2"]
self.cpp_info["crypto"].include_dirs = ["include3"]

That will propagate ["include2", "include3"] as the include dirs for the crypto component.


Related to #4430

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions