Compile-time option for a string in Vala (original) (raw)
I’m writing a networked application and I need to add a compile-time option (e.g. in meson.options) for the address of the server. How do I do this? From what I’ve gathered only boolean (i.e. #ifdef, etc.) macros are supported.
jensgeorg (Jens Georg) May 31, 2025, 7:16pm 2
You can do the usual thing of generating a header file and then manually “bind” that variable in your code with
[CCode (cname="MY_CONSTANT_NAME")]
extern string adddress;
(from memories)
Zipdox (Zipdox) May 31, 2025, 7:25pm 3
How would I do that with meson? I’m kinda new to meson.
jensgeorg (Jens Georg) May 31, 2025, 7:29pm 4
So what I do is use configure_file (Configuration) from meson and a custom vapi to bind those defines (src/librygel-core/rygel-build-config.vapi · master · GNOME / rygel · GitLab)