Those arguments are passed straight to the C compiler. Le ven. 6 déc. 2019, à 18 h 10, xydarc...@163.com <xydarc...@163.com> a écrit :
> Is that means the args passed to compile_args in dependency would be > treated as vala_args when vala language is used? > > ------------------------------ > xydarc...@163.com > > > *From:* Guillaume Poirier-Morency via vala-list <vala-list@gnome.org> > *Date:* 2019-12-07 01:32 > *To:* Ken Gilmer <kgil...@gmail.com> > *CC:* vala-list <vala-list@gnome.org> > *Subject:* Re: [Vala] Preprocessor defines via Meson or valac > 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 <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 <guillaumepoiriermore...@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 > > -- Guillaume Poirier-Morency <guillaumepoiriermore...@gmail.com> Étudiant à la maîtrise en informatique à l'Université de Montréal Chercheur à l'Institut de recherche en immunologie et en cancérologie *Page Web:* arteymix.github.io *Clé PGP:* B1AD6EA5 <https://pgp.mit.edu/pks/lookup?op=vindex&search=0x1CCFC3A2B1AD6EA5> _______________________________________________ vala-list mailing list vala-list@gnome.org https://mail.gnome.org/mailman/listinfo/vala-list