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

How to handle meson.override_dependency() with dependencies using modules and components #14146

Open
dcbaker opened this issue Jan 16, 2025 · 3 comments

Comments

@dcbaker
Copy link
Member

dcbaker commented Jan 16, 2025

Consider a dependency like LLVM. The correct way to handle this in Meson is something like:

dep_llvm = dependency('llvm', modules : ['core', 'asmparser', 'asmprinter', 'disassembler'])

Nice and easy. However, there isn't really a way to handle this with meson.override_dependency(). It doesn't have modules, and the overridden dependency wont check that the correct modules are set.

@eli-schwartz
Copy link
Member

Another example is the gtest wrap, iirc, with main: true

@dcbaker
Copy link
Member Author

dcbaker commented Jan 16, 2025

Yeah, and I'd like to change that to use either components or modules instead of main at some point, since that's more standard and likley more future proof.

@dcbaker
Copy link
Member Author

dcbaker commented Jan 17, 2025

I spent some time thinking about this, and I think the way to do this is:

meson.override_dependency(
  'name',
  'dependency'  # optional if components is given, if both are given this dependency is always provided. A place for a "core" module like QtCore.
  components : {
     'component1': declare_dependency(...),
     'component2': declare_dependency(...),
  },
)

Then when a dependency() call is given with modules or components (I need to go read the CMake code in Meson more closely to see if there actually is a fundamental difference or if we can collapse those...), the lookup code will return a new internal dependency using those components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants