mesonbuild / meson

The Meson Build System
http://mesonbuild.com
Apache License 2.0
5.6k stars 1.63k forks source link

C sharp missing library finding support #5352

Open inigomartinez opened 5 years ago

inigomartinez commented 5 years ago

C# is missing library finding support. For example when looking for Mono.Posix or Mono.CSharp libraries in the following way doesn't work:

csc = meson.get_compiler('cs')
csc.find_library('Mono.Posix')

This gives the following warning: Language C sharp does not support library finding.

germandiagogomez commented 5 years ago

Oh, this is going to make my life more difficult. Alternatives?

inigomartinez commented 5 years ago

Oh, this is going to make my life more difficult. Alternatives?

You can user compiler flags to include libraries by using the -r option. For example when including Mono.Posix you have to use the -r:Mono.Posix flag. You can take a look at gbrainy's meson port (there are also other C sharp related workarounds that might be helpful like resource file generation).

Ideally, csc.find_library('Mono.Posix') should check for the existence of the library. Something similar as how is also done in gbrainy (the lib path and particularly the mono version 4.5 is hardcoded but should be acquired from the system) creating a meson dependency that should be later used when building a target by using the necessary compiler flag, e.g. -r:{library}.