If I can suggest a small improvement, you could use the declare_dependency mechanism to add the definition only to the targets that link against libfuse:
libfuse_dep = dependency('libfuse')
libfuse26_dep = declare_dependency(dependencies: [libfuse_dep].
compile_args: '-
DFUSE_USE_VERSION=26')
executable('mount', 'mount.c', dependencies: [libfuse26_dep])
Le vendredi 06 décembre 2019 à 07:37 -0800, Ken Gilmer a écrit :
> 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 <[email protected]> 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
> > > [email protected]
> > > https://mail.gnome.org/mailman/listinfo/vala-list
--
Guillaume Poirier-Morency <[email protected]>
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
signature.asc
Description: This is a digitally signed message part
_______________________________________________ vala-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/vala-list
