Re: [Vala] Preprocessor defines via Meson or valac



Hello!

I think that the -D option only applies to the Vala pre-processor (https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor). I don't know meson, but either it uses valac to generate the C source files and then you need to add that option to the CFLAGS, or it does not generate these intermediate files and you need to add -Xcc "-D..." to the valac command-line.

Or you can do both if you like.

Vivien

Le ven. 6 déc. 2019 à 7:13, Ken Gilmer via vala-list <vala-list gnome org> a écrit :
Hello!

I am trying to bind to libfuse from a Vala program. I see that in libfuse I must specify a define to the version of the API I want to use[4]. I read the Vala documentation as to how to define a symbol[3]. I see that there is documentation in meson for how to add arguments to valac[1] but when I
set my flag, add_project_arguments('-D FUSE_USE_VERSION=26', language:
'vala'), valac complains that it doesn't recognize the option and in the build output panel in Gnome Builder it appears to wrap the expression in single quotes. When run valac directly from the command line and sidestep
meson, it seems that the define is ignored[2]. As a sanity test, if I
modify the header to define the value, I get the behavior I want.

My question is, how can I set a preprocessor symbol to a specific value via
Meson or valac?

TIA!
ken

1: https://mesonbuild.com/Vala.html <https://mesonbuild.com/Vala.html#> 2: valac -D FUSE_USE_VERSION=26 --pkg fuse --pkg gobject-2.0 --pkg glib-2.0
main.vala
3: https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor
4:
https://github.com/libfuse/libfuse/blob/fuse_2_9_bugfix/include/fuse.h#L16
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]