mesonbuild / wrapdb

New wrap requests
https://mesonbuild.com/Adding-new-projects-to-wrapdb.html
MIT License
69 stars 174 forks source link

Declaring Required Project Options for Enabled Dependencies #1573

Open WillAyd opened 5 days ago

WillAyd commented 5 days ago

I am thinking of the best way to distribute the Apache Arrow ADBC project via the WrapDB. At a high level, the ADBC project is structured like:

project('arrow-adbc', ...)

if get_option('sqlite')
    adbc_sqlite_lib = library(...)
endif

if get_option('postgresql')
    adbc_postgresql_lib = library(...)
endif

...

So when compiling the project, you would opt in to whatever database client(s) you need.

Thinking about how to distribute this as a wrapdb entry, it would be great to just allow users to take advantage of something like:

[provide]
adbc_sqlite = adbc_sqlite_dep
adbc_postgresql = adbc_postgresql_dep
...

But to do so, I am under the impression users would have to set those project options each time the dependency is included, i.e.:

adbc_sqlite_dep = dependency('adbc_sqlite', default_options: ['sqlite=true'])
adbc_postgresql_dep = dependency('adbc_postgresql', default_options: ['postgresql=true]')
...

Alternately, perhaps there is a way to extend the Wrap entry to provide that manage that information internally? Please excuse any ignorance on my behalf, but a simplistic solution may look like:

[default_options]
adbc_sqlite = ['sqlite=true']
adbc_postgresql = ['postgresql=true']

From there, Meson may be able to determine what options are being used in the downstream project and set the appropriate compilation flags for the end user