conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.95k stars 952 forks source link

[feature] Add support for meson subproject #15886

Open fnadeau opened 3 months ago

fnadeau commented 3 months ago

What is your suggestion?

Add support for meson subproject.

Context: I'm planning, still in developpement, to open a PR for gstreamer-full (gstreamer build fully in static mode, see commit ) but it requires support for subproject in meson.

Proposed syntax looks like this:

tc.subproject_lists["gstreamer"] = [{'coretracers': 'enabled' if self.options.with_coretracers else 'disabled'}]
tc.subproject_lists["gst-plugins-base"] = [{'adder': 'enabled' if self.options.with_adder else 'disabled'}]

This is still in development. I'm not particularly found of the naming, especially subproject_list, so any suggestion that would make this more readable and/or understandable is more than welcom.

I would like to know the interrest in such feature. I currently have this commit. I would like to have input/ help for unit tests (unit testing the whole project has been... challanging and not really 100% pass, to say the least) and also with logic.

I have two point where I need help:

[constants] preprocessor_definitions = []

[project options] wrap_mode = 'nofallback' bindir = 'bin' sbindir = 'bin' libexecdir = 'bin' includedir = 'include' libdir = 'lib' auto_features = 'disabled' default_library = 'static' gst-full-target-type = 'static_library' base = 'enabled' good = 'disabled' ugly = 'disabled' bad = 'disabled' libav = 'disabled' build-tools-source = 'system' orc-source = 'subproject' introspection = 'disabled' orc = 'enabled' gst-full-plugins = '*'

[gstreamer:project options] coretracers = 'enabled'

[gst-plugins-base:project options] gio-typefinder = 'enabled'

gio = 'enabled'

adder = 'enabled'

audiomixer = 'enabled'

audioresample = 'enabled'

encoding = 'enabled'

rawparse = 'enabled'

volume = 'enabled'

videoconvertscale = 'enabled'

dsd = 'enabled'

videorate = 'enabled'

app = 'enabled'

playback = 'enabled'

audiorate = 'enabled'

audiotestsrc = 'enabled'

overlaycomposition = 'enabled'

subparse = 'enabled'

debugutils = 'enabled'

tcp = 'enabled'

drm = 'enabled'

pbtypes = 'enabled'

audioconvert = 'enabled'

typefind = 'enabled'

videotestsrc = 'enabled'

compositor = 'enabled'

[binaries] c = 'gcc' cpp = 'g++'



This is related to a closed ticket: #12774

Your input is greatly appreciated. 

### Have you read the CONTRIBUTING guide?

- [x] I've read the CONTRIBUTING guide
memsharded commented 3 months ago

Hi @fnadeau

Thanks for your suggestion.

I am not an expert in Meson, if I understood it correctly, the requested Conan feature would be to be able to pass options to subprojects defined in the meson.build files, isn't it? Wouldn't the syntax subproject_options be more directly mapped to that, specially given that we already have the MesonToolchain.project_options?

I think this feature can be added, thanks for offering to contribute.

For the test, it would be good enough do add something very similar to test_check_pkg_config_paths() in conans/test/integration/toolchains/meson/test_mesontoolchain.py, that checks the generated files, no need for a full functional compiling test.

fnadeau commented 3 months ago

I added this commit to my branch with suggestion from @memsharded, thanks for those.

I'm still working on gstreamer-full, I'll open a PR as soon as I'm certain the feature can be frozen. In the meanwhile, any input on this feature is appreciated.

memsharded commented 3 months ago

I have seen the commit, and I think it is good. It has little risk, it can be documented as experimental and moved forward, but sounds great until you further validate it with the gstreamer.

franramirez688 commented 3 months ago

Hi @fnadeau

It looks good that branch! šŸ‘ What I'd suggest is to add another functional test to check that it's doing what we expect for those subprojects. I can help with that for sure! šŸ˜ We have some examples here conans/test/functional/toolchains/meson/.

fnadeau commented 3 months ago

Should this be also done for Conan v1?

memsharded commented 3 months ago

Not necessary to backport to Conan 1, thanks!