breakfastquay / rubberband

Official mirror of Rubber Band Library, an audio time-stretching and pitch-shifting library.
http://breakfastquay.com/rubberband/
GNU General Public License v2.0
561 stars 89 forks source link

Allow static linking using meson wrap when -Ddefault_library=both #99

Open kasper93 opened 3 months ago

kasper93 commented 3 months ago

Hi,

I'm trying to use rubberband as a meson wrap in clang Windows build. It looks like there is some trickery with static library in this cases EDIT: Clang build doesn't go into this branch, so it is different issue. https://github.com/breakfastquay/rubberband/blob/5d296019ff0fd6085fea0838155b0449a4606397/meson.build#L523 I don't mind any of that, but currently it is impossible to link statically using meson wrap

[provide]
rubberband = rubberband_dep

https://github.com/breakfastquay/rubberband/blob/5d296019ff0fd6085fea0838155b0449a4606397/meson.build#L622-L625 doesn't work, because rubberband_library is always shared library, regardless of -Ddefault_library value.

I've noticed that there is declared dep for objs that could technically work, but include_directories are missing, so it doesn't.

[provide]
rubberband = rubberband_objlib_dep

https://github.com/breakfastquay/rubberband/blob/5d296019ff0fd6085fea0838155b0449a4606397/meson.build#L576-L578

I could patch it myself, but would be great to have ability to use the project directly from wrapdb.

Thanks

EDIT:

Some more information. The issue is when get_option('default_library') is both.

rubberband| Message: Will build Rubber Band Library static library
rubberband| Message: Will build Rubber Band Library dynamic library

Target summary is:

rubberband| Message: {'Static library' : [true, 'Name: rubberband'], 'Dynamic library' : [true, 'Name: rubberband']}

As you can see both have the same name, the logic is not correct. And either way there is no dependency declared for static one in this case.

Although I have no idea where both comes from, I explicit set -Ddefault_library=static. Need to find what is overwriting that.

EDIT2:

default_options specify default_library=both so global option is not used. I needed to explicit override it for rubberband.

So the only remaining issue you might want to fix is to declare static dependency when default_library=both, because currently it is not possible to use it from wrap.

cannam commented 3 months ago

Thanks for the investigation! I will take a look.