Re: [Vala] How to mix vala code and C code in one automake-based project correctly?
- From: PCMan <pcman tw gmail com>
- To: vala-list gnome org
- Subject: Re: [Vala] How to mix vala code and C code in one automake-based project correctly?
- Date: Thu, 27 Oct 2011 16:58:59 +0800
If I did not get it wrong, it seems to generate a single header file "g
mpc-extras.h".
For what I want, I prefer generating file_a.[ch] for file_a.vala,
file_b.[ch] for file_b.vala, and file_c.[ch] for file_c.vala. Each vala file
can has its own generated *.c and *.h files.
Is this possible with autotools?
On Thu, Oct 27, 2011 at 3:25 PM, Qball Cow <qball aggervaccae nl> wrote:
Gmpc does what you want in it build system. So you might want to look at
it. Http://git.musicpd.org it mixes vala,c and gob. Vala is handled by
automake (used to do it with custom rules) only issue atm is parallel build.
Basically:
1. Write a binding file for your C code.
2. Make vala generate and use one header file for your vala files. This can
be done by the vala_args makefile argument (see gmpc src/makefile).
Good luck, feel free to mail if you need help.
R,
Q
On Oct 27, 2011 6:54 AM, "PCMan" <pcman tw gmail com> wrote:
Hello,
I'm the developer of LXDE project and I started using Vala last night.
Most parts of our existing code are written in pure C with or without
GObject.
Now I want to do further development in vala.
To mix vala code with existing C code, I cannot find any good guide on the
internet.
Some existing guides are for writing vapi files to call C code in vala.
Others telling you how to compile vala code with automake or valac.
However, none of them solve my problems.
I want to have a project developed with vala and C.
I need to call the functions and GObjects in C files from vala.
Also, I need to call vala generated objects and functions from my C code
as
well.
I cannot use the "valac -C --header xxxx.h" trick as valac is called by
automake.
In addition, if I write something like this in Makefile.am, it does not
work.
bin_PROGRAMS=myprog
myprog_SOURCES= \
file1.c \
file2.c \
file3.vala \
file4.vala \
file5.c
In this way, C code will be treated as vala, or vala code will be treated
as
C.
Autotools do not seem to handle this well. What's the correct way to do
it?
For calling vala code from C code, a generated *.h file is needed.
I tried adding "--header xxx.h" to VALA_FLAGS and it seemed to work.
However, it generated a huge single header file for all *.vala files
compiled rather than file1.h for file1.vala, file2.h for file2.vala, etc.
How to generate separate *.h files for every single vala file with
autotools?
Or, if this is not supported by autotools, can CMake do this?
I hope these problems can be solved easily so I can do future development
in
Vala rather than having to keep C/GObject.
Thank you all
_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]