Re: [Vala] Preprocessor defines via Meson or valac



Thank you Guillaume!  For reference this line in my meson.build file
allowed me to define a preprocessor symbol as desired:

add_project_arguments('-DFUSE_USE_VERSION=26', language: 'c')


On Thu, Dec 5, 2019 at 11:45 PM Guillaume Poirier-Morency via vala-list <
vala-list gnome org> wrote:

Le jeudi 05 décembre 2019 à 22:13 -0800, Ken Gilmer via vala-list 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:

Try to split the arguments in two or remove the space between '-D' and
'FUSE_USE_VERSION=26'.

Like mentioned elsewhere, you will have to set language: 'c' for this
case to work.

'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
--
Guillaume Poirier-Morency <guillaumepoiriermorency gmail com>

Programmeur analyste en bioinformatique au laboratoire Michael Smith
Étudiant à la maîtrise en informatique à l'Université de Montréal

Mon blog: https://arteymix.github.io/
Clé PGP: B1AD6EA5
_______________________________________________
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]